aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog14
-rw-r--r--src/ephy-tab.c20
-rw-r--r--src/ephy-window.c73
-rw-r--r--src/ephy-window.h1
4 files changed, 69 insertions, 39 deletions
diff --git a/ChangeLog b/ChangeLog
index ffd85b965..c18206272 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
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.
+
+2003-06-14 Christian Persch <chpe@cvs.gnome.org>
+
* data/epiphany.schemas.in:
* src/prefs-dialog.c: (create_fonts_language_menu):
diff --git a/src/ephy-tab.c b/src/ephy-tab.c
index 5bb0a5e25..72069955f 100644
--- a/src/ephy-tab.c
+++ b/src/ephy-tab.c
@@ -85,6 +85,7 @@ enum
PROP_NAVIGATION,
PROP_SECURITY,
PROP_TITLE,
+ PROP_VISIBLE,
PROP_WINDOW,
PROP_ZOOM
};
@@ -164,6 +165,7 @@ ephy_tab_set_property (GObject *object,
case PROP_NAVIGATION:
case PROP_SECURITY:
case PROP_TITLE:
+ case PROP_VISIBLE:
case PROP_ZOOM:
/* read only */
break;
@@ -204,6 +206,9 @@ ephy_tab_get_property (GObject *object,
case PROP_TITLE:
g_value_set_string (value, tab->priv->title);
break;
+ case PROP_VISIBLE:
+ g_value_set_boolean (value, tab->priv->visibility);
+ break;
case PROP_WINDOW:
g_value_set_object (value, tab->priv->window);
break;
@@ -305,6 +310,14 @@ ephy_tab_class_init (EphyTabClass *class)
G_PARAM_READABLE));
g_object_class_install_property (object_class,
+ PROP_LOAD_STATUS,
+ g_param_spec_boolean ("visible",
+ "Visibility",
+ "The tab's visibility",
+ TRUE,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class,
PROP_WINDOW,
g_param_spec_object ("window",
"Window",
@@ -486,9 +499,10 @@ ephy_tab_set_visibility (EphyTab *tab,
gboolean visible)
{
g_return_if_fail (IS_EPHY_TAB (tab));
- g_return_if_fail (tab->priv->window != NULL);
tab->priv->visibility = visible;
+
+ g_object_notify (G_OBJECT (tab), "visible");
}
static void
@@ -796,10 +810,6 @@ ephy_tab_visibility_cb (EphyEmbed *embed, gboolean visibility,
}
ephy_tab_set_visibility (tab, visibility);
-
- g_return_if_fail (tab->priv->window != NULL);
-
- ephy_window_update_control (tab->priv->window, WindowVisibilityControl);
}
static void
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;
diff --git a/src/ephy-window.h b/src/ephy-window.h
index abb643eaf..d1915b201 100644
--- a/src/ephy-window.h
+++ b/src/ephy-window.h
@@ -63,7 +63,6 @@ typedef enum
typedef enum
{
FindControl,
- WindowVisibilityControl,
FavoritesControl
} ControlID;