summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorRob Adams <readams@readams.net>2003-11-08 04:43:18 +0000
committerRob Adams <readams@src.gnome.org>2003-11-08 04:43:18 +0000
commit2218b79143446af904fe1c0007d3458f59e4e995 (patch)
treea0f90d3042a80a3ca5d91682467ec74eeee86d19 /src/main.c
parent17b8a1f3e677e96384382e7584e8dc00a8d28b08 (diff)
downloadmetacity-2218b79143446af904fe1c0007d3458f59e4e995.tar.gz
metacity-2218b79143446af904fe1c0007d3458f59e4e995.tar.bz2
Try harder to find a theme in the event that the theme in the preference
2003-11-07 Rob Adams <readams@readams.net> * src/main.c (main): Try harder to find a theme in the event that the theme in the preference cannot be found. Patch from Marcin Krzyzanowski. See #125815. * src/place.c (meta_window_place): use "visual" centering for dialog placement and clip new dialogs to an xinerama workspace. Fix for #118336.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index d385a92..4b3f26e 100644
--- a/src/main.c
+++ b/src/main.c
@@ -421,18 +421,36 @@ main (int argc, char **argv)
meta_ui_set_current_theme (meta_prefs_get_theme (), FALSE);
- /* Try some panic stuff, this is lame but we really
- * don't want users to lose their WM :-/
+ /* 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", FALSE);
if (!meta_ui_have_a_theme ())
- meta_ui_set_current_theme ("Atlanta", FALSE);
-
- if (!meta_ui_have_a_theme ())
- meta_ui_set_current_theme ("Crux", FALSE);
-
+ {
+ gchar *dir_entry = NULL;
+ GError *err = NULL;
+ GDir *themes_dir = NULL;
+
+ if (!(themes_dir = g_dir_open (METACITY_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, FALSE);
+ }
+
+ 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."),
METACITY_DATADIR"/themes");