aboutsummaryrefslogtreecommitdiffstats
path: root/src/toolbar.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-06-16 20:31:08 +0800
committerChristian Persch <chpe@src.gnome.org>2004-06-16 20:31:08 +0800
commite107b8c04820a45b8b4daca62e767cdfd8e62e23 (patch)
tree536c5f23466c16b391603b2634ca32f58fddbf6c /src/toolbar.c
parenta6c12b524b75382eb362e400df3b40c23bf24067 (diff)
downloadgsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar.gz
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar.bz2
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar.lz
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar.xz
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.tar.zst
gsoc2013-epiphany-e107b8c04820a45b8b4daca62e767cdfd8e62e23.zip
Go back to construction the toolbar when the model is set, fixes bug
2004-06-16 Christian Persch <chpe@cvs.gnome.org> * lib/egg/egg-editable-toolbar.c: (egg_editable_toolbar_disconnect_model), (egg_editable_toolbar_deconstruct), (egg_editable_toolbar_set_model), (egg_editable_toolbar_class_init), (egg_editable_toolbar_finalize), (egg_editable_toolbar_new), (egg_editable_toolbar_new_with_model), (egg_editable_toolbar_set_fixed): * lib/egg/egg-editable-toolbar.h: * lib/egg/egg-toolbars-model.c: (egg_toolbars_model_get_flags), (parse_toolbars): * src/bookmarks/ephy-bookmarksbar.c: (ephy_bookmarksbar_set_window), (ephy_bookmarksbar_class_init): * src/ephy-window.c: (ephy_window_fullscreen), (ephy_window_unfullscreen), (ephy_window_init): * src/toolbar.c: (toolbar_style_changed_cb), (parent_set_cb), (toolbar_init), (toolbar_finalize), (toolbar_new): Go back to construction the toolbar when the model is set, fixes bug #144191. 2004-06-15 Marco Pesenti Gritti <marco@gnome.org>
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-xsrc/toolbar.c55
1 files changed, 39 insertions, 16 deletions
diff --git a/src/toolbar.c b/src/toolbar.c
index d2a0d79e5..cf6596f32 100755
--- a/src/toolbar.c
+++ b/src/toolbar.c
@@ -399,9 +399,9 @@ toolbar_set_window (Toolbar *t, EphyWindow *window)
}
static void
-toolbar_style_sync (GtkToolbar *toolbar,
- GtkToolbarStyle style,
- GtkWidget *spinner)
+toolbar_style_changed_cb (GtkToolbar *toolbar,
+ GtkToolbarStyle style,
+ GtkWidget *spinner)
{
gboolean small;
@@ -411,29 +411,51 @@ toolbar_style_sync (GtkToolbar *toolbar,
}
static void
-create_spinner (Toolbar *t)
+parent_set_cb (GtkWidget *item,
+ GtkObject *old_parent,
+ GtkWidget *spinner)
{
- GtkWidget *spinner;
- GtkToolbar *toolbar;
+ if (old_parent != NULL)
+ {
+ g_return_if_fail (GTK_IS_TOOLBAR (old_parent));
- spinner = ephy_spinner_new ();
- gtk_widget_show (spinner);
- t->priv->spinner = spinner;
+ g_signal_handlers_disconnect_by_func
+ (old_parent, G_CALLBACK (toolbar_style_changed_cb),
+ spinner);
+ }
- toolbar = egg_editable_toolbar_set_fixed
- (EGG_EDITABLE_TOOLBAR (t), spinner);
+ if (item->parent)
+ {
+ g_return_if_fail (GTK_IS_TOOLBAR (item->parent));
- g_signal_connect (toolbar, "style_changed",
- G_CALLBACK (toolbar_style_sync),
- spinner);
+ g_signal_connect (item->parent, "style_changed",
+ G_CALLBACK (toolbar_style_changed_cb),
+ spinner);
+ }
}
static void
toolbar_init (Toolbar *t)
{
+ GtkWidget *spinner;
+ GtkToolItem *item;
+
t->priv = EPHY_TOOLBAR_GET_PRIVATE (t);
- create_spinner (t);
+ spinner = ephy_spinner_new ();
+ t->priv->spinner = spinner;
+ g_object_ref (spinner);
+ gtk_object_sink (GTK_OBJECT (spinner));
+ gtk_widget_show (spinner);
+
+ item = gtk_tool_item_new ();
+ gtk_container_add (GTK_CONTAINER (item), spinner);
+ gtk_widget_show (GTK_WIDGET (item));
+
+ g_signal_connect (item, "parent_set",
+ G_CALLBACK (parent_set_cb), spinner);
+
+ egg_editable_toolbar_set_fixed (EGG_EDITABLE_TOOLBAR (t), item);
}
static void
@@ -449,6 +471,8 @@ toolbar_finalize (GObject *object)
(egg_editable_toolbar_get_model (eggtoolbar),
G_CALLBACK (toolbar_added_cb), t);
+ g_object_unref (t->priv->spinner);
+
g_object_unref (t->priv->action_group);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -462,7 +486,6 @@ toolbar_new (EphyWindow *window)
return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
"window", window,
"MenuMerge", window->ui_merge,
- "ToolbarsModel", ephy_shell_get_toolbars_model (ephy_shell, FALSE),
NULL));
}