diff options
author | Bastien Nocera <hadess@hadess.net> | 2010-05-06 20:35:52 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2010-05-10 01:15:14 +0100 |
commit | 4551509af1e5e3825646231530c31d2840a85ca3 (patch) | |
tree | ae89821261cf3370b5faeb9cbaf75fa8beff423f /demos | |
parent | b76557e9444a50d947061c2d90d19d0c13f2e003 (diff) | |
download | gtk+-4551509af1e5e3825646231530c31d2840a85ca3.tar.gz |
Make it easy for apps to have dark themes
Some types of applications would benefit from having "dark" themes,
usually black backgrounds, such as:
* Movie players
* Photo management and display applications
To make it easy for those applications to prefer a dark theme,
we're adding the "gtk-application-prefer-dark-theme" GtkSetting, which
will make the theme loading code automatically look for a "gtkrc-dark"
file in the same directory you would usually find a gtkrc file.
the same name and a "-dark" suffix.
If no "-dark" gtkrc variant is available, the normal gtkrc will
be used.
https://bugzilla.gnome.org/show_bug.cgi?id=617955
Diffstat (limited to 'demos')
-rw-r--r-- | demos/gtk-demo/appwindow.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/demos/gtk-demo/appwindow.c b/demos/gtk-demo/appwindow.c index b934be8d2f..2f62d63df7 100644 --- a/demos/gtk-demo/appwindow.c +++ b/demos/gtk-demo/appwindow.c @@ -19,6 +19,16 @@ activate_action (GtkAction *action) GtkWidget *dialog; + if (g_str_equal (name, "DarkTheme")) + { + gboolean value = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + GtkSettings *settings = gtk_settings_get_default (); + + g_object_set (G_OBJECT (settings), + "gtk-application-prefer-dark-theme", value, + NULL); + return; + } dialog = gtk_message_dialog_new (GTK_WINDOW (window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, @@ -212,6 +222,11 @@ static GtkToggleActionEntry toggle_entries[] = { "Bold", /* tooltip */ G_CALLBACK (activate_action), TRUE }, /* is_active */ + { "DarkTheme", NULL, /* name, stock id */ + "_Prefer Dark Theme", NULL, /* label, accelerator */ + "Prefer Dark Theme", /* tooltip */ + G_CALLBACK (activate_action), + FALSE }, /* is_active */ }; static guint n_toggle_entries = G_N_ELEMENTS (toggle_entries); @@ -265,6 +280,7 @@ static const gchar *ui_info = " <menuitem action='Quit'/>" " </menu>" " <menu action='PreferencesMenu'>" +" <menuitem action='DarkTheme'/>" " <menu action='ColorMenu'>" " <menuitem action='Red'/>" " <menuitem action='Green'/>" |