View | Details | Raw Unified | Return to bug 187879
Collapse All | Expand All

(-)gnome-main-menu-old/libslab/bookmark-agent.c (-3 / +36 lines)
Lines 220-226 bookmark_agent_move_item (BookmarkAgent Link Here
220
}
220
}
221
221
222
void
222
void
223
bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri)
223
bookmark_agent_purge_items (BookmarkAgent *this)
224
{
224
{
225
	BookmarkAgentPrivate *priv = PRIVATE (this);
225
	BookmarkAgentPrivate *priv = PRIVATE (this);
226
226
Lines 229-239 bookmark_agent_remove_item (BookmarkAgen Link Here
229
	GError *error = NULL;
229
	GError *error = NULL;
230
230
231
	gchar **uris = NULL;
231
	gchar **uris = NULL;
232
	gint    rank_i;
232
	gsize   uris_len;
233
	gint    i;
233
	gint    i;
234
	g_return_if_fail (priv->user_modifiable);
235
		
236
	uris = g_bookmark_file_get_uris (priv->store, &uris_len);
237
	if (TYPE_IS_RECENT (priv->type)) {
238
		for (i = 0; i < uris_len; i++) {
239
			gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uris [i], & error);
240
241
			if (error)
242
				libslab_handle_g_error (
243
					& error, "%s: unable to remove [%s] from %s.",
244
					G_STRFUNC, priv->store_path, uris [i]);
245
		}
246
	} else {
247
		for (i = 0; i < uris_len; i++) {
248
			g_bookmark_file_remove_item (priv->store, uris [i], NULL);
249
		}
250
		save_store (this);
251
	}
252
	g_strfreev (uris);
253
}
234
254
255
void
256
bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri)
257
{
258
        BookmarkAgentPrivate *priv = PRIVATE (this);
235
259
236
	g_return_if_fail (priv->user_modifiable);
260
        gint rank;
261
262
        GError *error = NULL;
263
264
        gchar **uris = NULL;
265
        gint    rank_i;
266
        gint    i;
267
268
269
        g_return_if_fail (priv->user_modifiable);
237
270
238
	if (! bookmark_agent_has_item (this, uri))
271
	if (! bookmark_agent_has_item (this, uri))
239
		return;
272
		return;
(-)gnome-main-menu-old/libslab/bookmark-agent.h (-1 / +2 lines)
Lines 80-86 void bookmark_agent_move_item Link Here
80
void           bookmark_agent_remove_item   (BookmarkAgent *this, const gchar *uri);
80
void           bookmark_agent_remove_item   (BookmarkAgent *this, const gchar *uri);
81
void           bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris);
81
void           bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris);
82
82
83
void bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
83
void	       bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store);
84
void	       bookmark_agent_purge_items (BookmarkAgent *this);
84
85
85
void           bookmark_item_free           (BookmarkItem *item);
86
void           bookmark_item_free           (BookmarkItem *item);
86
87
(-)gnome-main-menu-old/libslab/document-tile.c (-8 / +39 lines)
Lines 55-60 static void open_with_default_trigger Link Here
55
static void open_in_file_manager_trigger (Tile *, TileEvent *, TileAction *);
55
static void open_in_file_manager_trigger (Tile *, TileEvent *, TileAction *);
56
static void rename_trigger               (Tile *, TileEvent *, TileAction *);
56
static void rename_trigger               (Tile *, TileEvent *, TileAction *);
57
static void move_to_trash_trigger        (Tile *, TileEvent *, TileAction *);
57
static void move_to_trash_trigger        (Tile *, TileEvent *, TileAction *);
58
static void remove_recent_item           (Tile *, TileEvent *, TileAction *);
59
static void purge_recent_items           (Tile *, TileEvent *, TileAction *);
58
static void delete_trigger               (Tile *, TileEvent *, TileAction *);
60
static void delete_trigger               (Tile *, TileEvent *, TileAction *);
59
static void user_docs_trigger            (Tile *, TileEvent *, TileAction *);
61
static void user_docs_trigger            (Tile *, TileEvent *, TileAction *);
60
static void send_to_trigger              (Tile *, TileEvent *, TileAction *);
62
static void send_to_trigger              (Tile *, TileEvent *, TileAction *);
Lines 109-122 document_tile_new_force_icon (const gcha Link Here
109
	DocumentTile *this;
111
	DocumentTile *this;
110
	DocumentTilePrivate *priv;
112
	DocumentTilePrivate *priv;
111
	
113
	
112
	this = (DocumentTile *) document_tile_new (in_uri, mime_type, modified);
114
	this = (DocumentTile *) document_tile_new (BOOKMARK_STORE_USER_DOCS, in_uri, mime_type, modified);
113
	priv = DOCUMENT_TILE_GET_PRIVATE (this);
115
	priv = DOCUMENT_TILE_GET_PRIVATE (this);
114
	priv->force_icon_name = g_strdup (icon);
116
	priv->force_icon_name = g_strdup (icon);
115
	return GTK_WIDGET (this);
117
	return GTK_WIDGET (this);
116
}
118
}
117
119
118
GtkWidget *
120
GtkWidget *
119
document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified)
121
document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *in_uri, const gchar *mime_type, time_t modified)
120
{
122
{
121
	DocumentTile *this;
123
	DocumentTile *this;
122
	DocumentTilePrivate *priv;
124
	DocumentTilePrivate *priv;
Lines 177-187 document_tile_new (const gchar *in_uri, Link Here
177
	priv->mime_type   = g_strdup (mime_type);
179
	priv->mime_type   = g_strdup (mime_type);
178
	priv->modified    = modified;
180
	priv->modified    = modified;
179
	priv->header_bin  = GTK_BIN (header);
181
	priv->header_bin  = GTK_BIN (header);
182
	priv->agent = bookmark_agent_get_instance (bookmark_store_type);
180
183
181
	document_tile_private_setup (this);
184
	document_tile_private_setup (this);
182
185
	TILE (this)->actions = g_new0 (TileAction *, DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS);
183
	TILE (this)->actions = g_new0 (TileAction *, 7);
186
	TILE (this)->n_actions = DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS;
184
	TILE (this)->n_actions = 7;
185
187
186
	menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
188
	menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu);
187
189
Lines 293-298 document_tile_new (const gchar *in_uri, Link Here
293
		gtk_container_add (menu_ctnr, menu_item);
295
		gtk_container_add (menu_ctnr, menu_item);
294
	}
296
	}
295
297
298
	if (!priv->is_bookmarked) {
299
		/* clean item from menu */
300
		action = tile_action_new (TILE (this), remove_recent_item, _("Remove from recent menu"), 0);
301
		TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ITEM] = action;
302
303
		menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
304
		gtk_container_add (menu_ctnr, menu_item);
305
306
		/* clean all the items from menu */
307
308
		action = tile_action_new (TILE (this), purge_recent_items, _("Purge all the recent items"), 0);
309
		TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ALL] = action;
