Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2:Test
libslab
libslab-bnc187879-clear-recent-files.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libslab-bnc187879-clear-recent-files.patch of Package libslab
diff -Npur libslab-old/libslab/bookmark-agent.c libslab-new/libslab/bookmark-agent.c --- libslab-old/libslab/bookmark-agent.c 2009-02-26 15:34:37.000000000 +0800 +++ libslab-new/libslab/bookmark-agent.c 2009-02-26 15:28:53.000000000 +0800 @@ -220,7 +220,7 @@ bookmark_agent_move_item (BookmarkAgent } void -bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri) +bookmark_agent_purge_items (BookmarkAgent *this) { BookmarkAgentPrivate *priv = PRIVATE (this); @@ -229,11 +229,44 @@ bookmark_agent_remove_item (BookmarkAgen GError *error = NULL; gchar **uris = NULL; - gint rank_i; + gsize uris_len; gint i; + g_return_if_fail (priv->user_modifiable); + + uris = g_bookmark_file_get_uris (priv->store, &uris_len); + if (TYPE_IS_RECENT (priv->type)) { + for (i = 0; i < uris_len; i++) { + gtk_recent_manager_remove_item (gtk_recent_manager_get_default (), uris [i], & error); + + if (error) + libslab_handle_g_error ( + & error, "%s: unable to remove [%s] from %s.", + G_STRFUNC, priv->store_path, uris [i]); + } + } else { + for (i = 0; i < uris_len; i++) { + g_bookmark_file_remove_item (priv->store, uris [i], NULL); + } + save_store (this); + } + g_strfreev (uris); +} +void +bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri) +{ + BookmarkAgentPrivate *priv = PRIVATE (this); - g_return_if_fail (priv->user_modifiable); + gint rank; + + GError *error = NULL; + + gchar **uris = NULL; + gint rank_i; + gint i; + + + g_return_if_fail (priv->user_modifiable); if (! bookmark_agent_has_item (this, uri)) return; diff -Npur libslab-old/libslab/bookmark-agent.h libslab-new/libslab/bookmark-agent.h --- libslab-old/libslab/bookmark-agent.h 2009-02-26 15:34:37.000000000 +0800 +++ libslab-new/libslab/bookmark-agent.h 2009-02-26 15:30:24.000000000 +0800 @@ -80,7 +80,8 @@ void bookmark_agent_move_item void bookmark_agent_remove_item (BookmarkAgent *this, const gchar *uri); void bookmark_agent_reorder_items (BookmarkAgent *this, const gchar **uris); -void bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store); +void bookmark_agent_update_from_bookmark_file (BookmarkAgent *this, GBookmarkFile *store); +void bookmark_agent_purge_items (BookmarkAgent *this); void bookmark_item_free (BookmarkItem *item); diff -Npur libslab-old/libslab/document-tile.c libslab-new/libslab/document-tile.c --- libslab-old/libslab/document-tile.c 2009-02-26 15:34:37.000000000 +0800 +++ libslab-new/libslab/document-tile.c 2009-02-26 15:31:13.000000000 +0800 @@ -55,6 +55,8 @@ static void open_with_default_trigger static void open_in_file_manager_trigger (Tile *, TileEvent *, TileAction *); static void rename_trigger (Tile *, TileEvent *, TileAction *); static void move_to_trash_trigger (Tile *, TileEvent *, TileAction *); +static void remove_recent_item (Tile *, TileEvent *, TileAction *); +static void purge_recent_items (Tile *, TileEvent *, TileAction *); static void delete_trigger (Tile *, TileEvent *, TileAction *); static void user_docs_trigger (Tile *, TileEvent *, TileAction *); static void send_to_trigger (Tile *, TileEvent *, TileAction *); @@ -109,14 +111,14 @@ document_tile_new_force_icon (const gcha DocumentTile *this; DocumentTilePrivate *priv; - this = (DocumentTile *) document_tile_new (in_uri, mime_type, modified); + this = (DocumentTile *) document_tile_new (BOOKMARK_STORE_USER_DOCS, in_uri, mime_type, modified); priv = DOCUMENT_TILE_GET_PRIVATE (this); priv->force_icon_name = g_strdup (icon); return GTK_WIDGET (this); } GtkWidget * -document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified) +document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *in_uri, const gchar *mime_type, time_t modified) { DocumentTile *this; DocumentTilePrivate *priv; @@ -177,11 +179,11 @@ document_tile_new (const gchar *in_uri, priv->mime_type = g_strdup (mime_type); priv->modified = modified; priv->header_bin = GTK_BIN (header); + priv->agent = bookmark_agent_get_instance (bookmark_store_type); document_tile_private_setup (this); - - TILE (this)->actions = g_new0 (TileAction *, 7); - TILE (this)->n_actions = 7; + TILE (this)->actions = g_new0 (TileAction *, DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS); + TILE (this)->n_actions = DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS; menu_ctnr = GTK_CONTAINER (TILE (this)->context_menu); @@ -293,6 +295,23 @@ document_tile_new (const gchar *in_uri, gtk_container_add (menu_ctnr, menu_item); } + if (!priv->is_bookmarked) { + /* clean item from menu */ + action = tile_action_new (TILE (this), remove_recent_item, _("Remove from recent menu"), 0); + TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ITEM] = action; + + menu_item = GTK_WIDGET (tile_action_get_menu_item (action)); + gtk_container_add (menu_ctnr, menu_item); + + /* clean all the items from menu */ + + action = tile_action_new (TILE (this), purge_recent_items, _("Purge all the recent items"), 0); + TILE (this)->actions[DOCUMENT_TILE_ACTION_CLEAN_ALL] = action; + + menu_item = GTK_WIDGET (tile_action_get_menu_item (action)); + gtk_container_add (menu_ctnr, menu_item); + } + gtk_widget_show_all (GTK_WIDGET (TILE (this)->context_menu)); accessible = gtk_widget_get_accessible (GTK_WIDGET (this)); @@ -339,8 +358,6 @@ document_tile_private_setup (DocumentTil g_object_unref (client); - priv->agent = bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS); - priv->notify_signal_id = g_signal_connect ( G_OBJECT (priv->agent), "notify", G_CALLBACK (agent_notify_cb), this); } @@ -708,7 +725,7 @@ update_user_list_menu_item (DocumentTile if (! action) return; - priv->is_bookmarked = bookmark_agent_has_item (priv->agent, TILE (this)->uri); + priv->is_bookmarked = bookmark_agent_has_item (bookmark_agent_get_instance (BOOKMARK_STORE_USER_DOCS), TILE (this)->uri); if (priv->is_bookmarked) tile_action_set_menu_item_label (action, _("Remove from Favorites")); @@ -936,6 +953,20 @@ rename_trigger (Tile *tile, TileEvent *e } static void +remove_recent_item (Tile *tile, TileEvent *event, TileAction *action) +{ + DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); + bookmark_agent_remove_item (priv->agent, TILE (tile)->uri); +} + +static void +purge_recent_items (Tile *tile, TileEvent *event, TileAction *action) +{ + DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); + bookmark_agent_purge_items (priv->agent); +} + +static void move_to_trash_trigger (Tile *tile, TileEvent *event, TileAction *action) { DocumentTilePrivate *priv = DOCUMENT_TILE_GET_PRIVATE (tile); diff -Npur libslab-old/libslab/document-tile.h libslab-new/libslab/document-tile.h --- libslab-old/libslab/document-tile.h 2009-02-26 15:34:37.000000000 +0800 +++ libslab-new/libslab/document-tile.h 2009-02-26 15:31:09.000000000 +0800 @@ -24,6 +24,7 @@ #include <time.h> #include "nameplate-tile.h" +#include "bookmark-agent.h" G_BEGIN_DECLS @@ -49,11 +50,13 @@ typedef struct { #define DOCUMENT_TILE_ACTION_DELETE 4 #define DOCUMENT_TILE_ACTION_UPDATE_MAIN_MENU 5 #define DOCUMENT_TILE_ACTION_SEND_TO 6 -#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS 7 /* must be last entry and equal to the number of actions */ +#define DOCUMENT_TILE_ACTION_CLEAN_ITEM 7 +#define DOCUMENT_TILE_ACTION_CLEAN_ALL 8 +#define DOCUMENT_TILE_ACTION_NUM_OF_ACTIONS 9 /* must be last entry and equal to the number of actions */ GType document_tile_get_type (void); -GtkWidget *document_tile_new (const gchar *uri, const gchar *mime_type, time_t modified); +GtkWidget *document_tile_new (BookmarkStoreType bookmark_store_type, const gchar *uri, const gchar *mime_type, time_t modified); //If you want to show a icon instead of a thumbnail GtkWidget *document_tile_new_force_icon (const gchar *uri, const gchar *mime_type, time_t modified, const gchar *icon);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor