summaryrefslogtreecommitdiff
path: root/src/prefs.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@pobox.com>2002-02-07 03:07:56 +0000
committerHavoc Pennington <hp@src.gnome.org>2002-02-07 03:07:56 +0000
commit8ae714eeaef03db0a55c11fc31834c8d65e2ea03 (patch)
treee3bc1027754f8e70bfc06266f798f682802c4342 /src/prefs.c
parent2be2d8ccbe196193d383841e1c990843a35d4f1b (diff)
downloadmetacity-8ae714eeaef03db0a55c11fc31834c8d65e2ea03.tar.gz
disable custom log handler and fatal mask for now
2002-02-06 Havoc Pennington <hp@pobox.com> * src/main.c (main): disable custom log handler and fatal mask for now * src/theme.c (meta_draw_op_list_draw): Add META_DRAW_CLIP * src/main.c: load theme, monitor current theme setting * src/prefs.c: add "current theme" setting * src/stack.c (meta_stack_free): don't try to free last_root_children_stacked if it doesn't exist * src/themewidget.c: pluggable GtkMisc subclass to use for menu icons * src/screen.c (meta_screen_manage_all_windows): fix signed/unsigned warning * src/frames.c: port to theme system (meta_frames_style_set): chain up * theme-format.txt: new file * configure.in: add more compiler warnings * src/theme.c: add various stuff needed to get theme parser working. Remove the "spacer" concept from FrameLayout object. Add draw op that references a draw op list. * configure.in: require GTK 1.3.13 * src/Makefile.am: add theme-parser.[hc], implement loading a theme * src/theme.c: add "draw title" and "draw window icon" operations (meta_draw_op_draw): put object_width/object_height in expression environment before computing x/y. Handle out-of-memory when creating pixbufs. Assorted other cleanups.
Diffstat (limited to 'src/prefs.c')
-rw-r--r--src/prefs.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/prefs.c b/src/prefs.c
index 79a2d1a0..a5fe823e 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -29,6 +29,7 @@
* notify listener and of course in the .schemas file
*/
#define KEY_FOCUS_MODE "/apps/metacity/general/focus_mode"
+#define KEY_THEME "/apps/metacity/general/theme"
#define KEY_USE_DESKTOP_FONT "/apps/metacity/general/titlebar_uses_desktop_font"
#define KEY_TITLEBAR_FONT "/apps/metacity/general/titlebar_font"
#define KEY_TITLEBAR_FONT_SIZE "/apps/metacity/general/titlebar_font_size"
@@ -43,6 +44,7 @@ static gboolean use_desktop_font = TRUE;
static PangoFontDescription *titlebar_font = NULL;
static int titlebar_font_size = 0;
static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK;
+static char* current_theme = NULL;
static int num_workspaces = 4;
static gboolean application_based = FALSE;
@@ -50,6 +52,7 @@ static gboolean update_use_desktop_font (gboolean value);
static gboolean update_titlebar_font (const char *value);
static gboolean update_titlebar_font_size (int value);
static gboolean update_focus_mode (const char *value);
+static gboolean update_theme (const char *value);
static gboolean update_num_workspaces (int value);
static gboolean update_application_based (gboolean value);
@@ -212,6 +215,12 @@ meta_prefs_init (void)
update_focus_mode (str_val);
g_free (str_val);
+ str_val = gconf_client_get_string (client, KEY_THEME,
+ &err);
+ cleanup_error (&err);
+ update_theme (str_val);
+ g_free (str_val);
+
/* If the keys aren't set in the database, we use essentially
* bogus values instead of any kind of default. This is
* just lazy. But they keys ought to be set, anyhow.
@@ -279,6 +288,22 @@ change_notify (GConfClient *client,
if (update_focus_mode (str))
queue_changed (META_PREF_FOCUS_MODE);
}
+ if (strcmp (key, KEY_THEME) == 0)
+ {
+ const char *str;
+
+ if (value && value->type != GCONF_VALUE_STRING)
+ {
+ meta_warning (_("GConf key \"%s\" is set to an invalid type\n"),
+ KEY_THEME);
+ goto out;
+ }
+
+ str = value ? gconf_value_get_string (value) : NULL;
+
+ if (update_focus_mode (str))
+ queue_changed (META_PREF_THEME);
+ }
else if (strcmp (key, KEY_TITLEBAR_FONT) == 0)
{
const char *str;
@@ -394,12 +419,50 @@ update_focus_mode (const char *value)
return (old_mode != focus_mode);
}
+static gboolean
+update_theme (const char *value)
+{
+ const char *old_theme;
+ gboolean changed;
+
+ old_theme = current_theme;
+
+ if (value != NULL && *value)
+ {
+ current_theme = g_strdup (value);
+ }
+
+ changed = TRUE;
+ if ((old_theme && current_theme &&
+ strcmp (old_theme, current_theme) == 0) ||
+ (old_theme == NULL && current_theme == NULL))
+ changed = FALSE;
+
+ if (old_theme != current_theme)
+ g_free (old_theme);
+
+ if (current_theme == NULL)
+ {
+ /* Fallback crackrock */
+ current_theme = g_strdup ("Atlanta");
+ changed = TRUE;
+ }
+
+ return changed;
+}
+
MetaFocusMode
meta_prefs_get_focus_mode (void)
{
return focus_mode;
}
+const char*
+meta_prefs_get_theme (void)
+{
+ return current_theme;
+}
+
static gboolean
update_use_desktop_font (gboolean value)
{
@@ -528,6 +591,10 @@ meta_preference_to_string (MetaPreference pref)
return "FOCUS_MODE";
break;
+ case META_PREF_THEME:
+ return "THEME";
+ break;
+
case META_PREF_TITLEBAR_FONT:
return "TITLEBAR_FONT";
break;