310
311
		menu_item = GTK_WIDGET (tile_action_get_menu_item (action));
312
		gtk_container_add (menu_ctnr, menu_item);
313
	}
314
296
	gtk_widget_show_all (GTK_WIDGET (TILE (this)->context_menu));
315
	gtk_widget_show_all (GTK_WIDGET (TILE (this)->context_menu));
297
316
298
	accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
317
	accessible = gtk_widget_get_accessible (GTK_WIDGET (this));
Lines 339-346 document_tile_private_setup (DocumentTil Link Here
339
358
340
	g_object_unref (client);
359
	g_object_unref (client);
341
360
342
	priv->agent = bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS);
343
344
	priv->notify_signal_id = g_signal_connect (
361
	priv->notify_signal_id = g_signal_connect (
345
		G_OBJECT (priv->agent), "notify", G_CALLBACK (agent_notify_cb), this);
362
		G_OBJECT (priv->agent), "notify", G_CALLBACK (agent_notify_cb), this);
346
}
363
}
Lines 708-714 update_user_list_menu_item (DocumentTile Link Here
708
	if (! action)
725
	if (! action)
709
		return;
726
		return;
710
727
711
	priv->is_bookmarked = bookmark_agent_has_item (priv->agent, TILE (this)->uri);
728
	priv->is_bookmarked = bookmark_agent_has_item (bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS), TILE (this)->uri);
712
729
713
	if (priv->is_bookmarked)
730
	if (priv->is_bookmarked)
