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
This commit is contained in:
parent
a180e8b87e
commit
274ea76eea
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user