[nautilus/wip/corey/sidebar-menus: 2/3] sidebar: Only show Add/Remove Bookmark when applicable
- From: Corey Berla <coreyberla src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/corey/sidebar-menus: 2/3] sidebar: Only show Add/Remove Bookmark when applicable
- Date: Tue, 30 Aug 2022 21:21:05 +0000 (UTC)
commit 01bed3dfc95c17eb1bd469ac76c77f2d8574a897
Author: Corey Berla <corey berla me>
Date: Tue Aug 30 14:08:10 2022 -0700
sidebar: Only show Add/Remove Bookmark when applicable
In the sidebar, bookmarking only makes sense for mounted volumes.
Hide add/remove bookmark if the action is disabled, because the
action would never make sense for locations where it's disabled.
src/gtk/nautilusgtkplacessidebar.c | 4 ++++
1 file changed, 4 insertions(+)
---
diff --git a/src/gtk/nautilusgtkplacessidebar.c b/src/gtk/nautilusgtkplacessidebar.c
index e896ac7b8..ff696528f 100644
--- a/src/gtk/nautilusgtkplacessidebar.c
+++ b/src/gtk/nautilusgtkplacessidebar.c
@@ -3293,6 +3293,8 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "rename");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == NAUTILUS_GTK_PLACES_BOOKMARK ||
type == NAUTILUS_GTK_PLACES_XDG_DIR));
+ action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "bookmark");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), (type == NAUTILUS_GTK_PLACES_MOUNTED_VOLUME));
action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "open");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), !gtk_list_box_row_is_selected (GTK_LIST_BOX_ROW
(row)));
action = g_action_map_lookup_action (G_ACTION_MAP (sidebar->row_actions), "empty-trash");
@@ -3330,10 +3332,12 @@ create_row_popover (NautilusGtkPlacesSidebar *sidebar,
section = g_menu_new ();
item = g_menu_item_new (_("_Add Bookmark"), "row.bookmark");
+ g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
g_menu_append_item (section, item);
g_object_unref (item);
item = g_menu_item_new (_("_Remove from Bookmarks"), "row.remove");
+ g_menu_item_set_attribute (item, "hidden-when", "s", "action-disabled");
g_menu_append_item (section, item);
g_object_unref (item);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]