[gnome-photos/wip/rishi/collection: 2/43] application: Consolidate the GAction accelerator changes



commit e52f865002c3332ea80693f5b2ddf2b665398e13
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 31 19:31:27 2018 +0100

    application: Consolidate the GAction accelerator changes
    
    It will be better to replace the custom key event handlers in
    MainWindow with GAction accelerators. That will require re-assigning
    accelerators on state changes, which is easier to do if things are more
    centralized. This is a step in that direction.

 src/photos-application.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 660fc10f..35bff30f 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -339,6 +339,17 @@ photos_application_actions_update (PhotosApplication *self)
   selection = photos_selection_controller_get_selection (self->sel_cntrlr);
   selection_mode = photos_utils_get_selection_mode ();
 
+  if (selection_mode)
+    {
+      const gchar *selection_mode_accels[] = { "Escape", NULL };
+      gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.selection-mode", 
selection_mode_accels);
+    }
+  else
+    {
+      const gchar *selection_mode_accels[] = { NULL };
+      gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.selection-mode", 
selection_mode_accels);
+    }
+
   if (mode == PHOTOS_WINDOW_MODE_COLLECTION_VIEW
       || mode == PHOTOS_WINDOW_MODE_COLLECTIONS
       || mode == PHOTOS_WINDOW_MODE_FAVORITES
@@ -1771,17 +1782,6 @@ photos_application_selection_changed (PhotosApplication *self)
 static void
 photos_application_selection_mode_notify_state (PhotosApplication *self)
 {
-  if (photos_utils_get_selection_mode ())
-    {
-      const gchar *selection_mode_accels[] = {"Escape", NULL};
-      gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.selection-mode", 
selection_mode_accels);
-    }
-  else
-    {
-      const gchar *selection_mode_accels[] = {NULL};
-      gtk_application_set_accels_for_action (GTK_APPLICATION (self), "app.selection-mode", 
selection_mode_accels);
-    }
-
   photos_application_actions_update (self);
 }
 


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