diff options
author | Marco Pesenti Gritti <marco@gnome.org> | 2004-06-10 05:06:45 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <marco@src.gnome.org> | 2004-06-10 05:06:45 +0800 |
commit | 3c3cd0eea121652c722a9678a46419b0c47b5111 (patch) | |
tree | bc8ac36506321a14cb65d8c79ec9181deb18d423 /lib/egg/egg-editable-toolbar.c | |
parent | 1f2d796e969302d64a1ec00b81b57ae594e12a9e (diff) | |
download | gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar.gz gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar.bz2 gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar.lz gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar.xz gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.tar.zst gsoc2013-epiphany-3c3cd0eea121652c722a9678a46419b0c47b5111.zip |
s/get_item_name/get_item_data
2004-06-09 Marco Pesenti Gritti <marco@gnome.org>
* lib/egg/egg-editable-toolbar.c: (drag_data_get_cb),
(set_item_drag_source):
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_to_xml),
(impl_get_item_id), (impl_get_item_data),
(egg_toolbars_model_class_init),
(egg_toolbars_model_get_item_data):
* lib/egg/egg-toolbars-model.h:
* src/ephy-toolbars-model.c: (impl_get_item_data),
(impl_get_item_id), (ephy_toolbars_model_class_init):
s/get_item_name/get_item_data
Do not assume data isnt changing, use the id
and convert later instead.
Diffstat (limited to 'lib/egg/egg-editable-toolbar.c')
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index ca8fa69da..572068877 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -234,14 +234,27 @@ drag_data_get_cb (GtkWidget *widget, EggEditableToolbar *etoolbar) { GtkAction *action; - const char *target; + const char *id, *type; + char *target; g_return_if_fail (EGG_IS_EDITABLE_TOOLBAR (etoolbar)); - target = g_object_get_data (G_OBJECT (widget), "name"); + type = g_object_get_data (G_OBJECT (widget), "type"); + id = g_object_get_data (G_OBJECT (widget), "id"); + if (strcmp (id, "separator") == 0) + { + target = g_strdup (id); + } + else + { + target = egg_toolbars_model_get_item_data (etoolbar->priv->model, + type, id); + } gtk_selection_data_set (selection_data, selection_data->target, 8, target, strlen (target)); + + g_free (target); } static void @@ -278,7 +291,8 @@ set_item_drag_source (EggToolbarsModel *model, const char *type) { GtkTargetEntry target_entry; - char *name; + char *data; + const char *id; target_entry.target = (char *)type; target_entry.flags = GTK_TARGET_SAME_APP; @@ -293,7 +307,7 @@ set_item_drag_source (EggToolbarsModel *model, GtkWidget *icon; GdkPixbuf *pixbuf; - name = g_strdup ("separator"); + id = "separator"; icon = _egg_editable_toolbar_new_separator_image (); pixbuf = gtk_image_get_pixbuf (GTK_IMAGE (icon)); @@ -301,13 +315,11 @@ set_item_drag_source (EggToolbarsModel *model, } else { - const char *action_name; const char *stock_id; GValue value = { 0, }; GdkPixbuf *pixbuf; - action_name = gtk_action_get_name (action); - name = egg_toolbars_model_get_item_name (model, type, action_name); + id = gtk_action_get_name (action); g_value_init (&value, G_TYPE_STRING); g_object_get_property (G_OBJECT (action), "stock_id", &value); @@ -330,8 +342,10 @@ set_item_drag_source (EggToolbarsModel *model, g_value_unset (&value); } - g_object_set_data_full (G_OBJECT (item), "name", - name, g_free); + g_object_set_data_full (G_OBJECT (item), "id", + g_strdup (id), g_free); + g_object_set_data_full (G_OBJECT (item), "type", + g_strdup (type), g_free); } static GtkWidget * |