From 6b77d140ea09cf61c9d9998f929c075d2cd39dac Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sun, 24 Oct 2010 19:23:16 +0200 Subject: [PATCH] Toggle bookmark actions depending on if we have any So app mode without bookmarks won't show menu items for adding or managing bookmarks. --- midori/main.c | 1 - midori/midori-browser.c | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/midori/main.c b/midori/main.c index 2815ee1c..ecdb700a 100644 --- a/midori/main.c +++ b/midori/main.c @@ -1860,7 +1860,6 @@ main (int argc, midori_browser_set_action_visible (browser, "Menubar", FALSE); } g_object_set (settings, "show-panel", FALSE, NULL); - midori_browser_set_action_visible (browser, "Bookmarks", FALSE); midori_browser_set_action_visible (browser, "Tools", FALSE); midori_browser_set_action_visible (browser, "Panel", FALSE); g_object_set (browser, "settings", settings, NULL); diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 8bba238c..6c0a7ada 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -5774,6 +5774,12 @@ midori_browser_init (MidoriBrowser* browser) /* FIXME: Show once implemented */ _action_set_visible (browser, "AddDesktopShortcut", FALSE); + _action_set_visible (browser, "Bookmarks", browser->bookmarks != NULL); + _action_set_visible (browser, "BookmarkAdd", browser->bookmarks != NULL); + _action_set_visible (browser, "BookmarksImport", browser->bookmarks != NULL); + _action_set_visible (browser, "BookmarksExport", browser->bookmarks != NULL); + _action_set_visible (browser, "Bookmarkbar", browser->bookmarks != NULL); + /* Create the navigationbar */ browser->navigationbar = gtk_ui_manager_get_widget ( ui_manager, "/toolbar_navigation"); @@ -6423,6 +6429,20 @@ midori_browser_set_bookmarks (MidoriBrowser* browser, midori_browser_show_bookmarkbar_notify_value_cb, browser); katze_object_assign (browser->bookmarks, bookmarks); + _action_set_visible (browser, "Bookmarks", bookmarks != NULL); + if (bookmarks != NULL) + { + /* FIXME: Proxies aren't shown propely. Why? */ + GSList* proxies = gtk_action_get_proxies ( + _action_by_name (browser, "Bookmarks")); + for (; proxies; proxies = g_slist_next (proxies)) + gtk_widget_show (proxies->data); + } + _action_set_visible (browser, "BookmarkAdd", bookmarks != NULL); + _action_set_visible (browser, "BookmarksImport", bookmarks != NULL); + _action_set_visible (browser, "BookmarksExport", bookmarks != NULL); + _action_set_visible (browser, "Bookmarkbar", bookmarks != NULL); + if (!bookmarks) return;