forked from AuroraMiddleware/gtk
widget-factory: Improve the theme selector
Implement the "Current style" choice using gtk_settings_reset_property, so we go back to following the settings changes.
This commit is contained in:
parent
b54178e6a4
commit
02fa948914
@ -40,9 +40,6 @@ change_dark_state (GSimpleAction *action,
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static char *current_theme;
|
||||
static gboolean current_dark;
|
||||
|
||||
static void
|
||||
change_theme_state (GSimpleAction *action,
|
||||
GVariant *state,
|
||||
@ -53,6 +50,8 @@ change_theme_state (GSimpleAction *action,
|
||||
const char *theme;
|
||||
gboolean prefer_dark = FALSE;
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
|
||||
s = g_variant_get_string (state, NULL);
|
||||
|
||||
if (strcmp (s, "adwaita") == 0)
|
||||
@ -77,8 +76,9 @@ change_theme_state (GSimpleAction *action,
|
||||
}
|
||||
else if (strcmp (s, "current") == 0)
|
||||
{
|
||||
theme = current_theme;
|
||||
prefer_dark = current_dark;
|
||||
gtk_settings_reset_property (settings, "gtk-theme-name");
|
||||
gtk_settings_reset_property (settings, "gtk-application-prefer-dark-theme");
|
||||
return;
|
||||
}
|
||||
else
|
||||
return;
|
||||
@ -87,8 +87,6 @@ change_theme_state (GSimpleAction *action,
|
||||
"gtk-theme-name", theme,
|
||||
"gtk-application-prefer-dark-theme", prefer_dark,
|
||||
NULL);
|
||||
|
||||
g_simple_action_set_state (action, state);
|
||||
}
|
||||
|
||||
static GtkWidget *page_stack;
|
||||
@ -1740,11 +1738,6 @@ activate (GApplication *app)
|
||||
GAction *action;
|
||||
GError *error = NULL;
|
||||
|
||||
g_object_get (gtk_settings_get_default (),
|
||||
"gtk-theme-name", ¤t_theme,
|
||||
"gtk-application-prefer-dark-theme", ¤t_dark,
|
||||
NULL);
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
|
Loading…
Reference in New Issue
Block a user