[nautilus] window-slot: use inheritance for disabling actions
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] window-slot: use inheritance for disabling actions
- Date: Thu, 14 Apr 2016 08:47:37 +0000 (UTC)
commit 8468afecda5eba7e1186611ebd056d56fd40d23a
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.
https://bugzilla.gnome.org/show_bug.cgi?id=712620
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 22e5195..8a1e5b3 100644
--- a/src/nautilus-window-slot.c
+++ b/src/nautilus-window-slot.c
@@ -304,13 +304,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]