714
		tile_action_set_menu_item_label (action, _("Remove from Favorites"));
731
		tile_action_set_menu_item_label (action, _("Remove from Favorites"));
Lines 936-941 rename_trigger (Tile *tile, TileEvent *e Link Here
936
}
953
}
937
954
938
static void
955
static void
956
remove_recent_item (Tile *tile, TileEvent *event, TileAction *action)
957
{
958
	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
959
	bookmark_agent_remove_item (priv->agent, TILE (tile)->uri);
960
}
961
962
static void
963
purge_recent_items (Tile *tile, TileEvent *event, TileAction *action)
964
{
965
	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
966
	bookmark_agent_purge_items (priv->agent);
967
}
968
969
static void
939
move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
970
move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action)
940
{
971
{
941
	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
972
	DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile);
(-)gnome-main-menu-old/libslab/document-tile.h (-2 / +5 lines)
Lines 24-29 Link Here
24
#include <time.h>
24
#include <time.h>
25
25
26
#include "nameplate-tile.h"
26
#include "nameplate-tile.h"
27
#include "bookmark-agent.h"
27
28
28
G_BEGIN_DECLS
29
G_BEGIN_DECLS
29
30
Lines 49-59 typedef struct { Link Here
49
#define DOCUMENT_TILE_ACTION_DELETE               4
50
#define DOCUMENT_TILE_ACTION_DELETE               4
50
#define DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU     5
51
#define DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU     5
51
#define DOCUMENT_TILE_ACTION_SEND_TO              6
52
#define DOCUMENT_TILE_ACTION_SEND_TO              6
52
#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS       7 /* must be last entry and equal to the number of actions */
53
#define DOCUMENT_TILE_ACTION_CLEAN_ITEM		  7
54
#define DOCUMENT_TILE_ACTION_CLEAN_ALL		  8
55
#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS       9 /* must be last entry and equal to the number of actions */
53
56
54
GType document_tile_get_type (void);
57
GType document_tile_get_type (void);
55
58
56
GtkWidget *document_tile_new (const gchar *uri, const gchar *mime_type, time_t modified);
59
GtkWidget *document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *uri, const gchar *mime_type, time_t modified);
57
60
58
//If you want to show a icon instead of a thumbnail
61
//If you want to show a icon instead of a thumbnail
59
GtkWidget *document_tile_new_force_icon (const gchar *uri, const gchar *mime_type, time_t modified, const gchar *icon);
62
GtkWidget *document_tile_new_force_icon (const gchar *uri, const gchar *mime_type, time_t modified, const gchar *icon);
(-)gnome-main-menu-old/main-menu/src/main-menu-ui.c (-2 / +2 lines)
Lines 1069-1075 item_to_user_doc_tile (BookmarkItem *ite Link Here
1069
			return TILE (document_tile_new_force_icon (item->uri, item->mime_type,
1069
			return TILE (document_tile_new_force_icon (item->uri, item->mime_type,
1070
				item->mtime, "gnome-mime-application-vnd.oasis.opendocument.text-template"));
1070
				item->mtime, "gnome-mime-application-vnd.oasis.opendocument.text-template"));
1071
	}
1071
	}
1072
	return TILE (document_tile_new (item->uri, item->mime_type, item->mtime));
1072
	return TILE (document_tile_new (BOOKMARK_STORE_USER_DOCS, item->uri, item->mime_type, item->mtime));
1073
}
1073
}
1074
1074
1075
static Tile *
1075
static Tile *
Lines 1116-1122 item_to_recent_doc_tile (BookmarkItem *i Link Here
1116
	if (bookmark_agent_has_item (priv->bm_agents [BOOKMARK_STORE_USER_DOCS], item->uri))
1116
	if (bookmark_agent_has_item (priv->bm_agents [BOOKMARK_STORE_USER_DOCS], item->uri))
1117
		return NULL;
1117
		return NULL;
1118
1118
1119
	return TILE (document_tile_new (item->uri, item->mime_type, item->mtime));
1119
	return TILE (document_tile_new (BOOKMARK_STORE_RECENT_DOCS, item->uri, item->mime_type, item->mtime));
1120
}
1120
}
1121
1121
1122
static Tile *
1122
static Tile *

Return to bug 187879