[shotwell/wip/dedeprecate] wip



commit 337165adbc7c01d4876c2f236b5f811f7ba9c7d0
Author: Jens Georg <mail jensge org>
Date:   Fri Nov 11 01:31:02 2016 +0100

    wip
    
    Signed-off-by: Jens Georg <mail jensge org>

 src/MediaPage.vala  |   27 +++++++++++++++++++++++----
 src/PhotoPage.vala  |   48 +++++++++++++++++++++---------------------------
 ui/collection.ui    |    6 ++++--
 ui/event.ui         |   12 ++++++++----
 ui/media.ui         |    6 ++++--
 ui/photo.ui         |    6 ++++--
 ui/photo_context.ui |    6 ++++--
 ui/tags.ui          |    6 ++++--
 8 files changed, 72 insertions(+), 45 deletions(-)
---
diff --git a/src/MediaPage.vala b/src/MediaPage.vala
index 8d8fe76..c78a290 100644
--- a/src/MediaPage.vala
+++ b/src/MediaPage.vala
@@ -308,8 +308,6 @@ public abstract class MediaPage : CheckerboardPage {
         { "EditTitle", on_edit_title },
         { "EditComment", on_edit_comment },
         { "PlayVideo", on_play_video },
-        { "RawDeveloperShotwell", on_raw_developer_shotwell },
-        { "RawDeveloperCamera", on_raw_developer_camera },
 
         // Toggle actions
         { "ViewTitle", on_action_toggle, null, "false", on_display_titles },
@@ -319,7 +317,8 @@ public abstract class MediaPage : CheckerboardPage {
 
         // Radio actions
         { "SortBy", on_action_radio, "s", "'1'", on_sort_changed },
-        { "Sort", on_action_radio, "s", "'ascending'", on_sort_changed }
+        { "Sort", on_action_radio, "s", "'ascending'", on_sort_changed },
+        { "RawDeveloper", on_action_radio, "s", "'Shotwell'", on_raw_developer_changed }
     };
 
     protected override void add_actions () {
@@ -932,7 +931,27 @@ public abstract class MediaPage : CheckerboardPage {
     public void on_raw_developer_camera() {
         developer_changed(RawDeveloper.CAMERA);
     }
-    
+
+    private void on_raw_developer_changed(GLib.SimpleAction action,
+                                          Variant? value) {
+        RawDeveloper developer = RawDeveloper.SHOTWELL;
+
+        switch (value.get_string ()) {
+            case "Shotwell":
+                developer = RawDeveloper.SHOTWELL;
+                break;
+            case "Camera":
+                developer = RawDeveloper.CAMERA;
+                break;
+            default:
+                break;
+        }
+
+        developer_changed(developer);
+
+        action.set_state (value);
+    }
+
     protected virtual void developer_changed(RawDeveloper rd) {
         if (get_view().get_selected_count() == 0)
             return;
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index a399eab..984e69b 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -2426,9 +2426,10 @@ public class LibraryPhotoPage : EditingHostPage {
         { "Slideshow", on_slideshow },
 
         // Toggle actions
-        { "ViewRatings", on_action_toggle, null, "false", on_display_ratings }
+        { "ViewRatings", on_action_toggle, null, "false", on_display_ratings },
 
         // Radio actions
+        { "RawDeveloper", on_action_radio, "s", "'Shotwell'", on_raw_developer_changed }
     };
 
     protected override void add_actions () {
@@ -2459,29 +2460,6 @@ public class LibraryPhotoPage : EditingHostPage {
         return groups;
     }
     
-    protected override void register_radio_actions(Gtk.ActionGroup action_group) {
-        // RAW developer.
-        //get_config_photos_sort(out sort_order, out sort_by); // TODO: fetch default from config
-        
-        Gtk.RadioActionEntry[] developer_actions = new Gtk.RadioActionEntry[0];
-        
-        Gtk.RadioActionEntry dev_shotwell = { "RawDeveloperShotwell", null, TRANSLATABLE, null, TRANSLATABLE,
-            RawDeveloper.SHOTWELL };
-        string label_shotwell = RawDeveloper.SHOTWELL.get_label();
-        dev_shotwell.label = label_shotwell;
-        developer_actions += dev_shotwell;
-        
-        Gtk.RadioActionEntry dev_camera = { "RawDeveloperCamera", null, TRANSLATABLE, null, TRANSLATABLE,
-            RawDeveloper.CAMERA };
-        string label_camera = RawDeveloper.CAMERA.get_label();
-        dev_camera.label = label_camera;
-        developer_actions += dev_camera;
-        
-        action_group.add_radio_actions(developer_actions, RawDeveloper.SHOTWELL, on_raw_developer_changed);
-        
-        base.register_radio_actions(action_group);
-    }
-    
     private void on_display_ratings(GLib.SimpleAction action, Variant? value) {
         bool display = value.get_boolean ();
         
@@ -2546,8 +2524,24 @@ public class LibraryPhotoPage : EditingHostPage {
         update_flag_action();
     }
     
-    private void on_raw_developer_changed(Gtk.Action action, Gtk.Action current) {
-        developer_changed((RawDeveloper) ((Gtk.RadioAction) current).get_current_value());
+    private void on_raw_developer_changed(GLib.SimpleAction action,
+                                          Variant? value) {
+        RawDeveloper developer = RawDeveloper.SHOTWELL;
+
+        switch (value.get_string ()) {
+            case "Shotwell":
+                developer = RawDeveloper.SHOTWELL;
+                break;
+            case "Camera":
+                developer = RawDeveloper.CAMERA;
+                break;
+            default:
+                break;
+        }
+
+        developer_changed(developer);
+
+        action.set_state (value);
     }
     
     protected virtual void developer_changed(RawDeveloper rd) {
@@ -3092,7 +3086,7 @@ public class LibraryPhotoPage : EditingHostPage {
         
         if (format == PhotoFileFormat.RAW) {
             // Set which developers are available.
-            set_action_sensitive("RawDeveloperShotwell", 
+            set_action_sensitive("RawDeveloper",
                 get_photo().is_raw_developer_available(RawDeveloper.SHOTWELL));
             set_action_sensitive("RawDeveloperCamera", 
                 get_photo().is_raw_developer_available(RawDeveloper.EMBEDDED) || 
diff --git a/ui/collection.ui b/ui/collection.ui
index b96ffe5..ec3cbbb 100644
--- a/ui/collection.ui
+++ b/ui/collection.ui
@@ -83,11 +83,13 @@
       <section>
         <item>
           <attribute name="label" translatable="yes">Shotwell</attribute>
-          <attribute name="action">win.RawDeveloperShotwell</attribute>
+          <attribute name="action">win.RawDeveloper</attribute>
+          <attribute name="target">Shotwell</attribute>
         </item>
         <item>
           <attribute name="label" translatable="yes">Camera</attribute>
-          <attribute name="action">win.RawDeveloperCamera</attribute>
+          <attribute name="action">win.RawDeveloper</attribute>
+          <attribute name="target">Camera</attribute>
         </item>
       </section>
     </submenu>
diff --git a/ui/event.ui b/ui/event.ui
index f65a96f..b8d617c 100644
--- a/ui/event.ui
+++ b/ui/event.ui
@@ -352,11 +352,13 @@
           <section>
             <item>
               <attribute name="label" translatable="yes">Shotwell</attribute>
-              <attribute name="action">win.RawDeveloperShotwell</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Shotwell</attribute>
             </item>
             <item>
               <attribute name="label" translatable="yes">Camera</attribute>
-              <attribute name="action">win.RawDeveloperCamera</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Camera</attribute>
             </item>
           </section>
         </submenu>
@@ -518,11 +520,13 @@
       <section>
         <item>
           <attribute name="label" translatable="yes">Shotwell</attribute>
-          <attribute name="action">win.RawDeveloperShotwell</attribute>
+          <attribute name="action">win.RawDeveloper</attribute>
+          <attribute name="target">Shotwell</attribute>
         </item>
         <item>
           <attribute name="label" translatable="yes">Camera</attribute>
-          <attribute name="action">win.RawDeveloperCamera</attribute>
+          <attribute name="action">win.RawDeveloper</attribute>
+          <attribute name="target">Camera</attribute>
         </item>
       </section>
     </submenu>
diff --git a/ui/media.ui b/ui/media.ui
index bece40b..67a87f5 100644
--- a/ui/media.ui
+++ b/ui/media.ui
@@ -352,11 +352,13 @@
           <section>
             <item>
               <attribute name="label" translatable="yes">Shotwell</attribute>
-              <attribute name="action">win.RawDeveloperShotwell</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Shotwell</attribute>
             </item>
             <item>
               <attribute name="label" translatable="yes">Camera</attribute>
-              <attribute name="action">win.RawDeveloperCamera</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Camera</attribute>
             </item>
           </section>
         </submenu>
diff --git a/ui/photo.ui b/ui/photo.ui
index d7017d7..9479444 100644
--- a/ui/photo.ui
+++ b/ui/photo.ui
@@ -342,11 +342,13 @@
           <section>
             <item>
               <attribute name="label" translatable="yes">Shotwell</attribute>
-              <attribute name="action">win.RawDeveloperShotwell</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Shotwell</attribute>
             </item>
             <item>
               <attribute name="label" translatable="yes">Camera</attribute>
-              <attribute name="action">win.RawDeveloperCamera</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Camera</attribute>
             </item>
           </section>
         </submenu>
diff --git a/ui/photo_context.ui b/ui/photo_context.ui
index 39fd927..3b4e842 100644
--- a/ui/photo_context.ui
+++ b/ui/photo_context.ui
@@ -89,11 +89,13 @@
         <section>
           <item>
             <attribute name="label" translatable="yes">Shotwell</attribute>
-            <attribute name="action">win.RawDeveloperShotwell</attribute>
+            <attribute name="action">win.RawDeveloper</attribute>
+            <attribute name="target">Shotwell</attribute>
           </item>
           <item>
             <attribute name="label" translatable="yes">Camera</attribute>
-            <attribute name="action">win.RawDeveloperCamera</attribute>
+            <attribute name="action">win.RawDeveloper</attribute>
+            <attribute name="target">Camera</attribute>
           </item>
         </section>
       </submenu>
diff --git a/ui/tags.ui b/ui/tags.ui
index 06f9f4b..dca045c 100644
--- a/ui/tags.ui
+++ b/ui/tags.ui
@@ -352,11 +352,13 @@
           <section>
             <item>
               <attribute name="label" translatable="yes">Shotwell</attribute>
-              <attribute name="action">win.RawDeveloperShotwell</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="target">Shotwell</attribute>
             </item>
             <item>
               <attribute name="label" translatable="yes">Camera</attribute>
-              <attribute name="action">win.RawDeveloperCamera</attribute>
+              <attribute name="action">win.RawDeveloper</attribute>
+              <attribute name="action">Camera</attribute>
             </item>
           </section>
         </submenu>


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