aboutsummaryrefslogtreecommitdiffstats
path: root/lib/widgets/ephy-editable-toolbar.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-02-22 00:40:34 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-02-22 00:40:34 +0800
commit170c60d49682f73c4a47c16f04ef5f4c06e8c90c (patch)
tree0ce012f754be56d6c0c42152ad79bf3b483242b3 /lib/widgets/ephy-editable-toolbar.c
parent19499e453f3efa2208c9905058476d0b1fba68e3 (diff)
downloadgsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.gz
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.bz2
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.lz
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.xz
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.tar.zst
gsoc2013-epiphany-170c60d49682f73c4a47c16f04ef5f4c06e8c90c.zip
Fix crashes with multiple windows open
2003-02-21 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-action.c: (egg_action_remove_proxy): * lib/widgets/ephy-editable-toolbar.c: (get_item_widget), (connect_item_drag_source), (disconnect_item_drag_source), (setup_toolbar), (setup_item), (ensure_toolbar_min_size): * lib/widgets/ephy-toolbars-group.c: (toolbars_toolbar_new), (toolbars_item_new), (free_toolbar_node), (free_item_node), (ephy_toolbars_group_to_string), (ephy_toolbars_group_get_path): * lib/widgets/ephy-toolbars-group.h: Fix crashes with multiple windows open
Diffstat (limited to 'lib/widgets/ephy-editable-toolbar.c')
-rwxr-xr-xlib/widgets/ephy-editable-toolbar.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/lib/widgets/ephy-editable-toolbar.c b/lib/widgets/ephy-editable-toolbar.c
index bb3288805..fd6dd3d4c 100755
--- a/lib/widgets/ephy-editable-toolbar.c
+++ b/lib/widgets/ephy-editable-toolbar.c
@@ -288,6 +288,21 @@ drag_data_get_cb (GtkWidget *widget,
8, target, strlen (target));
}
+static GtkWidget *
+get_item_widget (EphyEditableToolbar *t, gpointer data)
+{
+ GtkWidget *widget;
+ char *path;
+
+ path = ephy_toolbars_group_get_path (t->priv->group, data);
+ g_return_val_if_fail (path != NULL, NULL);
+
+ widget = egg_menu_merge_get_widget (t->priv->merge, path);
+ g_free (path);
+
+ return widget;
+}
+
static void
connect_item_drag_source (EphyToolbarsItem *item, EphyEditableToolbar *etoolbar)
{
@@ -296,7 +311,7 @@ connect_item_drag_source (EphyToolbarsItem *item, EphyEditableToolbar *etoolbar)
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar));
g_return_if_fail (item != NULL);
- toolitem = item->widget;
+ toolitem = get_item_widget (etoolbar, item);
if (!g_object_get_data (G_OBJECT (toolitem), "drag_source_set"))
{
@@ -320,7 +335,7 @@ disconnect_item_drag_source (EphyToolbarsItem *item, EphyEditableToolbar *etoolb
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar));
g_return_if_fail (item != NULL);
- toolitem = item->widget;
+ toolitem = get_item_widget (etoolbar, item);
if (g_object_get_data (G_OBJECT (toolitem), "drag_source_set"))
{
@@ -340,22 +355,16 @@ static void
setup_toolbar (EphyToolbarsToolbar *toolbar, EphyEditableToolbar *etoolbar)
{
GtkWidget *widget;
- char *path;
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (etoolbar));
g_return_if_fail (toolbar != NULL);
- path = ephy_toolbars_group_get_path (etoolbar->priv->group, toolbar);
- g_return_if_fail (path != NULL);
-
- widget = egg_menu_merge_get_widget (etoolbar->priv->merge, path);
+ widget = get_item_widget (etoolbar, toolbar);
g_object_set_data (G_OBJECT (widget), "toolbar_data", toolbar);
- g_return_if_fail (toolbar != NULL);
- toolbar->widget = widget;
if (!g_object_get_data (G_OBJECT (widget), "drag_dest_set"))
{
- LOG ("Setup drag dest for toolbar %s", path)
+ LOG ("Setup drag dest for toolbar %s", toolbar->id)
g_object_set_data (G_OBJECT (widget), "drag_dest_set",
GINT_TO_POINTER (TRUE));
gtk_drag_dest_set (widget, GTK_DEST_DEFAULT_ALL,
@@ -367,8 +376,6 @@ setup_toolbar (EphyToolbarsToolbar *toolbar, EphyEditableToolbar *etoolbar)
}
etoolbar->priv->last_toolbar = widget;
-
- g_free (path);
}
static void
@@ -383,10 +390,7 @@ setup_item (EphyToolbarsItem *item, EphyEditableToolbar *etoolbar)
path = ephy_toolbars_group_get_path (etoolbar->priv->group, item);
g_return_if_fail (path != NULL);
- toolitem = egg_menu_merge_get_widget (etoolbar->priv->merge, path);
- g_return_if_fail (toolitem != NULL);
- item->widget = toolitem;
-
+ toolitem = get_item_widget (etoolbar, item);
g_object_set_data (G_OBJECT (toolitem), "item_data", item);
LOG ("Setup drag dest for toolbar item %s %p", path, toolitem);
@@ -414,7 +418,7 @@ ensure_toolbar_min_size (EphyToolbarsToolbar *toolbar, EphyEditableToolbar *t)
g_return_if_fail (IS_EPHY_EDITABLE_TOOLBAR (t));
g_return_if_fail (toolbar != NULL);
- widget = toolbar->widget;
+ widget = get_item_widget (t, toolbar);
if (EGG_TOOLBAR (widget)->num_children == 0)
{