From 9572ff99cce801cd84c898b74500e5f49937c2ae Mon Sep 17 00:00:00 2001 From: Peter Hatina Date: Fri, 11 Nov 2011 01:22:15 +0100 Subject: [PATCH] Hide all bars in fullscreen and a menu to Unfullscreen Fixes: https://bugs.launchpad.net/midori/+bug/783675 --- midori/midori-browser.c | 35 +++++++++++++++++++++++++++++++++-- midori/midori-view.c | 11 +++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index e8633142..a34a8352 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -3470,9 +3470,34 @@ _action_fullscreen_activate (GtkAction* action, state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser))); if (state & GDK_WINDOW_STATE_FULLSCREEN) + { + if (katze_object_get_boolean (G_OBJECT (browser->settings), "show-panel")) + gtk_widget_show (browser->panel); + + if (katze_object_get_boolean (G_OBJECT (browser->settings), "show-bookmarkbar")) + gtk_widget_show (browser->bookmarkbar); + + if (browser->show_navigationbar) + gtk_widget_show (browser->navigationbar); + + if (browser->show_statusbar) + gtk_widget_show (browser->statusbar); + + if (browser->show_tabs) + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), TRUE); + gtk_window_unfullscreen (GTK_WINDOW (browser)); + } else + { + gtk_widget_hide (browser->panel); + gtk_widget_hide (browser->bookmarkbar); + gtk_widget_hide (browser->navigationbar); + gtk_widget_hide (browser->statusbar); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (browser->notebook), FALSE); + gtk_window_fullscreen (GTK_WINDOW (browser)); + } } static void @@ -3657,8 +3682,9 @@ _action_location_focus_out (GtkAction* action, MidoriBrowser* browser) { GtkWidget* view = midori_browser_get_current_tab (browser); + GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser))); - if (!browser->show_navigationbar) + if (!browser->show_navigationbar || state & GDK_WINDOW_STATE_FULLSCREEN) gtk_widget_hide (browser->navigationbar); if (g_object_get_data (G_OBJECT (view), "news-feeds")) @@ -3945,8 +3971,13 @@ static void _action_search_focus_out (GtkAction* action, MidoriBrowser* browser) { - if (gtk_widget_get_visible (browser->statusbar) && !browser->show_navigationbar) + GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser))); + if ((gtk_widget_get_visible (browser->statusbar) + && !browser->show_navigationbar) + || (state & GDK_WINDOW_STATE_FULLSCREEN)) + { gtk_widget_hide (browser->navigationbar); + } } static void diff --git a/midori/midori-view.c b/midori/midori-view.c index ca3a975e..86ea575c 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -2625,6 +2625,17 @@ midori_view_populate_popup (MidoriView* view, g_object_set_data (G_OBJECT (menuitem), "y", GINT_TO_POINTER (y)); } + GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (GTK_WIDGET (browser))); + if (state & GDK_WINDOW_STATE_FULLSCREEN) + { + menuitem = sokoke_action_create_popup_menu_item ( + gtk_action_group_get_action (actions, "Fullscreen")); + + gtk_image_menu_item_set_use_stock (GTK_IMAGE_MENU_ITEM (menuitem), TRUE); + gtk_menu_item_set_label (GTK_MENU_ITEM (menuitem), GTK_STOCK_LEAVE_FULLSCREEN); + gtk_menu_shell_append (menu_shell, menuitem); + } + gtk_widget_show_all (menu); } -- 2.39.5