diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-06-14 07:13:57 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-06-14 07:13:57 +0800 |
commit | f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86 (patch) | |
tree | 59d82205cf28609adc4d9e15982a132849ba29a9 /src/ephy-window.c | |
parent | ba1b334527bccd32be59964d3f18d6883f4bee39 (diff) | |
download | gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar.gz gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar.bz2 gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar.lz gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar.xz gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.tar.zst gsoc2013-epiphany-f7f4b30f8e6d8f2a74114d3b8689ea921e0e4a86.zip |
Make visibility a tab GObject property.
2003-06-14 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-tab.c: (ephy_tab_get_property), (ephy_tab_set_property),
(ephy_tab_class_init), (ephy_tab_get_visibility),
(ephy_tab_visibility_cb):
Make visibility a tab GObject property.
* src/ephy-window.h:
* src/ephy-window.c: (sync_tab_visibility), (update_window_visibility),
(tab_added_cb), (tab_removed_cb):
Sync on tab visibility changes.
Diffstat (limited to 'src/ephy-window.c')
-rw-r--r-- | src/ephy-window.c | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index a0250babf..0b9f38df3 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -749,6 +749,40 @@ sync_tab_title (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) } static void +sync_tab_visibility (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) +{ + GList *l, *tabs; + gboolean visible = FALSE; + + if (window->priv->closing) return; + + LOG ("sync tab visibility window %p tab %p", window, tab) + + tabs = ephy_window_get_tabs (window); + for (l = tabs; l != NULL; l = l->next) + { + EphyTab *tab = EPHY_TAB(l->data); + g_return_if_fail (IS_EPHY_TAB(tab)); + + if (ephy_tab_get_visibility (tab)) + { + visible = TRUE; + break; + } + } + g_list_free (tabs); + + if (visible) + { + gtk_widget_show (GTK_WIDGET(window)); + } + else + { + gtk_widget_hide (GTK_WIDGET (window)); + } +} + +static void sync_tab_zoom (EphyTab *tab, GParamSpec *pspec, EphyWindow *window) { EggActionGroup *action_group; @@ -933,6 +967,9 @@ tab_added_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window) sync_tab_load_status (tab, NULL, window); g_signal_connect_object (G_OBJECT (tab), "notify::load-status", G_CALLBACK (sync_tab_load_status), window, 0); + sync_tab_visibility (tab, NULL, window); + g_signal_connect_object (G_OBJECT (tab), "notify::visible", + G_CALLBACK (sync_tab_visibility), window, 0); } static void @@ -946,6 +983,9 @@ tab_removed_cb (EphyNotebook *notebook, GtkWidget *child, EphyWindow *window) g_signal_handlers_disconnect_by_func (G_OBJECT (tab), G_CALLBACK (sync_tab_load_status), window); + g_signal_handlers_disconnect_by_func (G_OBJECT (tab), + G_CALLBACK (sync_tab_visibility), + window); window->priv->num_tabs--; @@ -1519,36 +1559,6 @@ update_find_control (EphyWindow *window) } } -static void -update_window_visibility (EphyWindow *window) -{ - GList *l, *tabs; - gboolean visible = FALSE; - - tabs = ephy_window_get_tabs (window); - for (l = tabs; l != NULL; l = l->next) - { - EphyTab *tab = EPHY_TAB(l->data); - g_return_if_fail (IS_EPHY_TAB(tab)); - - if (ephy_tab_get_visibility (tab)) - { - visible = TRUE; - break; - } - } - g_list_free (tabs); - - if (visible) - { - gtk_widget_show (GTK_WIDGET(window)); - } - else - { - gtk_widget_hide (GTK_WIDGET (window)); - } -} - void ephy_window_update_control (EphyWindow *window, ControlID control) @@ -1560,9 +1570,6 @@ ephy_window_update_control (EphyWindow *window, case FindControl: update_find_control (window); break; - case WindowVisibilityControl: - update_window_visibility (window); - break; case FavoritesControl: update_favorites_control (window); break; |