Toggle bookmark actions depending on if we have any

So app mode without bookmarks won't show menu items
for adding or managing bookmarks.
This commit is contained in:
Christian Dywan 2010-10-24 19:23:16 +02:00
parent bcde0df374
commit 6b77d140ea
2 changed files with 20 additions and 1 deletions

View 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);

View 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;