From 5588c493355878e8243f889ec4225c02f044e822 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Thu, 31 May 2007 15:40:41 +0000 Subject: [PATCH] add an allow_fallback option when opening a theme --- openbox/openbox.c | 2 +- render/theme.c | 6 +++++- render/theme.h | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openbox/openbox.c b/openbox/openbox.c index 9b81f200..cfc6f036 100644 --- a/openbox/openbox.c +++ b/openbox/openbox.c @@ -261,7 +261,7 @@ gint main(gint argc, gchar **argv) /* load the theme specified in the rc file */ { RrTheme *theme; - if ((theme = RrThemeNew(ob_rr_inst, config_theme, + if ((theme = RrThemeNew(ob_rr_inst, config_theme, TRUE, config_font_activewindow, config_font_inactivewindow, config_font_menutitle, diff --git a/render/theme.c b/render/theme.c index 08d4b07d..2b91e765 100644 --- a/render/theme.c +++ b/render/theme.c @@ -65,6 +65,7 @@ static gboolean find_appearance(ParseState *ps, xmlNodePtr n, const gchar *names #define FIND(type, args...) find_##type(&ps, root, args) RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, + gboolean allow_fallback, RrFont *active_window_font, RrFont *inactive_window_font, RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font) @@ -85,12 +86,15 @@ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *name, name = NULL; } } - if (!name) { + if (name == NULL && allow_fallback) { if (!parse_load_theme(DEFAULT_THEME, &ps.doc, &root, &ps.path)) { g_message("Unable to load the theme '%s'", DEFAULT_THEME); return NULL; } } + if (name == NULL) + return NULL; + ps.inst = inst; theme = g_new0(RrTheme, 1); diff --git a/render/theme.h b/render/theme.h index 911366ae..c65fec58 100644 --- a/render/theme.h +++ b/render/theme.h @@ -236,6 +236,7 @@ struct _RrTheme { /*! The font values are all optional. If a NULL is used for any of them, then the default font will be used. */ RrTheme* RrThemeNew(const RrInstance *inst, const gchar *theme, + gboolean allow_fallback, RrFont *active_window_font, RrFont *inactive_window_font, RrFont *menu_title_font, RrFont *menu_item_font, RrFont *osd_font); -- 2.45.2