[mutter] frames: Force on dark theme for all apps if the user requested it
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] frames: Force on dark theme for all apps if the user requested it
- Date: Fri, 2 Jan 2015 17:24:17 +0000 (UTC)
commit 274ea76eea6e97be01a723122c0774e7e961bff2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Fri Jan 2 09:19:17 2015 -0800
frames: Force on dark theme for all apps if the user requested it
If the user requested a dark theme for all apps through GNOME Tweak
Tool, go ahead and force it for all apps, not only GTK+3 apps.
Thanks to MaTachi on reddit who suggested the idea:
http://www.reddit.com/r/linux/comments/2r1zwj/linus_i_dont_know_who_thought_it_was_a_good_idea/cnc10ui
src/ui/frames.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 5493bdd..7014e49 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -484,6 +484,23 @@ meta_frames_new (int screen_number)
return frames;
}
+static const char *
+get_theme_variant_override (MetaFrames *frames)
+{
+ GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (frames));
+ GtkSettings *settings = gtk_settings_get_for_screen (screen);
+ gboolean dark_theme_requested;
+
+ g_object_get (settings,
+ "gtk-application-prefer-dark-theme", &dark_theme_requested,
+ NULL);
+
+ if (dark_theme_requested)
+ return "dark";
+
+ return NULL;
+}
+
/* In order to use a style with a window it has to be attached to that
* window. Actually, the colormaps just have to match, but since GTK+
* already takes care of making sure that its cheap to attach a style
@@ -495,11 +512,17 @@ meta_ui_frame_attach_style (MetaUIFrame *frame)
{
MetaFrames *frames = frame->frames;
const char *variant;
+ const char *variant_override;
if (frame->style_info != NULL)
meta_style_info_unref (frame->style_info);
- variant = frame->meta_window->gtk_theme_variant;
+ variant_override = get_theme_variant_override (frame->frames);
+
+ if (variant_override)
+ variant = variant_override;
+ else
+ variant = frame->meta_window->gtk_theme_variant;
if (variant == NULL || strcmp(variant, "normal") == 0)
frame->style_info = meta_style_info_ref (frames->normal_style);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]