[gnome-builder] plugins/menu-search: allow switching light/dark from global search
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] plugins/menu-search: allow switching light/dark from global search
- Date: Thu, 21 Jul 2022 08:31:37 +0000 (UTC)
commit 7b227f3fbcb192a2756bf27321aa79b4cfbb71b2
Author: Christian Hergert <chergert redhat com>
Date: Thu Jul 21 01:20:33 2022 -0700
plugins/menu-search: allow switching light/dark from global search
src/libide/gui/ide-application-actions.c | 20 ++++++++++++++++++++
src/plugins/menu-search/gtk/menus.ui | 13 +++++++++++++
2 files changed, 33 insertions(+)
---
diff --git a/src/libide/gui/ide-application-actions.c b/src/libide/gui/ide-application-actions.c
index e4090e71e..b3e3ea530 100644
--- a/src/libide/gui/ide-application-actions.c
+++ b/src/libide/gui/ide-application-actions.c
@@ -361,6 +361,24 @@ ide_application_actions_stats (GSimpleAction *action,
ide_gtk_window_present (window);
}
+static void
+ide_application_actions_dark (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ IdeApplication *self = user_data;
+ g_settings_set_string (self->settings, "style-variant", "dark");
+}
+
+static void
+ide_application_actions_light (GSimpleAction *action,
+ GVariant *param,
+ gpointer user_data)
+{
+ IdeApplication *self = user_data;
+ g_settings_set_string (self->settings, "style-variant", "light");
+}
+
static const GActionEntry IdeApplicationActions[] = {
{ "about:types", ide_application_actions_stats },
{ "about", ide_application_actions_about },
@@ -369,6 +387,8 @@ static const GActionEntry IdeApplicationActions[] = {
{ "preferences-page", ide_application_actions_preferences, "s" },
{ "quit", ide_application_actions_quit },
{ "help", ide_application_actions_help },
+ { "dark", ide_application_actions_dark },
+ { "light", ide_application_actions_light },
};
void
diff --git a/src/plugins/menu-search/gtk/menus.ui b/src/plugins/menu-search/gtk/menus.ui
index d3c41da80..8118bcabb 100644
--- a/src/plugins/menu-search/gtk/menus.ui
+++ b/src/plugins/menu-search/gtk/menus.ui
@@ -25,5 +25,18 @@
<attribute name="verb-icon">panel-bottom-symbolic</attribute>
<attribute name="action">panel.toggle-bottom</attribute>
</item>
+
+ <item>
+ <attribute name="label" translatable="yes">Switch to Dark Mode</attribute>
+ <attribute name="description" translatable="yes">Change style-scheme to dark variant</attribute>
+ <attribute name="action">app.dark</attribute>
+ </item>
+
+ <item>
+ <attribute name="label" translatable="yes">Switch to Light Mode</attribute>
+ <attribute name="description" translatable="yes">Change style-scheme to light variant</attribute>
+ <attribute name="action">app.light</attribute>
+ </item>
+
</menu>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]