[nautilus/wip/csoriano/destktop-split2: 29/47] window-slot: use inheritance for disabling actions



commit 4e0dbdf9a87c9340e6da998ac95f182a6cd3dcfd
Author: Carlos Soriano <csoriano gnome org>
Date:   Tue Mar 22 17:31:46 2016 +0100

    window-slot: use inheritance for disabling actions
    
    Now that we have the necessary subclasses for special slots and views
    like the desktop and the other locations one, we can rely on those for
    disabling the actions that are not available on those and check for
    those actions state instead of special casing subclasses.

 src/nautilus-desktop-window-slot.c |    4 ++++
 src/nautilus-window-slot.c         |    6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/nautilus-desktop-window-slot.c b/src/nautilus-desktop-window-slot.c
index 36e9c48..d1c05e7 100644
--- a/src/nautilus-desktop-window-slot.c
+++ b/src/nautilus-desktop-window-slot.c
@@ -57,7 +57,11 @@ nautilus_desktop_window_slot_init (NautilusDesktopWindowSlot *self)
 
   /* Disable search on desktop */
   action_group = gtk_widget_get_action_group (GTK_WIDGET (self), "slot");
+
   action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "search-visible");
+  g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 
+  /* Disable the ability to change between types of views */
+  action = g_action_map_lookup_action (G_ACTION_MAP (action_group), "files-view-mode");
   g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
 }
diff --git a/src/nautilus-window-slot.c b/src/nautilus-window-slot.c
index 57fc9d4..08d7f37 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -305,13 +305,9 @@ nautilus_window_slot_sync_actions (NautilusWindowSlot *self)
 
         /* Files view mode */
         action =  g_action_map_lookup_action (G_ACTION_MAP (priv->slot_action_group), "files-view-mode");
-        if (NAUTILUS_IS_FILES_VIEW (nautilus_window_slot_get_current_view (self)) &&
-            !NAUTILUS_IS_DESKTOP_CANVAS_VIEW (nautilus_window_slot_get_current_view (self))) {
+        if (g_action_get_enabled (action)) {
                 variant = g_variant_new_uint32 (nautilus_files_view_get_view_id (NAUTILUS_FILES_VIEW 
(nautilus_window_slot_get_current_view (self))));
-                g_simple_action_set_enabled (G_SIMPLE_ACTION (action), TRUE);
                 g_action_change_state (action, variant);
-        } else {
-                g_simple_action_set_enabled (G_SIMPLE_ACTION (action), FALSE);
         }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]