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> 2006-10-17 Jim Krehl <jimmyk@novell.com>
* libtile/document-tile.c * libtile/document-tile.c
main-menu/src/recent-files.c main-menu/src/recent-files.c
......
...@@ -32,9 +32,7 @@ ...@@ -32,9 +32,7 @@
#include "slab-gnome-util.h" #include "slab-gnome-util.h"
#include "gnome-utils.h" #include "gnome-utils.h"
#include "recent-files.h"
#define EGG_ENABLE_RECENT_FILES
#include "egg-recent-model.h"
#define GCONF_SEND_TO_CMD_KEY "/desktop/gnome/applications/main-menu/file-area/file_send_to_cmd" #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" #define GCONF_ENABLE_DELETE_KEY_DIR "/apps/nautilus/preferences"
...@@ -67,10 +65,9 @@ static void gconf_enable_delete_cb (GConfClient *, guint, GConfEntry *, gpointer ...@@ -67,10 +65,9 @@ static void gconf_enable_delete_cb (GConfClient *, guint, GConfEntry *, gpointer
typedef struct typedef struct
{ {
EggRecentItem *recent_item;
gchar *basename; gchar *basename;
gchar *mime_type; gchar *mime_type;
time_t modified;
GnomeVFSMimeApplication *default_app; GnomeVFSMimeApplication *default_app;
...@@ -81,13 +78,15 @@ typedef struct ...@@ -81,13 +78,15 @@ typedef struct
gboolean delete_enabled; gboolean delete_enabled;
guint gconf_conn_id; guint gconf_conn_id;
MainMenuRecentMonitor *recent_monitor;
} DocumentTilePrivate; } DocumentTilePrivate;
static GnomeThumbnailFactory *thumbnail_factory = NULL; static GnomeThumbnailFactory *thumbnail_factory = NULL;
#define DOCUMENT_TILE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), DOCUMENT_TILE_TYPE, DocumentTilePrivate)) #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); GObjectClass *g_obj_class = G_OBJECT_CLASS (this_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (this_class); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (this_class);
...@@ -100,7 +99,7 @@ static void document_tile_class_init (DocumentTileClass * this_class) ...@@ -100,7 +99,7 @@ static void document_tile_class_init (DocumentTileClass * this_class)
} }
GtkWidget * GtkWidget *
document_tile_new (EggRecentItem *recent_item) document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
{ {
DocumentTile *this; DocumentTile *this;
DocumentTilePrivate *priv; DocumentTilePrivate *priv;
...@@ -123,7 +122,7 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -123,7 +122,7 @@ document_tile_new (EggRecentItem *recent_item)
gchar *markup; gchar *markup;
uri = egg_recent_item_get_uri (recent_item); uri = g_strdup (in_uri);
image = gtk_image_new (); image = gtk_image_new ();
...@@ -134,7 +133,7 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -134,7 +133,7 @@ document_tile_new (EggRecentItem *recent_item)
header = create_header (basename); header = create_header (basename);
time_stamp = g_date_new (); 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); time_str = g_new0 (gchar, 256);
...@@ -153,9 +152,10 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -153,9 +152,10 @@ document_tile_new (EggRecentItem *recent_item)
g_free (uri); g_free (uri);
priv = DOCUMENT_TILE_GET_PRIVATE (this); priv = DOCUMENT_TILE_GET_PRIVATE (this);
priv->recent_item = recent_item; priv->basename = basename;
priv->basename = basename; priv->mime_type = g_strdup (mime_type);
priv->header_bin = GTK_BIN (header); priv->modified = modified;
priv->header_bin = GTK_BIN (header);
document_tile_private_setup (this); document_tile_private_setup (this);
...@@ -166,8 +166,7 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -166,8 +166,7 @@ document_tile_new (EggRecentItem *recent_item)
/* make open with default action */ /* make open with default action */
if (priv->default_app) if (priv->default_app) {
{
markup = g_markup_printf_escaped (_("<b>Open with \"%s\"</b>"), markup = g_markup_printf_escaped (_("<b>Open with \"%s\"</b>"),
priv->default_app->name); priv->default_app->name);
action = tile_action_new (TILE (this), open_with_default_trigger, markup, action = tile_action_new (TILE (this), open_with_default_trigger, markup,
...@@ -178,8 +177,7 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -178,8 +177,7 @@ document_tile_new (EggRecentItem *recent_item)
menu_item = GTK_WIDGET (GTK_WIDGET (tile_action_get_menu_item (action))); menu_item = GTK_WIDGET (GTK_WIDGET (tile_action_get_menu_item (action)));
} }
else else {
{
action = NULL; action = NULL;
menu_item = gtk_menu_item_new_with_label (_("Open with Default Application")); menu_item = gtk_menu_item_new_with_label (_("Open with Default Application"));
gtk_widget_set_sensitive (menu_item, FALSE); gtk_widget_set_sensitive (menu_item, FALSE);
...@@ -281,7 +279,7 @@ document_tile_new (EggRecentItem *recent_item) ...@@ -281,7 +279,7 @@ document_tile_new (EggRecentItem *recent_item)
} }
static void static void
document_tile_private_setup (DocumentTile * tile) document_tile_private_setup (DocumentTile *tile)
{ {
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
...@@ -296,15 +294,9 @@ document_tile_private_setup (DocumentTile * 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); GNOME_VFS_FILE_INFO_GET_MIME_TYPE | GNOME_VFS_FILE_INFO_FORCE_FAST_MIME_TYPE);
if (result == GNOME_VFS_OK) 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); priv->default_app = gnome_vfs_mime_get_default_application (priv->mime_type);
}
else else
{
priv->mime_type = NULL;
priv->default_app = NULL; priv->default_app = NULL;
}
priv->renaming = FALSE; priv->renaming = FALSE;
...@@ -320,14 +312,15 @@ document_tile_private_setup (DocumentTile * tile) ...@@ -320,14 +312,15 @@ document_tile_private_setup (DocumentTile * tile)
connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile); connect_gconf_notify (GCONF_ENABLE_DELETE_KEY, gconf_enable_delete_cb, tile);
g_object_unref (client); g_object_unref (client);
priv->recent_monitor = main_menu_recent_monitor_new ();
} }
static void static void
document_tile_init (DocumentTile * tile) document_tile_init (DocumentTile *tile)
{ {
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
priv->recent_item = NULL;
priv->basename = NULL; priv->basename = NULL;
priv->mime_type = NULL; priv->mime_type = NULL;
priv->default_app = NULL; priv->default_app = NULL;
...@@ -339,7 +332,7 @@ document_tile_init (DocumentTile * tile) ...@@ -339,7 +332,7 @@ document_tile_init (DocumentTile * tile)
} }
static void static void
document_tile_finalize (GObject * g_object) document_tile_finalize (GObject *g_object)
{ {
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (g_object); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (g_object);
...@@ -348,7 +341,6 @@ document_tile_finalize (GObject * g_object) ...@@ -348,7 +341,6 @@ document_tile_finalize (GObject * g_object)
g_free (priv->basename); g_free (priv->basename);
g_free (priv->mime_type); g_free (priv->mime_type);
egg_recent_item_unref (priv->recent_item);
gnome_vfs_mime_application_free (priv->default_app); gnome_vfs_mime_application_free (priv->default_app);
client = gconf_client_get_default (); client = gconf_client_get_default ();
...@@ -358,86 +350,81 @@ document_tile_finalize (GObject * g_object) ...@@ -358,86 +350,81 @@ document_tile_finalize (GObject * g_object)
g_object_unref (client); 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 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)); load_image (DOCUMENT_TILE (widget));
} }
static void static void
load_image (DocumentTile * tile) load_image (DocumentTile *tile)
{ {
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GdkPixbuf *thumb; GdkPixbuf *thumb;
gchar *thumb_path; gchar *thumb_path;
time_t mtime;
gchar *icon_id = NULL; gchar *icon_id = NULL;
gboolean free_icon_id = TRUE; 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"; icon_id = "gnome-fs-regular";
free_icon_id = FALSE; free_icon_id = FALSE;
goto exit; goto exit;
} }
if (!thumbnail_factory) if (! thumbnail_factory)
thumbnail_factory = gnome_thumbnail_factory_new (GNOME_THUMBNAIL_SIZE_NORMAL); 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 (thumb) {
{ gnome_thumbnail_factory_save_thumbnail (
if (gnome_thumbnail_factory_can_thumbnail (thumbnail_factory, TILE (tile)->uri, thumbnail_factory, thumb, TILE (tile)->uri, priv->modified);
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, mtime);
icon_id = icon_id = gnome_thumbnail_factory_lookup (
gnome_thumbnail_factory_lookup (thumbnail_factory, thumbnail_factory, TILE (tile)->uri, priv->modified);
TILE (tile)->uri, mtime);
g_object_unref (thumb); g_object_unref (thumb);
} }
else else
gnome_thumbnail_factory_create_failed_thumbnail (thumbnail_factory, gnome_thumbnail_factory_create_failed_thumbnail (
TILE (tile)->uri, mtime); thumbnail_factory, TILE (tile)->uri, priv->modified);
} }
} }
else else
icon_id = thumb_path; icon_id = thumb_path;
if (!icon_id) if (! icon_id)
icon_id = icon_id = gnome_icon_lookup (
gnome_icon_lookup (gtk_icon_theme_get_default (), thumbnail_factory, gtk_icon_theme_get_default (), thumbnail_factory,
TILE (tile)->uri, NULL, NULL, priv->mime_type, 0, NULL); TILE (tile)->uri, NULL, NULL, priv->mime_type, 0, NULL);
exit: exit:
priv->image_is_broken = priv->image_is_broken = slab_load_image (
slab_load_image (GTK_IMAGE (NAMEPLATE_TILE (tile)->image), GTK_ICON_SIZE_DND, GTK_IMAGE (NAMEPLATE_TILE (tile)->image), GTK_ICON_SIZE_DND, icon_id);
icon_id);
if (free_icon_id && icon_id) if (free_icon_id && icon_id)
g_free (icon_id); g_free (icon_id);
} }
static GtkWidget * static GtkWidget *
create_header (const gchar * name) create_header (const gchar *name)
{ {
GtkWidget *header_bin; GtkWidget *header_bin;
GtkWidget *header; GtkWidget *header;
...@@ -456,7 +443,7 @@ create_header (const gchar * name) ...@@ -456,7 +443,7 @@ create_header (const gchar * name)
} }
static GtkWidget * static GtkWidget *
create_subheader (const gchar * desc) create_subheader (const gchar *desc)
{ {
GtkWidget *subheader; GtkWidget *subheader;
...@@ -470,13 +457,13 @@ create_subheader (const gchar * desc) ...@@ -470,13 +457,13 @@ create_subheader (const gchar * desc)
} }
static void 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); gtk_widget_set_size_request (widget, alloc->width, -1);
} }
static void 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); DocumentTile *tile = DOCUMENT_TILE (user_data);
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
...@@ -493,7 +480,6 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data) ...@@ -493,7 +480,6 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
GnomeVFSResult retval; GnomeVFSResult retval;
EggRecentModel *recent_model;
if (strlen (gtk_entry_get_text (entry)) < 1) if (strlen (gtk_entry_get_text (entry)) < 1)
return; return;
...@@ -511,14 +497,8 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data) ...@@ -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); dst_uri_str = gnome_vfs_uri_to_string (dst_uri, GNOME_VFS_URI_HIDE_NONE);
if (retval == GNOME_VFS_OK) if (retval == GNOME_VFS_OK) {
{ main_menu_rename_recent_file (priv->recent_monitor, TILE (tile)->uri, dst_uri_str);
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);
g_free (priv->basename); g_free (priv->basename);
priv->basename = g_strdup (gtk_entry_get_text (entry)); priv->basename = g_strdup (gtk_entry_get_text (entry));
...@@ -547,13 +527,13 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data) ...@@ -547,13 +527,13 @@ rename_entry_activate_cb (GtkEntry * entry, gpointer user_data)
} }
static gboolean 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; return TRUE;
} }
static void 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); Tile *tile = TILE (user_data);
DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (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, ...@@ -592,7 +572,7 @@ gconf_enable_delete_cb (GConfClient * client, guint conn_id, GConfEntry * entry,
} }
static void 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); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
...@@ -616,7 +596,7 @@ open_with_default_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -616,7 +596,7 @@ open_with_default_trigger (Tile * tile, TileEvent * event, TileAction * action)
} }
static void 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 *filename;
gchar *dirname; gchar *dirname;
...@@ -646,13 +626,14 @@ open_in_file_manager_trigger (Tile * tile, TileEvent * event, TileAction * actio ...@@ -646,13 +626,14 @@ open_in_file_manager_trigger (Tile * tile, TileEvent * event, TileAction * actio
} }
static void 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); DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
GtkWidget *child; GtkWidget *child;
GtkWidget *entry; GtkWidget *entry;
entry = gtk_entry_new (); entry = gtk_entry_new ();
gtk_entry_set_text (GTK_ENTRY (entry), priv->basename); gtk_entry_set_text (GTK_ENTRY (entry), priv->basename);
gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1); gtk_editable_select_region (GTK_EDITABLE (entry), 0, -1);
...@@ -664,8 +645,7 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -664,8 +645,7 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action)
gtk_container_add (GTK_CONTAINER (priv->header_bin), entry); gtk_container_add (GTK_CONTAINER (priv->header_bin), entry);
g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (rename_entry_activate_cb), g_signal_connect (G_OBJECT (entry), "activate", G_CALLBACK (rename_entry_activate_cb), tile);
tile);
g_signal_connect (G_OBJECT (entry), "key_release_event", g_signal_connect (G_OBJECT (entry), "key_release_event",
G_CALLBACK (rename_entry_key_release_cb), NULL); G_CALLBACK (rename_entry_key_release_cb), NULL);
...@@ -675,8 +655,10 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -675,8 +655,10 @@ rename_trigger (Tile * tile, TileEvent * event, TileAction * action)
} }
static void 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 *src_uri;
GnomeVFSURI *trash_uri; GnomeVFSURI *trash_uri;
...@@ -685,15 +667,12 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -685,15 +667,12 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
GnomeVFSResult retval; GnomeVFSResult retval;
EggRecentModel *recent_model;
src_uri = gnome_vfs_uri_new (TILE (tile)->uri); src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
gnome_vfs_find_directory (src_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_uri, gnome_vfs_find_directory (src_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, &trash_uri,
FALSE, FALSE, 0777); FALSE, FALSE, 0777);
if (!trash_uri) if (!trash_uri) {
{
g_warning ("unable to find trash location\n"); g_warning ("unable to find trash location\n");
return; return;
...@@ -715,15 +694,8 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -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); GNOME_VFS_XFER_ERROR_MODE_ABORT, GNOME_VFS_XFER_OVERWRITE_MODE_REPLACE, NULL, NULL);
if (retval == GNOME_VFS_OK) if (retval == GNOME_VFS_OK)
{ main_menu_remove_recent_file (priv->recent_monitor, TILE (tile)->uri);
recent_model = egg_recent_model_new (EGG_RECENT_MODEL_SORT_MRU); else {
egg_recent_model_delete (recent_model, TILE (tile)->uri);
g_object_unref (recent_model);
}
else
{
trash_uri_str = gnome_vfs_uri_to_string (trash_uri, GNOME_VFS_URI_HIDE_NONE); 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, 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) ...@@ -739,14 +711,15 @@ move_to_trash_trigger (Tile * tile, TileEvent * event, TileAction * action)
} }
static void 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; GnomeVFSURI *src_uri;
GList *list = NULL; GList *list = NULL;
GnomeVFSResult retval; GnomeVFSResult retval;
EggRecentModel *recent_model;
src_uri = gnome_vfs_uri_new (TILE (tile)->uri); src_uri = gnome_vfs_uri_new (TILE (tile)->uri);
...@@ -756,13 +729,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -756,13 +729,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action)
GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL); GNOME_VFS_XFER_REMOVESOURCE, NULL, NULL);
if (retval == GNOME_VFS_OK) if (retval == GNOME_VFS_OK)
{ main_menu_remove_recent_file (priv->recent_monitor, TILE (tile)->uri);
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 else
g_warning ("unable to delete [%s]\n", TILE (tile)->uri); g_warning ("unable to delete [%s]\n", TILE (tile)->uri);
...@@ -771,7 +738,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action) ...@@ -771,7 +738,7 @@ delete_trigger (Tile * tile, TileEvent * event, TileAction * action)
} }
static void static void
send_to_trigger (Tile * tile, TileEvent * event, TileAction * action) send_to_trigger (Tile *tile, TileEvent *event, TileAction *action)
{ {
gchar *cmd; gchar *cmd;
gchar **argv; gchar **argv;
......
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#ifndef __DOCUMENT_TILE_H__ #ifndef __DOCUMENT_TILE_H__
#define __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 G_BEGIN_DECLS
...@@ -34,13 +34,11 @@ 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 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)) #define DOCUMENT_TILE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), DOCUMENT_TILE_TYPE, DocumentTileClass))
typedef struct typedef struct {
{
NameplateTile nameplate_tile; NameplateTile nameplate_tile;
} DocumentTile; } DocumentTile;
typedef struct typedef struct {
{
NameplateTileClass nameplate_tile_class; NameplateTileClass nameplate_tile_class;
} DocumentTileClass; } DocumentTileClass;
...@@ -53,7 +51,8 @@ typedef struct ...@@ -53,7 +51,8 @@ typedef struct
GType document_tile_get_type (void); 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 G_END_DECLS
#endif #endif
...@@ -23,7 +23,6 @@ main_menu_SOURCES = \ ...@@ -23,7 +23,6 @@ main_menu_SOURCES = \
network-status-tile.c network-status-tile.h \ network-status-tile.c network-status-tile.h \
network-status-agent.c network-status-agent.h \ network-status-agent.c network-status-agent.h \
network-status-info.c network-status-info.h \ network-status-info.c network-status-info.h \
recent-files.c recent-files.h \
slab-window.c slab-window.h \ slab-window.c slab-window.h \
system-tile.c system-tile.h \ system-tile.c system-tile.h \
text-button.c text-button.h \ text-button.c text-button.h \
......