[gthumb] add the entry points to the bookmark menu
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] add the entry points to the bookmark menu
- Date: Mon, 28 Mar 2011 17:32:56 +0000 (UTC)
commit 068522a7c36db7f7f6a48fbc3059f392050fdf5e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Wed Mar 23 11:48:41 2011 +0100
add the entry points to the bookmark menu
extensions/bookmarks/callbacks.c | 59 ++++++++++++++++++++++++++++++++++++++
gthumb/gth-browser.c | 2 +
2 files changed, 61 insertions(+), 0 deletions(-)
---
diff --git a/extensions/bookmarks/callbacks.c b/extensions/bookmarks/callbacks.c
index 9255c62..e55eff7 100644
--- a/extensions/bookmarks/callbacks.c
+++ b/extensions/bookmarks/callbacks.c
@@ -40,6 +40,8 @@ static const char *fixed_ui_info =
" <separator/>"
" <menu name='SystemBookmarks' action='SystemBookmarksMenu'>"
" </menu>"
+" <separator name='EntryPointListSeparator'/>"
+" <placeholder name='EntryPointList'/>"
" <separator name='BookmarkListSeparator'/>"
" <placeholder name='BookmarkList'/>"
" </menu>"
@@ -69,6 +71,7 @@ typedef struct {
GthBrowser *browser;
GtkActionGroup *actions;
guint bookmarks_changed_id;
+ guint entry_points_changed_id;
} BrowserData;
@@ -80,6 +83,11 @@ browser_data_free (BrowserData *data)
data->bookmarks_changed_id);
data->bookmarks_changed_id = 0;
}
+ if (data->entry_points_changed_id != 0) {
+ g_signal_handler_disconnect (gth_main_get_default_monitor (),
+ data->entry_points_changed_id);
+ data->entry_points_changed_id = 0;
+ }
g_free (data);
}
@@ -285,6 +293,51 @@ bookmarks_changed_cb (GthMonitor *monitor,
}
+static void
+_gth_browser_update_entry_point_list (GthBrowser *browser)
+{
+ GtkUIManager *ui;
+ GtkWidget *separator1;
+ GtkWidget *separator2;
+ GtkWidget *menu;
+ GList *entry_points;
+ GList *scan;
+ int position;
+
+ ui = gth_browser_get_ui_manager (browser);
+ separator1 = gtk_ui_manager_get_widget (ui, "/MenuBar/OtherMenus/Bookmarks/EntryPointListSeparator");
+ separator2 = gtk_ui_manager_get_widget (ui, "/MenuBar/OtherMenus/Bookmarks/BookmarkListSeparator");
+ menu = gtk_widget_get_parent (separator1);
+ _gtk_container_remove_children (GTK_CONTAINER (menu), separator1, separator2);
+
+ position = 6;
+ entry_points = gth_main_get_all_entry_points ();
+ for (scan = entry_points; scan; scan = scan->next) {
+ GthFileData *file_data = scan->data;
+
+ _gth_browser_add_file_menu_item_full (browser,
+ menu,
+ file_data->file,
+ g_file_info_get_icon (file_data->info),
+ g_file_info_get_display_name (file_data->info),
+ GTH_ACTION_GO_TO,
+ 0,
+ position++);
+ }
+
+ _g_object_list_unref (entry_points);
+}
+
+
+static void
+entry_points_changed_cb (GthMonitor *monitor,
+ gpointer user_data)
+{
+ BrowserData *data = user_data;
+ call_when_idle ((DataFunc) _gth_browser_update_entry_point_list, data->browser);
+}
+
+
void
bookmarks__gth_browser_construct_cb (GthBrowser *browser)
{
@@ -313,6 +366,12 @@ bookmarks__gth_browser_construct_cb (GthBrowser *browser)
"bookmarks-changed",
G_CALLBACK (bookmarks_changed_cb),
data);
+ data->entry_points_changed_id = g_signal_connect (gth_main_get_default_monitor (),
+ "entry-points-changed",
+ G_CALLBACK (entry_points_changed_cb),
+ data);
+
+ _gth_browser_update_entry_point_list (browser);
g_object_set_data_full (G_OBJECT (browser), BROWSER_DATA_KEY, data, (GDestroyNotify) browser_data_free);
}
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 0fc7901..631dc2e 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -1707,6 +1707,8 @@ mount_volume_ready_cb (GObject *source_object,
/* try to load again */
+ gth_monitor_file_entry_points_changed (gth_main_get_default_monitor());
+
_gth_browser_update_entry_point_list (load_data->browser);
_gth_browser_load (load_data->browser,
load_data->requested_folder->file,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]