From 57ad0fa1b93989c328c188d3785db3f7b43ebeba Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Sat, 22 Aug 2020 08:48:33 +0200 Subject: [PATCH 1/5] Add action to launch permission settings --- src/Application.vala | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Application.vala b/src/Application.vala index cb2958ad..6f8543e1 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -44,9 +44,11 @@ public class Sideload.Application : Gtk.Application { main_window.show_all (); var quit_action = new SimpleAction ("quit", null); + var permissions_action = new SimpleAction ("permissions", null); var launch_action = new SimpleAction ("launch", null); add_action (quit_action); + add_action (permissions_action); add_action (launch_action); set_accels_for_action ("app.quit", {"q"}); @@ -56,6 +58,14 @@ public class Sideload.Application : Gtk.Application { } }); + permissions_action.activate.connect (() => { + try { + AppInfo.launch_default_for_uri ("settings://applications/permissions", null); + } catch (Error e) { + warning ("Unable to launch permission settings"); + } + }); + launch_action.activate.connect (() => { ref_file.launch.begin (); activate_action ("quit", null); From 722b13f40b76a7e0e5a2dfb367c92c8357112788 Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Sat, 22 Aug 2020 08:48:49 +0200 Subject: [PATCH 2/5] Add button to launch permission settings --- src/Views/SuccessView.vala | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index 579fddfd..d0f05743 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -43,7 +43,7 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("The app was installed successfully"); } - secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall.").printf (appstore_name); + secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. You can adjust the permissions in systems settings.").printf (appstore_name); } else if (view_type == SuccessType.ALREADY_INSTALLED) { if (app_name != null) { primary_label.label = _("“%s” is already installed").printf (app_name); @@ -51,17 +51,21 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("This app is already installed"); } - secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall.").printf (appstore_name); + secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. You can adjust the permissions in systems settings.").printf (appstore_name); } var close_button = new Gtk.Button.with_label (_("Close")); close_button.action_name = "app.quit"; + var permissions_button = new Gtk.Button.with_label (_("Adjust permissions")); + permissions_button.action_name = "app.permissions"; + var open_button = new Gtk.Button.with_label (_("Open App")); open_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); open_button.action_name = "app.launch"; button_box.add (close_button); + button_box.add (permissions_button); button_box.add (open_button); show_all (); From 05db2f04665616b256fff60ad9fd9ee203b32180 Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Tue, 25 Aug 2020 18:11:37 +0200 Subject: [PATCH 3/5] Use inline link --- src/Application.vala | 10 ---------- src/Views/SuccessView.vala | 12 ++++++------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 6f8543e1..cb2958ad 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -44,11 +44,9 @@ public class Sideload.Application : Gtk.Application { main_window.show_all (); var quit_action = new SimpleAction ("quit", null); - var permissions_action = new SimpleAction ("permissions", null); var launch_action = new SimpleAction ("launch", null); add_action (quit_action); - add_action (permissions_action); add_action (launch_action); set_accels_for_action ("app.quit", {"q"}); @@ -58,14 +56,6 @@ public class Sideload.Application : Gtk.Application { } }); - permissions_action.activate.connect (() => { - try { - AppInfo.launch_default_for_uri ("settings://applications/permissions", null); - } catch (Error e) { - warning ("Unable to launch permission settings"); - } - }); - launch_action.activate.connect (() => { ref_file.launch.begin (); activate_action ("quit", null); diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index d0f05743..7abf802a 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -43,7 +43,9 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("The app was installed successfully"); } - secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. You can adjust the permissions in systems settings.").printf (appstore_name); + secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s...").printf ( + appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") + ); } else if (view_type == SuccessType.ALREADY_INSTALLED) { if (app_name != null) { primary_label.label = _("“%s” is already installed").printf (app_name); @@ -51,21 +53,19 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("This app is already installed"); } - secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. You can adjust the permissions in systems settings.").printf (appstore_name); + secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s...").printf ( + appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") + ); } var close_button = new Gtk.Button.with_label (_("Close")); close_button.action_name = "app.quit"; - var permissions_button = new Gtk.Button.with_label (_("Adjust permissions")); - permissions_button.action_name = "app.permissions"; - var open_button = new Gtk.Button.with_label (_("Open App")); open_button.get_style_context ().add_class (Gtk.STYLE_CLASS_SUGGESTED_ACTION); open_button.action_name = "app.launch"; button_box.add (close_button); - button_box.add (permissions_button); button_box.add (open_button); show_all (); From e1c7c84fa6172732c5e8deca97a3c92610c7546d Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Tue, 25 Aug 2020 18:16:04 +0200 Subject: [PATCH 4/5] Satisfy linter and use ellipsis instead of periods --- src/Views/SuccessView.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index 7abf802a..868212f3 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -43,7 +43,7 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("The app was installed successfully"); } - secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s...").printf ( + secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s…").printf ( appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") ); } else if (view_type == SuccessType.ALREADY_INSTALLED) { @@ -53,7 +53,7 @@ public class Sideload.SuccessView : AbstractView { primary_label.label = _("This app is already installed"); } - secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s...").printf ( + secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s…").printf ( appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") ); } From 8d1cfb6d1bf4f8e1d715ff3123c449fea96ff966 Mon Sep 17 00:00:00 2001 From: Marius Meisenzahl Date: Tue, 25 Aug 2020 20:41:04 +0200 Subject: [PATCH 5/5] Add comment for translators --- src/Views/SuccessView.vala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Views/SuccessView.vala b/src/Views/SuccessView.vala index 868212f3..5ca9f418 100644 --- a/src/Views/SuccessView.vala +++ b/src/Views/SuccessView.vala @@ -44,6 +44,7 @@ public class Sideload.SuccessView : AbstractView { } secondary_label.label = _("Open it any time from the Applications Menu. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s…").printf ( + /// TRANSLATORS: "System Settings" is related to the title of https://github.com/elementary/switchboard, "Applications" is related to the title of https://github.com/elementary/switchboard-plug-applications appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") ); } else if (view_type == SuccessType.ALREADY_INSTALLED) { @@ -54,6 +55,7 @@ public class Sideload.SuccessView : AbstractView { } secondary_label.label = _("No changes were made. Visit %s for app information, updates, and to uninstall. Permissions can be changed in %s → %s…").printf ( + /// TRANSLATORS: "System Settings" is related to the title of https://github.com/elementary/switchboard, "Applications" is related to the title of https://github.com/elementary/switchboard-plug-applications appstore_name, "settings://applications/permissions", _("System Settings"), _("Applications") ); }