diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-04-21 04:57:13 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-04-21 04:57:13 +0800 |
commit | 55b65a38b1129a1e0874b22a565719750ce0ef14 (patch) | |
tree | 6404a092eabd214b5b9fc2f9ba8ce94a14dc0c49 /src/bookmarks/ephy-bookmarks-editor.c | |
parent | 9f83e4c982e031826e3b0f020c3eafd8619fe1aa (diff) | |
download | gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar.gz gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar.bz2 gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar.lz gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar.xz gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.tar.zst gsoc2013-epiphany-55b65a38b1129a1e0874b22a565719750ce0ef14.zip |
Allow to add topics, update when changing bookmarks.
2003-04-20 Marco Pesenti Gritti <marco@it.gnome.org>
* data/ui/epiphany-bookmark-editor-ui.xml.in:
* src/bookmarks/ephy-bookmarks-editor.c: (cmd_show_in_the_toolbar),
(cmd_copy), (ephy_bookmarks_editor_update_menu):
* src/bookmarks/ephy-bookmarks-toolbar.c: (bookmarks_changed_cb),
(ephy_bookmarks_toolbar_init), (ephy_bookmarks_toolbar_clean),
(go_location_cb), (add_toolitem), (ephy_bookmarks_toolbar_rebuild),
(ephy_bookmarks_toolbar_update):
Allow to add topics, update when changing bookmarks.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 7ef98400e..51e2fef7f 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -41,6 +41,7 @@ #include "ephy-file-helpers.h" #include "egg-action-group.h" #include "egg-menu-merge.h" +#include "egg-toggle-action.h" #include "popup-commands.h" #include "ephy-state.h" #include "window-commands.h" @@ -87,6 +88,8 @@ static void cmd_open_bookmarks_in_tabs (EggAction *action, EphyBookmarksEditor *editor); static void cmd_open_bookmarks_in_browser (EggAction *action, EphyBookmarksEditor *editor); +static void cmd_show_in_the_toolbar (EggAction *action, + EphyBookmarksEditor *editor); static void cmd_delete (EggAction *action, EphyBookmarksEditor *editor); static void cmd_bookmark_properties (EggAction *action, @@ -146,6 +149,9 @@ static EggActionGroupEntry ephy_bookmark_popup_entries [] = { { "OpenInTab", N_("Open in New _Tab"), NULL, "<shift><control>O", NULL, G_CALLBACK (cmd_open_bookmarks_in_tabs), NULL }, + { "ShowInToolbar", N_("Show in the Toolbar"), NULL, NULL, + NULL, G_CALLBACK (cmd_show_in_the_toolbar), NULL, TOGGLE_ACTION }, + { "Cut", N_("Cu_t"), GTK_STOCK_CUT, "<control>X", NULL, G_CALLBACK (cmd_cut), NULL }, @@ -226,6 +232,44 @@ get_target_window (EphyBookmarksEditor *editor) } static void +cmd_show_in_the_toolbar (EggAction *action, + EphyBookmarksEditor *editor) +{ + EphyNode *node; + GList *selection; + GValue value = { 0, }; + gboolean state; + + if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view))) + { + selection = ephy_node_view_get_selection + (EPHY_NODE_VIEW (editor->priv->bm_view)); + } + else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->key_view))) + { + selection = ephy_node_view_get_selection + (EPHY_NODE_VIEW (editor->priv->key_view)); + } + else + { + return; + } + + node = EPHY_NODE (selection->data); + + state = EGG_TOGGLE_ACTION (action)->active; + + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, state); + ephy_node_set_property (node, + EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR, + &value); + g_value_unset (&value); + + g_list_free (selection); +} + +static void cmd_open_bookmarks_in_tabs (EggAction *action, EphyBookmarksEditor *editor) { @@ -337,14 +381,14 @@ cmd_copy (EggAction *action, else if (ephy_node_view_is_target (EPHY_NODE_VIEW (editor->priv->bm_view))) { GList *selection; - + selection = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view)); if (g_list_length (selection) == 1) { const char *tmp; EphyNode *node = EPHY_NODE (selection->data); - tmp = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); + tmp = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_LOCATION); gtk_clipboard_set_text (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD), tmp, -1); } @@ -510,6 +554,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) gboolean key_normal = FALSE; gboolean bmk_multiple_selection; gboolean cut, copy, paste, select_all; + gboolean can_show_in_toolbar, show_in_toolbar = FALSE; EggActionGroup *action_group; EggAction *action; GList *selected; @@ -533,7 +578,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) has_selection = gtk_editable_get_selection_bounds (GTK_EDITABLE (focus_widget), NULL, NULL); - clipboard_contains_text = gtk_clipboard_wait_is_text_available + clipboard_contains_text = gtk_clipboard_wait_is_text_available (gtk_clipboard_get (GDK_SELECTION_CLIPBOARD)); cut = has_selection; @@ -553,12 +598,27 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) if (key_focus && selected) { EphyNode *node = EPHY_NODE (selected->data); - EphyNodeViewPriority priority;; + EphyNodeViewPriority priority; priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); if (priority == -1) priority = EPHY_NODE_VIEW_NORMAL_PRIORITY; key_normal = (priority == EPHY_NODE_VIEW_NORMAL_PRIORITY); + + show_in_toolbar = ephy_node_get_property_boolean + (node, EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR); + + g_list_free (selected); + } + + selected = ephy_node_view_get_selection (EPHY_NODE_VIEW (editor->priv->bm_view)); + if (bmk_focus && selected) + { + EphyNode *node = EPHY_NODE (selected->data); + + show_in_toolbar = ephy_node_get_property_boolean + (node, EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR); + g_list_free (selected); } @@ -589,6 +649,8 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) delete = (bmk_focus && bmk_selection) || (key_selection && key_focus && key_normal); properties = (bmk_focus && bmk_selection && !bmk_multiple_selection); + can_show_in_toolbar = (bmk_focus && bmk_selection && !bmk_multiple_selection) || + (key_selection && key_focus); action_group = editor->priv->action_group; action = egg_action_group_get_action (action_group, "OpenInWindow"); @@ -612,6 +674,9 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor) g_object_set (action, "sensitive", paste, NULL); action = egg_action_group_get_action (action_group, "SelectAll"); g_object_set (action, "sensitive", select_all, NULL); + action = egg_action_group_get_action (action_group, "ShowInToolbar"); + g_object_set (action, "sensitive", can_show_in_toolbar, NULL); + egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action), show_in_toolbar); } static void |