From f294d79a74b04dcef6fd7edfb14b2325022648a4 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 26 Sep 2009 22:08:16 +0200 Subject: [PATCH] Show "Menubar" menu in context menu if menubar and navibar are hidden It happens that users hide all toolbars and don't find a way to make them visible again. A menu item will be there for this case. --- midori/midori-browser.c | 10 ++++++++++ midori/midori-view.c | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 007e91d1..042d8560 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2849,6 +2849,11 @@ _action_menubar_activate (GtkToggleAction* action, _midori_browser_save_toolbar_items (browser); } } + + g_object_set_data (G_OBJECT (browser), "midori-toolbars-visible", + GTK_WIDGET_VISIBLE (browser->menubar) + || GTK_WIDGET_VISIBLE (browser->navigationbar) + ? (void*)0xdeadbeef : NULL); #endif } @@ -2860,6 +2865,11 @@ _action_navigationbar_activate (GtkToggleAction* action, if (browser->settings) g_object_set (browser->settings, "show-navigationbar", active, NULL); sokoke_widget_set_visible (browser->navigationbar, active); + + g_object_set_data (G_OBJECT (browser), "midori-toolbars-visible", + GTK_WIDGET_VISIBLE (browser->menubar) + || GTK_WIDGET_VISIBLE (browser->navigationbar) + ? (void*)0xdeadbeef : NULL); } static void diff --git a/midori/midori-view.c b/midori/midori-view.c index 3404dc4b..942f9d78 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -1814,6 +1814,13 @@ webkit_web_view_populate_popup_cb (WebKitWebView* web_view, G_CALLBACK (midori_web_view_menu_inspect_page_activate_cb), widget); */ #endif + if (!g_object_get_data (G_OBJECT (browser), "midori-toolbars-visible")) + { + menuitem = sokoke_action_create_popup_menu_item ( + gtk_action_group_get_action (actions, "Menubar")); + gtk_menu_shell_append (menu_shell, menuitem); + } + menuitem = sokoke_action_create_popup_menu_item ( gtk_action_group_get_action (actions, "ZoomIn")); gtk_menu_shell_append (menu_shell, menuitem); -- 2.39.5