From ab2413f51a0497c1ac4f99569fdb725ccdcbb3cd Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Mon, 18 Apr 2005 12:32:05 +0000 Subject: Hide the statusbar's resize grip when the window is maximised. Fixes bug 2005-04-18 Christian Persch * src/ephy-window.c: (ephy_window_state_event), (ephy_window_class_init), (ephy_window_init): Hide the statusbar's resize grip when the window is maximised. Fixes bug #301048, patchy by Paolo Borelli. --- src/ephy-window.c | 96 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 57 insertions(+), 39 deletions(-) (limited to 'src/ephy-window.c') diff --git a/src/ephy-window.c b/src/ephy-window.c index dff44fed2..f14b9810b 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -642,42 +642,6 @@ ephy_window_unfullscreen (EphyWindow *window) sync_chromes_visibility (window); } -static gboolean -ephy_window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, EphyWindow *window) -{ - if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) - { - GtkActionGroup *action_group; - GtkAction *action; - gboolean fullscreen; - - fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; - - if (fullscreen) - { - ephy_window_fullscreen (window); - } - else - { - ephy_window_unfullscreen (window); - } - - action_group = window->priv->action_group; - - action = gtk_action_group_get_action (action_group, "ViewFullscreen"); - g_signal_handlers_block_by_func - (action, G_CALLBACK (window_cmd_view_fullscreen), window); - gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen); - g_signal_handlers_unblock_by_func - (action, G_CALLBACK (window_cmd_view_fullscreen), window); - - action = gtk_action_group_get_action (action_group, "EditToolbar"); - g_object_set (action, "sensitive", !fullscreen, NULL); - } - - return FALSE; -} - static gboolean confirm_close_with_modified_forms (EphyWindow *window) { @@ -2563,6 +2527,62 @@ ephy_window_focus_out_event (GtkWidget *widget, return GTK_WIDGET_CLASS (parent_class)->focus_out_event (widget, event); } +static gboolean +ephy_window_state_event (GtkWidget *widget, + GdkEventWindowState *event) +{ + EphyWindow *window = EPHY_WINDOW (widget); + EphyWindowPrivate *priv = window->priv; + gboolean (* window_state_event) (GtkWidget *, GdkEventWindowState *); + + window_state_event = GTK_WIDGET_CLASS (parent_class)->window_state_event; + if (window_state_event) + { + window_state_event (widget, event); + } + + if (event->changed_mask & (GDK_WINDOW_STATE_MAXIMIZED)) + { + gboolean show; + + show = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) == 0; + + gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (priv->statusbar), show); + } + + if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) + { + GtkActionGroup *action_group; + GtkAction *action; + gboolean fullscreen; + + fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; + + if (fullscreen) + { + ephy_window_fullscreen (window); + } + else + { + ephy_window_unfullscreen (window); + } + + action_group = priv->action_group; + + action = gtk_action_group_get_action (action_group, "ViewFullscreen"); + g_signal_handlers_block_by_func + (action, G_CALLBACK (window_cmd_view_fullscreen), window); + gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), fullscreen); + g_signal_handlers_unblock_by_func + (action, G_CALLBACK (window_cmd_view_fullscreen), window); + + action = gtk_action_group_get_action (action_group, "EditToolbar"); + g_object_set (action, "sensitive", !fullscreen, NULL); + } + + return FALSE; +} + static void ephy_window_link_iface_init (EphyLinkIface *iface) { @@ -2587,6 +2607,7 @@ ephy_window_class_init (EphyWindowClass *klass) widget_class->key_press_event = ephy_window_key_press_event; widget_class->focus_in_event = ephy_window_focus_in_event; widget_class->focus_out_event = ephy_window_focus_out_event; + widget_class->window_state_event = ephy_window_state_event; g_object_class_install_property (object_class, PROP_ACTIVE_TAB, @@ -2860,9 +2881,6 @@ ephy_window_init (EphyWindow *window) egg_editable_toolbar_set_model (EGG_EDITABLE_TOOLBAR (window->priv->toolbar), model); - g_signal_connect (window, "window-state-event", - G_CALLBACK (ephy_window_state_event_cb), - window); g_signal_connect (window, "delete-event", G_CALLBACK (ephy_window_delete_event_cb), window); -- cgit v1.2.3