aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog17
-rwxr-xr-xlib/egg/egg-editable-toolbar.c32
-rwxr-xr-xlib/egg/egg-toolbars-model.c20
-rwxr-xr-xlib/egg/egg-toolbars-model.h6
-rwxr-xr-xsrc/ephy-toolbars-model.c8
5 files changed, 57 insertions, 26 deletions
diff --git a/ChangeLog b/ChangeLog
index 0ff976525..7323229b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,23 @@
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.
+
+2004-06-09 Marco Pesenti Gritti <marco@gnome.org>
+
+ * lib/egg/egg-editable-toolbar.c: (drag_data_get_cb),
(set_item_drag_source), (create_item_from_action), (create_item),
(drag_data_received_cb), (egg_editable_toolbar_set_edit_mode):
* lib/egg/egg-toolbar-editor.c: (model_has_action):
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 *
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index 7535c7d66..3949e54d9 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -123,13 +123,13 @@ egg_toolbars_model_to_xml (EggToolbarsModel *t)
}
else
{
- char *name;
+ char *data;
node = xmlNewChild (tnode, NULL, "toolitem", NULL);
- name = egg_toolbars_model_get_item_name (t, item->type, item->id);
+ data = egg_toolbars_model_get_item_data (t, item->type, item->id);
xmlSetProp (node, "type", item->type);
- xmlSetProp (node, "name", name);
- g_free (name);
+ xmlSetProp (node, "name", data);
+ g_free (data);
}
}
}
@@ -461,18 +461,18 @@ egg_toolbars_model_load (EggToolbarsModel *t,
static char *
impl_get_item_id (EggToolbarsModel *t,
const char *type,
- const char *name)
+ const char *data)
{
if (strcmp (type, EGG_TOOLBAR_ITEM_TYPE) == 0)
{
- return g_strdup (name);
+ return g_strdup (data);
}
return NULL;
}
static char *
-impl_get_item_name (EggToolbarsModel *t,
+impl_get_item_data (EggToolbarsModel *t,
const char *type,
const char *id)
{
@@ -507,7 +507,7 @@ egg_toolbars_model_class_init (EggToolbarsModelClass *klass)
klass->add_item = impl_add_item;
klass->get_item_id = impl_get_item_id;
- klass->get_item_name = impl_get_item_name;
+ klass->get_item_data = impl_get_item_data;
klass->get_item_type = impl_get_item_type;
egg_toolbars_model_signals[ITEM_ADDED] =
@@ -707,12 +707,12 @@ egg_toolbars_model_get_item_id (EggToolbarsModel *t,
}
char *
-egg_toolbars_model_get_item_name (EggToolbarsModel *t,
+egg_toolbars_model_get_item_data (EggToolbarsModel *t,
const char *type,
const char *id)
{
EggToolbarsModelClass *klass = EGG_TOOLBARS_MODEL_GET_CLASS (t);
- return klass->get_item_name (t, type, id);
+ return klass->get_item_data (t, type, id);
}
char *
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index c5fbfafc3..f9ca2105c 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -84,8 +84,8 @@ struct EggToolbarsModelClass
GdkAtom dnd_type);
char * (* get_item_id) (EggToolbarsModel *t,
const char *type,
- const char *name);
- char * (* get_item_name) (EggToolbarsModel *t,
+ const char *data);
+ char * (* get_item_data) (EggToolbarsModel *t,
const char *type,
const char *id);
};
@@ -113,7 +113,7 @@ char *egg_toolbars_model_get_item_type (EggToolbarsModel *t,
char *egg_toolbars_model_get_item_id (EggToolbarsModel *t,
const char *type,
const char *name);
-char *egg_toolbars_model_get_item_name (EggToolbarsModel *t,
+char *egg_toolbars_model_get_item_data (EggToolbarsModel *t,
const char *type,
const char *id);
gboolean egg_toolbars_model_add_item (EggToolbarsModel *t,
diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c
index 92bc0e1ab..0df59cb0a 100755
--- a/src/ephy-toolbars-model.c
+++ b/src/ephy-toolbars-model.c
@@ -131,7 +131,7 @@ bookmark_destroy_cb (EphyNode *node,
}
static char *
-impl_get_item_name (EggToolbarsModel *t,
+impl_get_item_data (EggToolbarsModel *t,
const char *type,
const char *id)
{
@@ -163,7 +163,7 @@ impl_get_item_name (EggToolbarsModel *t,
return g_strdup (name);
}
- return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_name (t, type, id);
+ return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_data (t, type, id);
}
static char *
@@ -227,7 +227,7 @@ impl_get_item_id (EggToolbarsModel *t,
(model, ephy_node_get_id (node));
}
- return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_id (t, type, name);
+ return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_data (t, type, name);
}
static char *
@@ -439,7 +439,7 @@ ephy_toolbars_model_class_init (EphyToolbarsModelClass *klass)
object_class->get_property = ephy_toolbars_model_get_property;
etm_class->get_item_id = impl_get_item_id;
- etm_class->get_item_name = impl_get_item_name;
+ etm_class->get_item_data = impl_get_item_data;
etm_class->get_item_type = impl_get_item_type;
g_object_class_install_property (object_class,