Commit 63c026c6 authored by Jim Krehl's avatar Jim Krehl Committed by Jim Krehl

Updated recent-files.[ch] to work with both the ~/.recently-used.xbel and

2006-10-23  Jim Krehl  <jimmyk@novell.com>
	* libtile/document-tile.c
	  libtile/document-tile.h
	  utils/recent-files.c
	  utils/recent-files.h
	  main-menu/src/file-area-widget.c:
	Updated recent-files.[ch] to work with both the ~/.recently-used.xbel
	and the older ~/.recently-used file formats.
parent f12d1135
2006-10-23 Jim Krehl <jimmyk@novell.com>
* libtile/document-tile.c
libtile/document-tile.h
utils/recent-files.c
utils/recent-files.h
main-menu/src/file-area-widget.c:
Updated recent-files.[ch] to work with both the ~/.recently-used.xbel
and the older ~/.recently-used file formats.
2006-10-17 Jim Krehl <jimmyk@novell.com>
* libtile/document-tile.c
main-menu/src/recent-files.c
......
......@@ -32,9 +32,7 @@
#include "slab-gnome-util.h"
#include "gnome-utils.h"
#define EGG_ENABLE_RECENT_FILES
#include "egg-recent-model.h"
#include "recent-files.h"
#define GCONF_SEND_TO_CMD_KEY "/desktop/gnome/applications/main-menu/file-area/file_send_to_cmd"
#define GCONF_ENABLE_DELETE_KEY_DIR "/apps/nautilus/preferences"
......@@ -67,10 +65,9 @@ static void gconf_enable_delete_cb (GConfClient *, guint, GConfEntry *, gpointer
typedef struct
{
EggRecentItem *recent_item;
gchar *basename;
gchar *mime_type;
time_t modified;
GnomeVFSMimeApplication *default_app;
......@@ -81,13 +78,15 @@ typedef struct
gboolean delete_enabled;
guint gconf_conn_id;
MainMenuRecentMonitor *recent_monitor;
} DocumentTilePrivate;
static GnomeThumbnailFactory *thumbnail_factory = NULL;
#define DOCUMENT_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DOCUMENT_TILE_TYPE, DocumentTilePrivate))
static void document_tile_class_init (DocumentTileClass * this_class)
static void document_tile_class_init (DocumentTileClass *this_class)
{
GObjectClass *g_obj_class = G_OBJECT_CLASS (this_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (this_class);
......@@ -100,7 +99,7 @@ static void document_tile_class_init (DocumentTileClass * this_class)
}
GtkWidget *
document_tile_new (EggRecentItem *recent_item)
document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
{
DocumentTile *this;
DocumentTilePrivate *priv;
......@@ -123,7 +122,7 @@ document_tile_new (EggRecentItem *recent_item)
gchar *markup;
uri = egg_recent_item_get_uri (recent_item);
uri = g_strdup (in_uri);
image = gtk_image_new ();
......@@ -134,7 +133,7 @@ document_tile_new (EggRecentItem *recent_item)
header = create_header (basename);
time_stamp = g_date_new ();
g_date_set_time (time_stamp, egg_recent_item_get_timestamp (recent_item));
g_date_set_time (time_stamp, modified);
time_str = g_new0 (gchar, 256);
......@@ -153,8 +152,9 @@ document_tile_new (EggRecentItem *recent_item)
g_free (uri);
priv = DOCUMENT_TILE_GET_PRIVATE (this);
priv->recent_item = recent_item;
priv->basename = basename;
priv->mime_type = g_strdup (mime_type);
priv->modified = modified;
priv->header_bin = GTK_BIN (header);
document_tile_private_setup (this);
......@@ -166,8 +166,7 @@ document_tile_new (EggRecentItem *recent_item)
/* make open with default action */
if (priv->default_app)
{
if (priv->default_app) {
markup = g_markup_printf_escaped (_("<b>Open with \"%s\"</b>"),
priv->default_app->name);
action = tile_action_new (TILE (this), open_with_default_trigger, markup,
......@@ -178,8 +177,7 @@ document_tile_new (EggRecentItem *recent_item)
menu_item = GTK_WIDGET (GTK_WIDGET (tile_action_get_menu_item (action)));
}
else
{
else {
action = NULL;
menu_item = gtk_menu_item_new_with_label (_("Open with Default Application"));
gtk_widget_set_sensitive (menu_item, FALSE);
......@@ -281,7 +279,7 @@ document_tile_new (EggRecentItem *recent_item)
}
static void
document_tile_private_setup (DocumentTile * tile)
document_tile_private_setup (DocumentTile *tile)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
......@@ -296,15 +294,9 @@ document_tile_private_setup (DocumentTile * tile)
GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
if (result == GNOME_VFS_OK)
{
priv->mime_type = g_strdup (info->mime_type);
priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
}
else
{
priv->mime_type = NULL;
priv->default_app = NULL;
}
priv->renaming = FALSE;
......@@ -320,14 +312,15 @@ document_tile_private_setup (DocumentTile * tile)
connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile);
g_object_unref (client);
priv->recent_monitor = main_menu_recent_monitor_new ();
}
static void
document_tile_init (DocumentTile * tile)
document_tile_init (DocumentTile *tile)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
priv->recent_item = NULL;
priv->basename = NULL;
priv->mime_type = NULL;
priv->default_app = NULL;
......@@ -339,7 +332,7 @@ document_tile_init (DocumentTile * tile)
}
static void
document_tile_finalize (GObject * g_object)
document_tile_finalize (GObject *g_object)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (g_object);
......@@ -348,7 +341,6 @@ document_tile_finalize (GObject * g_object)
g_free (priv->basename);
g_free (priv->mime_type);
egg_recent_item_unref (priv->recent_item);
gnome_vfs_mime_application_free (priv->default_app);
client = gconf_client_get_default ();
......@@ -358,86 +350,81 @@ document_tile_finalize (GObject * g_object)
g_object_unref (client);
(*G_OBJECT_CLASS (document_tile_parent_class)->finalize) (g_object);
g_object_unref (priv->recent_monitor);
(* G_OBJECT_CLASS (document_tile_parent_class)->finalize) (g_object);
}
static void
document_tile_style_set (GtkWidget * widget, GtkStyle * prev_style)
document_tile_style_set (GtkWidget *widget, GtkStyle *prev_style)
{
load_image (DOCUMENT_TILE (widget));
}
static void
load_image (DocumentTile * tile)
load_image (DocumentTile *tile)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GdkPixbuf *thumb;
gchar *thumb_path;
time_t mtime;
gchar *icon_id = NULL;
gboolean free_icon_id = TRUE;
if (!priv->mime_type || !strstr (TILE (tile)->uri, "file://"))
{
if (! priv->mime_type || ! strstr (TILE (tile)->uri, "file://")) {
icon_id = "gnome-fs-regular";
free_icon_id = FALSE;
goto exit;
}
if (!thumbnail_factory)
if (! thumbnail_factory)
thumbnail_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL);
mtime = egg_recent_item_get_timestamp (priv->recent_item);
thumb_path = gnome_thumbnail_factory_lookup (thumbnail_factory, TILE (tile)->uri, priv->modified);
thumb_path = gnome_thumbnail_factory_lookup (thumbnail_factory, TILE (tile)->uri, mtime);
if (!thumb_path) {
if (
gnome_thumbnail_factory_can_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->mime_type, priv->modified)
) {
thumb = gnome_thumbnail_factory_generate_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->mime_type);
if (!thumb_path)
{
if (gnome_thumbnail_factory_can_thumbnail (thumbnail_factory, TILE (tile)->uri,
priv->mime_type, mtime))
{
thumb = gnome_thumbnail_factory_generate_thumbnail (thumbnail_factory,
TILE (tile)->uri, priv->mime_type);
if (thumb) {
gnome_thumbnail_factory_save_thumbnail (
thumbnail_factory, thumb, TILE (tile)->uri, priv->modified);
if (thumb)
{
gnome_thumbnail_factory_save_thumbnail (thumbnail_factory, thumb,
TILE (tile)->uri, mtime);
icon_id =
gnome_thumbnail_factory_lookup (thumbnail_factory,
TILE (tile)->uri, mtime);
icon_id = gnome_thumbnail_factory_lookup (
thumbnail_factory, TILE (tile)->uri, priv->modified);
g_object_unref (thumb);
}
else
gnome_thumbnail_factory_create_failed_thumbnail (thumbnail_factory,
TILE (tile)->uri, mtime);
gnome_thumbnail_factory_create_failed_thumbnail (
thumbnail_factory, TILE (tile)->uri, priv->modified);
}
}
else
icon_id = thumb_path;
if (!icon_id)
icon_id =
gnome_icon_lookup (gtk_icon_theme_get_default (), thumbnail_factory,
if (! icon_id)
icon_id = gnome_icon_lookup (
gtk_icon_theme_get_default (), thumbnail_factory,
TILE (tile)->uri, NULL, NULL, priv->mime_type, 0, NULL);
exit:
exit:
priv->image_is_broken =
slab_load_image (GTK_IMAGE (NAMEPLATE_TILE (tile)->image), GTK_ICON_SIZE_DND,
icon_id);
priv->image_is_broken = slab_load_image (
GTK_IMAGE (NAMEPLATE_TILE (tile)->image), GTK_ICON_SIZE_DND, icon_id);
if (free_icon_id && icon_id)
g_free (icon_id);
}
static GtkWidget *
create_header (const gchar * name)
create_header (const gchar *name)
{
GtkWidget *header_bin;
GtkWidget *header;
......@@ -456,7 +443,7 @@ create_header (const gchar * name)
}
static GtkWidget *
create_subheader (const gchar * desc)
create_subheader (const gchar *desc)
{
GtkWidget *subheader;
......@@ -470,13 +457,13 @@ create_subheader (const gchar * desc)
}
static void
header_size_allocate_cb (GtkWidget * widget, GtkAllocation * alloc, gpointer user_data)
header_size_allocate_cb (GtkWidget *widget, GtkAllocation *alloc, gpointer user_data)
{
gtk_widget_set_size_request (widget, alloc->width, -1);
}
static void
rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
rename_entry_activate_cb (GtkEntry *entry, gpointer user_data)
{
DocumentTile *tile = DOCUMENT_TILE (user_data);
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
......@@ -493,7 +480,6 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
GnomeVFSResult retval;
EggRecentModel *recent_model;
if (strlen (gtk_entry_get_text (entry)) < 1)
return;
......@@ -511,14 +497,8 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
dst_uri_str = gnome_vfs_uri_to_string (dst_uri, GNOME_VFS_URI_HIDE_NONE);
if (retval == GNOME_VFS_OK)
{
recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
egg_recent_model_delete (recent_model, TILE (tile)->uri);
egg_recent_model_add (recent_model, dst_uri_str);
g_object_unref (recent_model);
if (retval == GNOME_VFS_OK) {
main_menu_rename_recent_file (priv->recent_monitor, TILE (tile)->uri, dst_uri_str);
g_free (priv->basename);
priv->basename = g_strdup (gtk_entry_get_text (entry));
......@@ -547,13 +527,13 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
}
static gboolean
rename_entry_key_release_cb (GtkWidget * widget, GdkEventKey * event, gpointer user_data)
rename_entry_key_release_cb (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
{
return TRUE;
}
static void
gconf_enable_delete_cb (GConfClient * client, guint conn_id, GConfEntry * entry, gpointer user_data)
gconf_enable_delete_cb (GConfClient *client, guint conn_id, GConfEntry *entry, gpointer user_data)
{
Tile *tile = TILE (user_data);
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (user_data);
......@@ -592,7 +572,7 @@ gconf_enable_delete_cb (GConfClient * client, guint conn_id, GConfEntry * entry,
}
static void
open_with_default_trigger (Tile * tile, TileEvent * event, TileAction * action)
open_with_default_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
......@@ -616,7 +596,7 @@ open_with_default_trigger (Tile * tile, TileEvent * event, TileAction * action)
}
static void
open_in_file_manager_trigger (Tile * tile, TileEvent * event, TileAction * action)
open_in_file_manager_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
gchar *filename;
gchar *dirname;
......@@ -646,13 +626,14 @@ open_in_file_manager_trigger (Tile * tile, TileEvent * event, TileAction * actio
}
static void
rename_trigger (Tile * tile, TileEvent * event, TileAction * action)
rename_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GtkWidget *child;
GtkWidget *entry;
entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), priv->basename);
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
......@@ -664,8 +645,7 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action)
gtk_container_add (GTK_CONTAINER (priv->header_bin), entry);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (rename_entry_activate_cb),
tile);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (rename_entry_activate_cb), tile);
g_signal_connect (G_OBJECT (entry), "key_release_event",
G_CALLBACK (rename_entry_key_release_cb), NULL);
......@@ -675,8 +655,10 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action)
}
static void
move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GnomeVFSURI *src_uri;
GnomeVFSURI *trash_uri;
......@@ -685,15 +667,12 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
GnomeVFSResult retval;
EggRecentModel *recent_model;
src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
gnome_vfs_find_directory (src_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_uri,
FALSE, FALSE, 0777);
if (!trash_uri)
{
if (!trash_uri) {
g_warning ("unable to find trash location\n");
return;
......@@ -715,15 +694,8 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL);
if (retval == GNOME_VFS_OK)
{
recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
egg_recent_model_delete (recent_model, TILE (tile)->uri);
g_object_unref (recent_model);
}
else
{
main_menu_remove_recent_file (priv->recent_monitor, TILE (tile)->uri);
else {
trash_uri_str = gnome_vfs_uri_to_string (trash_uri, GNOME_VFS_URI_HIDE_NONE);
g_warning ("unable to move [%s] to the trash [%s]\n", TILE (tile)->uri,
......@@ -739,14 +711,15 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
}
static void
delete_trigger (Tile * tile, TileEvent * event, TileAction * action)
delete_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GnomeVFSURI *src_uri;
GList *list = NULL;
GnomeVFSResult retval;
EggRecentModel *recent_model;
src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
......@@ -756,13 +729,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action)
GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL);
if (retval == GNOME_VFS_OK)
{
recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU);
egg_recent_model_delete (recent_model, TILE (tile)->uri);
g_object_unref (recent_model);
}
main_menu_remove_recent_file (priv->recent_monitor, TILE (tile)->uri);
else
g_warning ("unable to delete [%s]\n", TILE (tile)->uri);
......@@ -771,7 +738,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action)
}
static void
send_to_trigger (Tile * tile, TileEvent * event, TileAction * action)
send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
{
gchar *cmd;
gchar **argv;
......
......@@ -21,9 +21,9 @@
#ifndef __DOCUMENT_TILE_H__
#define __DOCUMENT_TILE_H__
#include "nameplate-tile.h"
#include <time.h>
#include "egg-recent-item.h"
#include "nameplate-tile.h"
G_BEGIN_DECLS
......@@ -34,13 +34,11 @@ G_BEGIN_DECLS
#define IS_DOCUMENT_TILE_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), DOCUMENT_TILE_TYPE))
#define DOCUMENT_TILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DOCUMENT_TILE_TYPE, DocumentTileClass))
typedef struct
{
typedef struct {
NameplateTile nameplate_tile;
} DocumentTile;
typedef struct
{
typedef struct {
NameplateTileClass nameplate_tile_class;
} DocumentTileClass;
......@@ -53,7 +51,8 @@ typedef struct
GType document_tile_get_type (void);
GtkWidget *document_tile_new (EggRecentItem * recent_item);
GtkWidget *document_tile_new (const gchar *uri, const gchar *mime_type, time_t modified);
G_END_DECLS
#endif
......@@ -23,7 +23,6 @@ main_menu_SOURCES = \
network-status-tile.c network-status-tile.h \
network-status-agent.c network-status-agent.h \
network-status-info.c network-status-info.h \
recent-files.c recent-files.h \
slab-window.c slab-window.h \
system-tile.c system-tile.h \
text-button.c text-button.h \
......
......@@ -34,8 +34,6 @@
#include "slab-gnome-util.h"
#include "tile-table.h"
#include "egg-recent-item.h"
#define MAIN_MENU_GCONF_DIR "/desktop/gnome/applications/main-menu"
#define FILE_AREA_GCONF_DIR MAIN_MENU_GCONF_DIR "/file-area"
#define LOCK_DOWN_GCONF_DIR MAIN_MENU_GCONF_DIR "/lock-down"
......@@ -64,6 +62,9 @@ typedef struct {
GtkButton *browser_link;
GtkListStore *file_tables;
MainMenuRecentMonitor *recent_monitor;
gulong store_changed_cb_handle;
} FileAreaWidgetPrivate;
#define FILE_AREA_WIDGET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FILE_AREA_WIDGET_TYPE, FileAreaWidgetPrivate))
......@@ -94,10 +95,7 @@ static void notebook_show_cb (GtkWidget *, gpointer);
static void tile_activated_cb (Tile *, TileEvent *, gpointer);
static void tile_action_triggered_cb (Tile *, TileEvent *, TileAction *, gpointer);
static void recent_apps_store_monitor_cb (GnomeVFSMonitorHandle *, const gchar *,
const gchar *, GnomeVFSMonitorEventType, gpointer);
static void recent_files_store_monitor_cb (GnomeVFSMonitorHandle *, const gchar *,
const gchar *, GnomeVFSMonitorEventType, gpointer);
static void recent_files_store_changed_cb (MainMenuRecentMonitor *, gpointer);
static void tile_table_update_cb (TileTable *, TileTableUpdateEvent *, gpointer);
static void tile_table_uri_added_cb (TileTable *, TileTableURIAddedEvent *, gpointer);
......@@ -124,10 +122,6 @@ GtkWidget *file_area_widget_new (MainMenuUI * ui, MainMenuEngine * engine)
GList *tiles;
GnomeVFSMonitorHandle *handle;
gchar *filename;
gchar *uri;
gchar *markup;
GList *node;
......@@ -138,6 +132,7 @@ GtkWidget *file_area_widget_new (MainMenuUI * ui, MainMenuEngine * engine)
priv = FILE_AREA_WIDGET_GET_PRIVATE (this);
priv->ui = ui;
priv->engine = engine;
priv->recent_monitor = main_menu_recent_monitor_new ();
this->selector_label = get_main_menu_section_header (_("Show:"));
......@@ -197,37 +192,27 @@ GtkWidget *file_area_widget_new (MainMenuUI * ui, MainMenuEngine * engine)
g_signal_connect (G_OBJECT (table), "notify::n-rows",
G_CALLBACK (tile_table_n_rows_notify_cb), this);
break;
case RECENTLY_USED_APPS:
markup = _("Recently Used Applications");
filename = g_build_filename (
g_get_home_dir (), ".recently-used", NULL);
if (! priv->store_changed_cb_handle)
priv->store_changed_cb_handle = g_signal_connect (
G_OBJECT (priv->recent_monitor), "changed",
G_CALLBACK (recent_files_store_changed_cb), this);
uri = gnome_vfs_get_uri_from_local_path (filename);
gnome_vfs_monitor_add (&handle, uri, GNOME_VFS_MONITOR_FILE,
recent_apps_store_monitor_cb, this);
g_free (filename);
g_free (uri);
break;
case RECENT_FILES:
markup = _("Recent Documents");
filename = g_build_filename (
g_get_home_dir (), ".recently-used", NULL);
uri = gnome_vfs_get_uri_from_local_path (filename);
if (! priv->store_changed_cb_handle)
priv->store_changed_cb_handle = g_signal_connect (
G_OBJECT (priv->recent_monitor), "changed",
G_CALLBACK (recent_files_store_changed_cb), this);
gnome_vfs_monitor_add (&handle, uri, GNOME_VFS_MONITOR_FILE,
recent_files_store_monitor_cb, this);
g_free (filename);
g_free (uri);
break;
break;
default:
......@@ -250,8 +235,7 @@ GtkWidget *file_area_widget_new (MainMenuUI * ui, MainMenuEngine * engine)
load_tables (this);
g_signal_connect (G_OBJECT (priv->selector), "changed", G_CALLBACK (selector_changed_cb),
this);
g_signal_connect (G_OBJECT (priv->selector), "changed", G_CALLBACK (selector_changed_cb), this);
g_signal_connect (G_OBJECT (priv->notebook), "show", G_CALLBACK (notebook_show_cb), this);
......@@ -267,7 +251,7 @@ GtkWidget *file_area_widget_new (MainMenuUI * ui, MainMenuEngine * engine)
layout_file_area (this);
select_page (this, &iter_cur);
select_page (this, & iter_cur);
return GTK_WIDGET (this);
}
......@@ -299,13 +283,21 @@ file_area_widget_init (FileAreaWidget *this)
priv->browser_link = NULL;
priv->file_tables = NULL;
priv->recent_monitor = NULL;
priv->store_changed_cb_handle = 0;
}
static void
file_area_widget_finalize (GObject *g_object)
{
/* FIXME */
(*G_OBJECT_CLASS (file_area_widget_parent_class)->finalize) (g_object);
FileAreaWidgetPrivate *priv = FILE_AREA_WIDGET_GET_PRIVATE (g_object);
g_signal_handler_disconnect (priv->recent_monitor, priv->store_changed_cb_handle);
priv->store_changed_cb_handle = 0;
g_object_unref (priv->recent_monitor);
(* G_OBJECT_CLASS (file_area_widget_parent_class)->finalize) (g_object);
}
void
......@@ -374,8 +366,7 @@ load_tables (FileAreaWidget *this)
has_next = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->file_tables), &iter);
while (has_next)
{
while (has_next) {
gtk_tree_model_get (GTK_TREE_MODEL (priv->file_tables), &iter, COLUMN_TILE_TABLE,
&table, COLUMN_TILE_LIST, &list_ptr, -1);
......@@ -406,11 +397,13 @@ select_page (FileAreaWidget *this, GtkTreeIter *iter)
static GList *
get_tiles (FileAreaWidget *this, FileClass file_class)
{
FileAreaWidgetPrivate *priv = FILE_AREA_WIDGET_GET_PRIVATE (this);
GList *files = NULL;
GList *tiles = NULL;
GtkWidget *tile;
gchar *desktop_item_url;
const gchar *desktop_item_url;
GnomeDesktopItem *item;
const gchar *categories;
......@@ -421,6 +414,8 @@ get_tiles (FileAreaWidget *this, FileClass file_class)
GList *existing_files = NULL;
gboolean lost_tile = FALSE;
MainMenuRecentFile *file;
GList *node;
......@@ -466,10 +461,12 @@ get_tiles (FileAreaWidget *this, FileClass file_class)
}
else if (file_class == RECENTLY_USED_APPS) {
files = get_recent_apps ();
files = main_menu_get_recent_apps (priv->recent_monitor);
for (node = files; node; node = node->next) {
desktop_item_url = egg_recent_item_get_uri ((EggRecentItem *) node->data);
file = (MainMenuRecentFile *) node->data;
desktop_item_url = main_menu_recent_file_get_uri (file);
if (!application_is_blacklisted (desktop_item_url)) {
tile = application_tile_new (desktop_item_url);
......@@ -490,17 +487,24 @@ get_tiles (FileAreaWidget *this, FileClass file_class)
tiles = g_list_append (tiles, tile);
}
g_free (desktop_item_url);
egg_recent_item_unref (node->data);
g_object_unref (file);
}
}
else {
files = get_recent_files ();
files = main_menu_get_recent_files (priv->recent_monitor);
for (node = files; node; node = node->next) {
file = (MainMenuRecentFile *) node->data;
for (node = files; node; node = node->next)
tiles = g_list_append (tiles,
document_tile_new ((EggRecentItem *) node->data));
document_tile_new (
main_menu_recent_file_get_uri (file),
main_menu_recent_file_get_mime_type (file),
main_menu_recent_file_get_modified (file)));
g_object_unref (file);
}
}
gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &icon_width, NULL);
......@@ -669,16 +673,9 @@ tile_action_triggered_cb (Tile *tile, TileEvent *event, TileAction *action, gpoi
}
static void
recent_apps_store_monitor_cb (GnomeVFSMonitorHandle *handle, const gchar *monitor_uri,
const gchar *info_uri, GnomeVFSMonitorEventType type, gpointer user_data)
recent_files_store_changed_cb (MainMenuRecentMonitor *manager, gpointer user_data)
{
update_table (FILE_AREA_WIDGET (user_data), RECENTLY_USED_APPS);
}
static void
recent_files_store_monitor_cb (GnomeVFSMonitorHandle *handle, const gchar *monitor_uri,
const gchar *info_uri, GnomeVFSMonitorEventType type, gpointer user_data)
{