diff --git a/data/gschema.xml b/data/gschema.xml new file mode 100644 index 00000000..7f4ce4e0 --- /dev/null +++ b/data/gschema.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + "all" + + + diff --git a/data/meson.build b/data/meson.build index e596191d..f3653654 100644 --- a/data/meson.build +++ b/data/meson.build @@ -37,3 +37,9 @@ icon_res = gnome.compile_resources( 'screenshot-icon-resources', 'gresource.xml' ) + +install_data( + 'gschema.xml', + install_dir: get_option('datadir') / 'glib-2.0' / 'schemas', + rename: meson.project_name() + '.gschema.xml' +) diff --git a/data/portals.metainfo.xml.in b/data/portals.metainfo.xml.in index 7b900d2f..d1846cd0 100644 --- a/data/portals.metainfo.xml.in +++ b/data/portals.metainfo.xml.in @@ -26,6 +26,18 @@ contact_at_elementary.io + + +

New Features:

+
    +
  • Updated translations
  • +
+
+ + Remember Screenshot Type Choice + +
+

Fixes a regression in 8.0.3 that happens with unreleased version of Granite

diff --git a/meson.build b/meson.build index 6e8cb672..1fe653ab 100644 --- a/meson.build +++ b/meson.build @@ -48,3 +48,7 @@ conf_data.set_quoted('VERSION', meson.project_version()) subdir('data') subdir('po') subdir('src') + +gnome.post_install ( + glib_compile_schemas: true +) diff --git a/src/Screenshot/SetupDialog.vala b/src/Screenshot/SetupDialog.vala index 35f35ccc..18a83068 100644 --- a/src/Screenshot/SetupDialog.vala +++ b/src/Screenshot/SetupDialog.vala @@ -14,7 +14,7 @@ public class Screenshot.SetupDialog : Gtk.Window { public string parent_window { get; construct; } - public ScreenshotType screenshot_type { get; private set; default = ScreenshotType.ALL; } + public ScreenshotType screenshot_type { get; set; default = ALL; } public bool grab_pointer { get; private set; default = false; } public bool redact_text { get; private set; default = false; } public int delay { get; private set; default = 0; } @@ -40,6 +40,16 @@ public class Screenshot.SetupDialog : Gtk.Window { }); } + var settings = new Settings ("io.elementary.portals.screenshot"); + settings.bind ("last-capture-mode", this, "screenshot-type", GET); + + var type_action = settings.create_action ("last-capture-mode"); + + var action_group = new SimpleActionGroup (); + action_group.add_action (type_action); + + insert_action_group ("screenshot", action_group); + all_image = new Gtk.Image.from_icon_name ("grab-screen-symbolic") { icon_size = LARGE }; @@ -52,17 +62,12 @@ public class Screenshot.SetupDialog : Gtk.Window { all_box.append (all_label); var all = new Gtk.CheckButton () { - active = true, + action_name = "screenshot.last-capture-mode", + action_target = new Variant.string ("all"), child = all_box }; all.add_css_class ("image-button"); - all.toggled.connect (() => { - if (all.active) { - screenshot_type = ScreenshotType.ALL; - } - }); - var curr_image = new Gtk.Image.from_icon_name ("grab-window-symbolic") { icon_size = LARGE }; @@ -75,17 +80,13 @@ public class Screenshot.SetupDialog : Gtk.Window { curr_box.append (curr_label); var curr_window = new Gtk.CheckButton () { + action_name = "screenshot.last-capture-mode", + action_target = new Variant.string ("window"), child = curr_box, group = all }; curr_window.add_css_class ("image-button"); - curr_window.toggled.connect (() => { - if (curr_window.active) { - screenshot_type = ScreenshotType.WINDOW; - } - }); - var selection_image = new Gtk.Image.from_icon_name ("grab-area-symbolic") { icon_size = LARGE }; @@ -98,17 +99,13 @@ public class Screenshot.SetupDialog : Gtk.Window { selection_box.append (selection_label); var selection = new Gtk.CheckButton () { + action_name = "screenshot.last-capture-mode", + action_target = new Variant.string ("area"), child = selection_box, group = all }; selection.add_css_class ("image-button"); - selection.toggled.connect (() => { - if (selection.active) { - screenshot_type = ScreenshotType.AREA; - } - }); - var pointer_switch = new Gtk.Switch () { halign = START };