theme: Use a singleton theme

Different themes don't make sense when we are always using the current
GTK+ theme for everything, so adapt the MetaTheme API to use a singleton.

https://bugzilla.gnome.org/show_bug.cgi?id=741917
This commit is contained in:
Florian Müllner
2014-09-26 00:26:01 +02:00
committed by Jasper St. Pierre
parent d5e6177900
commit 662dd6a289
6 changed files with 17 additions and 68 deletions

View File

@ -431,42 +431,6 @@ meta_run (void)
meta_prefs_init ();
meta_prefs_add_listener (prefs_changed_callback, NULL);
meta_ui_set_current_theme (meta_prefs_get_theme ());
/* Try to find some theme that'll work if the theme preference
* doesn't exist. First try Simple (the default theme) then just
* try anything in the themes directory.
*/
if (!meta_ui_have_a_theme ())
meta_ui_set_current_theme ("Simple");
if (!meta_ui_have_a_theme ())
{
const char *dir_entry = NULL;
GError *err = NULL;
GDir *themes_dir = NULL;
if (!(themes_dir = g_dir_open (MUTTER_DATADIR"/themes", 0, &err)))
{
meta_fatal (_("Failed to scan themes directory: %s\n"), err->message);
g_error_free (err);
}
else
{
while (((dir_entry = g_dir_read_name (themes_dir)) != NULL) &&
(!meta_ui_have_a_theme ()))
{
meta_ui_set_current_theme (dir_entry);
}
g_dir_close (themes_dir);
}
}
if (!meta_ui_have_a_theme ())
meta_fatal (_("Could not find a theme! Be sure %s exists and contains the usual themes.\n"),
MUTTER_DATADIR"/themes");
if (!meta_display_open ())
meta_exit (META_EXIT_ERROR);
@ -513,9 +477,7 @@ prefs_changed_callback (MetaPreference pref,
{
switch (pref)
{
case META_PREF_THEME:
case META_PREF_DRAGGABLE_BORDER_WIDTH:
meta_ui_set_current_theme (meta_prefs_get_theme ());
meta_display_retheme_all ();
break;