[epiphany/gnome-3-38] ephy-shell: Show run in background option as checkbutton
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/gnome-3-38] ephy-shell: Show run in background option as checkbutton
- Date: Mon, 21 Sep 2020 14:08:54 +0000 (UTC)
commit 949897943f30769d05b8b7a57d627185d5e122fa
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Mon Sep 21 11:20:22 2020 +0000
ephy-shell: Show run in background option as checkbutton
Fixes: https://gitlab.gnome.org/GNOME/epiphany/-/issues/1337
(cherry picked from commit c022e3ac2d13aad5200f43e71e46dd43ba533750)
src/ephy-shell.c | 30 ++++++++++++++----------------
src/resources/gtk/page-menu-popover.ui | 1 -
2 files changed, 14 insertions(+), 17 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 77fb76d4c..01854f42b 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -342,18 +342,6 @@ notification_clicked (GSimpleAction *action,
webkit_notification_clicked (notification);
}
-static void
-run_in_background_change_state (GSimpleAction *action,
- GVariant *value,
- gpointer user_data)
-{
- gboolean active;
-
- active = g_settings_get_boolean (EPHY_SETTINGS_WEB_APP, EPHY_PREFS_WEB_APP_RUN_IN_BACKGROUND);
- g_simple_action_set_state (action, g_variant_new_boolean (!active));
- g_settings_set_boolean (EPHY_SETTINGS_WEB_APP, EPHY_PREFS_WEB_APP_RUN_IN_BACKGROUND, !active);
-}
-
static GActionEntry app_entries[] = {
{ "new-window", new_window, NULL, NULL, NULL },
{ "new-incognito", new_incognito_window, NULL, NULL, NULL },
@@ -380,7 +368,7 @@ static GActionEntry app_mode_app_entries[] = {
{ "preferences", show_preferences, NULL, NULL, NULL },
{ "about", show_about, NULL, NULL, NULL },
{ "quit", quit_application, NULL, NULL, NULL },
- { "run-in-background", NULL, "b", "false", run_in_background_change_state},
+ { "run-in-background", NULL, NULL, "false", NULL},
{ "notification-clicked", notification_clicked, "t", NULL, NULL},
};
@@ -469,6 +457,16 @@ run_in_background_get_mapping (GValue *value,
return TRUE;
}
+static GVariant *
+run_in_background_set_mapping (const GValue *value,
+ const GVariantType *expected_type,
+ gpointer user_data)
+{
+ GVariant *var = g_value_get_variant (value);
+
+ return g_variant_new_boolean (g_variant_get_boolean (var));
+}
+
static void
ephy_shell_startup (GApplication *application)
{
@@ -523,11 +521,11 @@ ephy_shell_startup (GApplication *application)
action = g_action_map_lookup_action (G_ACTION_MAP (application), "run-in-background");
g_settings_bind_with_mapping (EPHY_SETTINGS_WEB_APP,
EPHY_PREFS_WEB_APP_RUN_IN_BACKGROUND,
- G_SIMPLE_ACTION (action),
+ action,
"state",
- G_SETTINGS_BIND_GET | G_SETTINGS_BIND_GET_NO_CHANGES,
+ G_SETTINGS_BIND_DEFAULT,
run_in_background_get_mapping,
- NULL,
+ run_in_background_set_mapping,
NULL,
NULL);
}
diff --git a/src/resources/gtk/page-menu-popover.ui b/src/resources/gtk/page-menu-popover.ui
index e06a61c83..6942c99a2 100644
--- a/src/resources/gtk/page-menu-popover.ui
+++ b/src/resources/gtk/page-menu-popover.ui
@@ -171,7 +171,6 @@
<property name="can_focus">True</property>
<property name="text" translatable="yes">_Run in Background</property>
<property name="action-name">app.run-in-background</property>
- <property name="action-target">true</property>
<property name="visible">True</property>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]