diff options
Diffstat (limited to 'src/MediaPage.vala')
-rw-r--r-- | src/MediaPage.vala | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/MediaPage.vala b/src/MediaPage.vala index ee5ef0e..a2d5185 100644 --- a/src/MediaPage.vala +++ b/src/MediaPage.vala @@ -318,17 +318,16 @@ 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 }, - { "RawDeveloper", on_action_radio, "s", "'Shotwell'", on_raw_developer_changed } }; - protected override void add_actions () { - base.add_actions (); + protected override void add_actions (GLib.ActionMap map) { + base.add_actions (map); bool sort_order; int sort_by; get_config_photos_sort(out sort_order, out sort_by); - AppWindow.get_instance ().add_action_entries (entries, this); + map.add_action_entries (entries, this); get_action ("ViewTitle").change_state (Config.Facade.get_instance ().get_display_photo_titles ()); get_action ("ViewComment").change_state (Config.Facade.get_instance ().get_display_photo_comments ()); get_action ("ViewRatings").change_state (Config.Facade.get_instance ().get_display_photo_ratings ()); @@ -337,9 +336,20 @@ public abstract class MediaPage : CheckerboardPage { get_action ("Sort").change_state (sort_order ? "ascending" : "descending"); var d = Config.Facade.get_instance().get_default_raw_developer(); - get_action ("RawDeveloper").change_state (d == RawDeveloper.SHOTWELL ? "Shotwell" : "Camera"); + var action = new GLib.SimpleAction.stateful("RawDeveloper", + GLib.VariantType.STRING, d == RawDeveloper.SHOTWELL ? "Shotwell" : "Camera"); + action.change_state.connect(on_raw_developer_changed); + action.set_enabled(true); + map.add_action(action); } - + + protected override void remove_actions(GLib.ActionMap map) { + base.remove_actions(map); + foreach (var entry in entries) { + map.remove_action(entry.name); + } + } + protected override void update_actions(int selected_count, int count) { set_action_sensitive("Export", selected_count > 0); set_action_sensitive("EditTitle", selected_count > 0); @@ -890,14 +900,6 @@ public abstract class MediaPage : CheckerboardPage { set_config_photos_sort(sort_order, sort_by); } - public void on_raw_developer_shotwell() { - developer_changed(RawDeveloper.SHOTWELL); - } - - 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; |