[shotwell/wip/dedeprecate] WIP



commit 483f82c21161de6686dc16f9f23073b7ed978005
Author: Jens Georg <mail jensge org>
Date:   Wed Nov 2 22:42:56 2016 +0100

    WIP

 src/MediaPage.vala |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/MediaPage.vala b/src/MediaPage.vala
index c075eca..97a9a97 100644
--- a/src/MediaPage.vala
+++ b/src/MediaPage.vala
@@ -461,15 +461,20 @@ public abstract class MediaPage : CheckerboardPage {
     public override Core.ViewTracker? get_view_tracker() {
         return tracker;
     }
+
+    private void set_action_active (string name, bool active) {
+        var action = get_action (name) as GLib.SimpleAction;
+        if (action != null) {
+            action.set_state (active);
+        }
+    }
     
     public void set_display_ratings(bool display) {
         get_view().freeze_notifications();
         get_view().set_property(Thumbnail.PROP_SHOW_RATINGS, display);
         get_view().thaw_notifications();
-        
-        Gtk.ToggleAction? action = get_action("ViewRatings") as Gtk.ToggleAction;
-        if (action != null)
-            action.set_active(display);
+
+        this.set_action_active ("ViewRatings", display);
     }
 
     private bool can_rate_selected(Rating rating) {
@@ -753,10 +758,8 @@ public abstract class MediaPage : CheckerboardPage {
         get_view().freeze_notifications();
         get_view().set_property(Thumbnail.PROP_SHOW_TAGS, display);
         get_view().thaw_notifications();
-        
-        Gtk.ToggleAction? action = get_action("ViewTags") as Gtk.ToggleAction;
-        if (action != null)
-            action.set_active(display);
+
+        this.set_action_active ("ViewTags", display);
     }
 
     private void on_new_event() {
@@ -928,12 +931,14 @@ public abstract class MediaPage : CheckerboardPage {
 
     protected abstract void set_config_photos_sort(bool sort_order, int sort_by);
 
-    public virtual void on_sort_changed() {
+    public virtual void on_sort_changed(GLib.SimpleAction action, Variant? value) {
         int sort_by = get_menu_sort_by();
         bool sort_order = get_menu_sort_order();
         
         set_view_comparator(sort_by, sort_order);
         set_config_photos_sort(sort_order, sort_by);
+
+        action.set_state (value);
     }
     
     public void on_raw_developer_shotwell() {
@@ -976,18 +981,14 @@ public abstract class MediaPage : CheckerboardPage {
 
     protected override void set_display_titles(bool display) {
         base.set_display_titles(display);
-    
-        Gtk.ToggleAction? action = get_action("ViewTitle") as Gtk.ToggleAction;
-        if (action != null)
-            action.set_active(display);
+
+        this.set_action_active ("ViewTitle", display);
     }
 
     protected override void set_display_comments(bool display) {
         base.set_display_comments(display);
     
-        Gtk.ToggleAction? action = get_action("ViewComment") as Gtk.ToggleAction;
-        if (action != null)
-            action.set_active(display);
+        this.set_action_active ("ViewComment", display);
     }
 
     private GLib.Action sort_by_title_action() {


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