diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-07-27 21:10:56 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-07-27 21:10:56 +0800 |
commit | d1f38adb951f506e11864f0784f325a940a3d232 (patch) | |
tree | d58f9243e7c3926ac2840edb05797fbbe75e1de6 /src/toolbar.c | |
parent | e9f8e15bf4f624f566eb0ea66e47be67098d5dc2 (diff) | |
download | gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar.gz gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar.bz2 gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar.lz gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar.xz gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.tar.zst gsoc2013-epiphany-d1f38adb951f506e11864f0784f325a940a3d232.zip |
2003-07-27 Marco Pesenti Gritti <marco@it.gnome.org>
* data/ui/epiphany-toolbar.xml.in:
* lib/egg/egg-editable-toolbar.c: (drag_data_received_cb):
* lib/egg/egg-editable-toolbar.h:
* lib/egg/egg-toolbar-editor.c: (parse_item_list):
* lib/egg/egg-toolbars-model.c: (egg_toolbars_model_to_xml),
(safe_save_xml), (egg_toolbars_model_save), (toolbars_item_new),
(free_item_node), (egg_toolbars_model_add_separator),
(egg_toolbars_model_add_item), (parse_item_list),
(impl_get_item_id), (impl_get_item_name), (impl_get_item_type),
(egg_toolbars_model_class_init), (egg_toolbars_model_item_nth),
(egg_toolbars_model_toolbar_nth), (egg_toolbars_model_get_item_id),
(egg_toolbars_model_get_item_name),
(egg_toolbars_model_get_item_type):
* lib/egg/egg-toolbars-model.h:
* lib/egg/eggtoolbar.c: (egg_toolbar_finalize):
* lib/ephy-dnd.c: (add_one_topic), (ephy_dnd_drag_data_get):
* lib/ephy-dnd.h:
* lib/widgets/ephy-node-view.c: (drag_data_received_cb),
(ephy_node_view_select_node_by_key), (ephy_node_view_construct),
(ephy_node_view_add_data_column),
(ephy_node_view_enable_drag_source):
* lib/widgets/ephy-node-view.h:
* lib/widgets/ephy-tree-model-sort.c:
(ephy_tree_model_sort_class_init), (ephy_tree_model_sort_init),
(ephy_tree_model_sort_multi_row_draggable),
(ephy_tree_model_sort_set_column_id),
(each_property_get_data_binder),
(ephy_tree_model_sort_multi_drag_data_get):
* lib/widgets/ephy-tree-model-sort.h:
* src/bookmarks/ephy-bookmark-properties.c:
(toolbar_checkbox_changed_cb), (build_ui):
* src/bookmarks/ephy-bookmarks-editor.c:
(cmd_show_in_bookmarks_bar), (ephy_bookmarks_editor_update_menu),
(node_dropped_cb), (provide_keyword_uri),
(ephy_bookmarks_editor_construct):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init_defaults),
(ephy_bookmarks_remove_keyword), (ephy_bookmarks_get_topic_uri),
(ephy_bookmarks_find_keyword):
* src/bookmarks/ephy-bookmarks.h:
* src/ephy-history-window.c: (ephy_history_window_construct):
* src/ephy-toolbars-model.c: (ephy_toolbars_model_get_action_name),
(ephy_toolbars_model_get_node), (bookmark_destroy_cb),
(impl_get_item_name), (impl_get_item_id), (impl_get_item_type),
(connect_item), (ephy_toolbars_model_set_bookmarks),
(ephy_toolbars_model_class_init), (save_changes), (item_added),
(item_removed), (toolbar_added), (toolbar_removed),
(ephy_toolbars_model_init), (ephy_toolbars_model_finalize),
(ephy_toolbars_model_remove_bookmark),
Diffstat (limited to 'src/toolbar.c')
-rwxr-xr-x | src/toolbar.c | 100 |
1 files changed, 21 insertions, 79 deletions
diff --git a/src/toolbar.c b/src/toolbar.c index ae6a8f13f..b57284727 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -67,8 +67,7 @@ toolbar_get_property (GObject *object, static GtkTargetEntry drag_targets[] = { { EGG_TOOLBAR_ITEM_TYPE, 0, 0 }, { EPHY_DND_TOPIC_TYPE, 0, 1 }, - { EPHY_DND_BOOKMARK_TYPE, 0, 2 }, - { EPHY_DND_URL_TYPE, 0, 3 }, + { EPHY_DND_URL_TYPE, 0, 2 }, }; static int n_drag_targets = G_N_ELEMENTS (drag_targets); @@ -134,29 +133,6 @@ zoom_to_level_cb (EggAction *action, float zoom, EphyWindow *window) } static void -topic_destroy_cb (EphyNode *node, - Toolbar *t) -{ - EggAction *action; - char *name; - EphyToolbarsModel *model; - long id; - - model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); - - id = ephy_node_get_id (node); - name = ephy_toolbars_model_get_action_name (model, TRUE, id); - action = egg_action_group_get_action (t->priv->action_group, name); - if (action) - { - egg_action_group_remove_action (t->priv->action_group, action); - } - - g_free (name); -} - -static void bookmark_destroy_cb (EphyNode *node, Toolbar *t) { @@ -169,7 +145,7 @@ bookmark_destroy_cb (EphyNode *node, (ephy_shell_get_toolbars_model (ephy_shell)); id = ephy_node_get_id (node); - name = ephy_toolbars_model_get_action_name (model, FALSE, id); + name = ephy_toolbars_model_get_action_name (model, id); action = egg_action_group_get_action (t->priv->action_group, name); if (action) { @@ -184,78 +160,44 @@ toolbar_ensure_action (Toolbar *t, const char *name) { EggAction *action = NULL; + EphyToolbarsModel *model; EphyBookmarks *bookmarks; + EphyNode *bmks, *topics; - LOG ("Ensure action %s", name) - + model = EPHY_TOOLBARS_MODEL + (ephy_shell_get_toolbars_model (ephy_shell)); bookmarks = ephy_shell_get_bookmarks (ephy_shell); + bmks = ephy_bookmarks_get_bookmarks (bookmarks); + topics = ephy_bookmarks_get_keywords (bookmarks); - if (g_str_has_prefix (name, "GoBookmark-")) - { - EphyNode *node; - - LOG ("Create action %s", name) - - node = ephy_bookmarks_find_bookmark - (bookmarks, name + strlen ("GoBookmark-")); - g_return_if_fail (node != NULL); - - action = ephy_bookmark_action_new (name, ephy_node_get_id (node)); - g_signal_connect (action, "go_location", - G_CALLBACK (go_location_cb), t->priv->window); - egg_action_group_add_action (t->priv->action_group, action); - g_object_unref (action); + LOG ("Ensure action %s", name) - ephy_node_signal_connect_object (node, - EPHY_NODE_DESTROY, - (EphyNodeCallback) bookmark_destroy_cb, - G_OBJECT (t)); - } - else if (g_str_has_prefix (name, "GoTopic-")) + if (g_str_has_prefix (name, "GoBookmark-")) { EphyNode *node; - LOG ("Create action %s", name) - - node = ephy_bookmarks_find_keyword - (bookmarks, name + strlen ("GoTopic-"), FALSE); + node = ephy_toolbars_model_get_node (model,name); g_return_if_fail (node != NULL); - action = ephy_topic_action_new (name, ephy_node_get_id (node)); - g_signal_connect (action, "go_location", - G_CALLBACK (go_location_cb), - t->priv->window); - egg_action_group_add_action (t->priv->action_group, action); - g_object_unref (action); - - ephy_node_signal_connect_object (node, - EPHY_NODE_DESTROY, - (EphyNodeCallback) topic_destroy_cb, - G_OBJECT (t)); - } - else if (g_str_has_prefix (name, "GoSpecialTopic-")) - { - EphyNode *node; - long id; - - LOG ("Create action %s", name) - - if (!ephy_string_to_int (name + strlen ("GoSpecialTopic-"), &id)) + if (ephy_node_has_child (topics, node)) + { + action = ephy_topic_action_new (name, ephy_node_get_id (node)); + } + else if (ephy_node_has_child (bmks, node)) { - return; + action = ephy_bookmark_action_new (name, ephy_node_get_id (node)); } - action = ephy_topic_action_new (name, id); + g_return_if_fail (action != NULL); + g_signal_connect (action, "go_location", - G_CALLBACK (go_location_cb), - t->priv->window); + G_CALLBACK (go_location_cb), t->priv->window); egg_action_group_add_action (t->priv->action_group, action); g_object_unref (action); - node = ephy_bookmarks_get_from_id (bookmarks, id); ephy_node_signal_connect_object (node, EPHY_NODE_DESTROY, - (EphyNodeCallback) topic_destroy_cb, + (EphyNodeCallback) bookmark_destroy_cb, G_OBJECT (t)); } } |