diff options
author | Xan Lopez <xan@src.gnome.org> | 2003-03-30 23:32:55 +0800 |
---|---|---|
committer | Xan Lopez <xan@src.gnome.org> | 2003-03-30 23:32:55 +0800 |
commit | 33700d8d076cee88d0da1e12b4c27dfc0283139b (patch) | |
tree | 9fe4ec97785c08b642d039dffae8c08c2d8d71fd /src/bookmarks/ephy-bookmarks-editor.c | |
parent | e6f7200e86782d3fb216617d124024f42ba07721 (diff) | |
download | gsoc2013-epiphany-33700d8d076cee88d0da1e12b4c27dfc0283139b.tar.gz gsoc2013-epiphany-33700d8d076cee88d0da1e12b4c27dfc0283139b.tar.zst gsoc2013-epiphany-33700d8d076cee88d0da1e12b4c27dfc0283139b.zip |
More sensitive stuff.
More sensitive stuff.
Diffstat (limited to 'src/bookmarks/ephy-bookmarks-editor.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 78 |
1 files changed, 58 insertions, 20 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index b0bba72fb..20756fd97 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -508,10 +508,7 @@ ephy_bookmarks_editor_node_selected_cb (EphyNodeView *view, EphyNode *node, EphyBookmarksEditor *editor) { - if (node != NULL) - { - ephy_bookmarks_editor_update_menu (editor, node, view); - } + ephy_bookmarks_editor_update_menu (editor, node, view); } static void @@ -558,8 +555,8 @@ keyword_node_selected_cb (EphyNodeView *view, else { bookmarks_filter (editor, node); - ephy_bookmarks_editor_update_menu (editor, node, view); } + ephy_bookmarks_editor_update_menu (editor, node, view); } @@ -905,35 +902,76 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor, EphyNodeView *view) { int priority; - gresult delete, rename; + gboolean delete, rename, properties; EggAction *action; EggActionGroup *action_group; GList *selection; g_return_if_fail (editor != NULL); - g_return_if_fail (node != NULL); - - priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); - if (priority == EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY || - priority == EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY) + /* Unselection */ + if (node == NULL) { - delete = rename = G_FAILED; + selection = ephy_node_view_get_selection (editor->priv->bm_view); + if (!selection) + { + rename = delete = properties = FALSE; + } + else + { + delete = properties = TRUE; + if (g_list_length (selection) > 1) + { + rename = FALSE; + } + else + { + rename = TRUE; + } + } + g_list_free (selection); } + /* Selection */ else { - delete = G_OK; - selection = ephy_node_view_get_selection (editor->priv->bm_view); - if (g_list_length (selection) > 1) - rename = G_FAILED; + priority = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); + + if (priority == EPHY_BOOKMARKS_KEYWORD_ALL_PRIORITY || + priority == EPHY_BOOKMARKS_KEYWORD_SPECIAL_PRIORITY) + { + delete = rename = properties = FALSE; + } else - rename = G_OK; - g_list_free (selection); + { + if (view == editor->priv->key_view) + { + properties = FALSE; + } + else + { + properties = TRUE; + } + + delete = TRUE; + selection = ephy_node_view_get_selection (editor->priv->bm_view); + if (g_list_length (selection) > 1) + { + rename = FALSE; + } + else + { + rename = TRUE; + } + g_list_free (selection); + } + } action_group = editor->priv->action_group; action = egg_action_group_get_action (action_group, "Rename"); - g_object_set (action, "sensitive", !rename, NULL); + g_object_set (action, "sensitive", rename, NULL); action = egg_action_group_get_action (action_group, "Delete"); - g_object_set (action, "sensitive", !delete, NULL); + g_object_set (action, "sensitive", delete, NULL); + action = egg_action_group_get_action (action_group, "Properties"); + g_object_set (action, "sensitive", properties, NULL); } |