]> spindle.queued.net Git - midori/commitdiff
Toggle bookmark actions depending on if we have any
authorChristian Dywan <christian@twotoasts.de>
Sun, 24 Oct 2010 17:23:16 +0000 (19:23 +0200)
committerChristian Dywan <christian@twotoasts.de>
Sun, 24 Oct 2010 19:06:27 +0000 (21:06 +0200)
So app mode without bookmarks won't show menu items
for adding or managing bookmarks.

midori/main.c
midori/midori-browser.c

index 2815ee1c30e2197a7bc308a6b2db975f96d9b71b..ecdb700ab2a7da4c21d7fdbe74d157ef5ce3fa1d 100644 (file)
@@ -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);
index 8bba238cfa7fa48c6c122d91da4c6b501d6f36b4..6c0a7ada0b9a22ae4bbb5a09470f5ad67f247bbf 100644 (file)
@@ -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;