diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-06-10 03:56:48 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-06-10 03:56:48 +0800 |
commit | 1f2d796e969302d64a1ec00b81b57ae594e12a9e (patch) | |
tree | 49ae8eb3e7609743c79c7cceb806cbc26355896e | |
parent | 029c9d46c634e62950ca2761deb0159f90a45cac (diff) | |
download | gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar.gz gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar.bz2 gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar.lz gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar.xz gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.tar.zst gsoc2013-epiphany-1f2d796e969302d64a1ec00b81b57ae594e12a9e.zip |
2004-06-09 Christian Persch <chpe@cvs.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):
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_to_xml),
(toolbars_item_new), (free_item_node),
(egg_toolbars_model_add_separator), (impl_add_item),
(parse_item_list), (egg_toolbars_model_load), (impl_get_item_name),
(egg_toolbars_model_class_init), (egg_toolbars_model_init),
(egg_toolbars_model_item_nth), (egg_toolbars_model_get_item_id),
(egg_toolbars_model_get_item_name):
* lib/egg/egg-toolbars-model.h:
* src/bookmarks/ephy-bookmarksbar-model.c:
(get_toolbar_and_item_pos), (item_added_cb), (impl_get_item_name),
(ephy_bookmarksbar_model_class_init):
* src/toolbar.c: (toolbar_get_type), (toolbar_added_cb),
(ephy_toolbar_realize), (ephy_toolbar_unrealize),
(toolbar_class_init):
-rwxr-xr-x | src/bookmarks/ephy-bookmarksbar-model.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/src/bookmarks/ephy-bookmarksbar-model.c b/src/bookmarks/ephy-bookmarksbar-model.c index 34b80e004..cc5bdf773 100755 --- a/src/bookmarks/ephy-bookmarksbar-model.c +++ b/src/bookmarks/ephy-bookmarksbar-model.c @@ -113,8 +113,8 @@ get_toolbar_and_item_pos (EphyBookmarksBarModel *model, const char *i_name; gboolean is_separator; - egg_toolbars_model_item_nth (eggmodel, t, - i, &is_separator, NULL, &i_name); + egg_toolbars_model_item_nth (EGG_TOOLBARS_MODEL (model), + t , i, &is_separator, &i_name, NULL); g_return_val_if_fail (i_name != NULL, FALSE); if (strcmp (i_name, name) == 0) @@ -300,14 +300,14 @@ item_added_cb (EphyBookmarksBarModel *model, int position) { EphyNode *node; - const char *name; + const char *i_name; gboolean is_separator; egg_toolbars_model_item_nth (EGG_TOOLBARS_MODEL (model), toolbar_position, - position, &is_separator, NULL, &name); - if (!is_separator && g_str_has_prefix (name, "GoBookmark-")) + position, &is_separator, &i_name, NULL); + if (!is_separator && g_str_has_prefix (i_name, "GoBookmark-")) { - node = ephy_bookmarksbar_model_get_node (model, name); + node = ephy_bookmarksbar_model_get_node (model, i_name); g_return_if_fail (node != NULL); ephy_node_signal_connect_object (node, @@ -319,26 +319,40 @@ item_added_cb (EphyBookmarksBarModel *model, save_changes (model); } -static gboolean -impl_add_item (EggToolbarsModel *eggmodel, - int toolbar_position, - int position, - const char *name, - const char *type) +static char * +impl_get_item_name (EggToolbarsModel *eggmodel, + const char *type, + const char *id) { EphyBookmarksBarModel *model = EPHY_BOOKMARKSBAR_MODEL (eggmodel); - gboolean is_bookmark; + EphyNode *node; + + if (strcmp (type, EPHY_DND_TOPIC_TYPE) == 0) + { + char *uri; - is_bookmark = strcmp (type, EPHY_DND_TOPIC_TYPE) == 0 || - strcmp (type, EPHY_DND_URL_TYPE) == 0; + node = ephy_bookmarksbar_model_get_node (model, id); + g_return_val_if_fail (node != NULL, NULL); - if (!is_bookmark || !get_toolbar_and_item_pos (model, name, NULL, NULL)) + uri = ephy_bookmarks_get_topic_uri + (model->priv->bookmarks, node); + + return uri; + } + else if (strcmp (type, EPHY_DND_URL_TYPE) == 0) { - return EGG_TOOLBARS_MODEL_CLASS (parent_class)->add_item - (eggmodel, toolbar_position, position, name, type); + const char *name; + + node = ephy_bookmarksbar_model_get_node (model, id); + g_return_val_if_fail (node != NULL, NULL); + + name = ephy_node_get_property_string + (node, EPHY_NODE_BMK_PROP_LOCATION); + + return g_strdup (name); } - return FALSE; + return EGG_TOOLBARS_MODEL_CLASS (parent_class)->get_item_name (eggmodel, type, id); } static char * @@ -558,7 +572,7 @@ ephy_bookmarksbar_model_class_init (EphyBookmarksBarModelClass *klass) object_class->set_property = ephy_bookmarksbar_model_set_property; object_class->get_property = ephy_bookmarksbar_model_get_property; - eggclass->add_item = impl_add_item; + eggclass->get_item_name = impl_get_item_name; eggclass->get_item_id = impl_get_item_id; eggclass->get_item_type = impl_get_item_type; |