don't exit in the render lib, rather return a NULL font/theme on failure
This commit is contained in:
parent
b3e9fea103
commit
dc92dbfc56
2 changed files with 15 additions and 7 deletions
|
@ -23,7 +23,7 @@ static void font_startup(void)
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
if (!XftInit(0)) {
|
if (!XftInit(0)) {
|
||||||
g_warning(_("Couldn't initialize Xft.\n"));
|
g_warning(_("Couldn't initialize Xft.\n"));
|
||||||
exit(3);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
version = XftGetVersion();
|
version = XftGetVersion();
|
||||||
|
@ -71,9 +71,8 @@ RrFont *RrFontOpen(const RrInstance *inst, char *fontstring)
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
g_warning(_("Unable to load font: %s\n"), "sans");
|
g_warning(_("Unable to load font: %s\n"), "sans");
|
||||||
g_warning(_("Aborting!.\n"));
|
|
||||||
|
|
||||||
exit(3); /* can't continue without a font */
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RrFontClose(RrFont *f)
|
void RrFontClose(RrFont *f)
|
||||||
|
|
|
@ -27,7 +27,7 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
gchar *font_str;
|
gchar *font_str;
|
||||||
RrTheme *theme;
|
RrTheme *theme;
|
||||||
|
|
||||||
theme = g_new(RrTheme, 1);
|
theme = g_new0(RrTheme, 1);
|
||||||
|
|
||||||
theme->inst = inst;
|
theme->inst = inst;
|
||||||
|
|
||||||
|
@ -125,7 +125,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
theme->winfont_shadow_tint < 100 || theme->winfont_shadow_tint > 100)
|
theme->winfont_shadow_tint < 100 || theme->winfont_shadow_tint > 100)
|
||||||
theme->winfont_shadow_tint = 25;
|
theme->winfont_shadow_tint = 25;
|
||||||
|
|
||||||
theme->winfont = RrFontOpen(inst, font_str);
|
if (!(theme->winfont = RrFontOpen(inst, font_str))) {
|
||||||
|
RrThemeFree(theme);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
theme->winfont_height = RrFontHeight(theme->winfont, theme->winfont_shadow,
|
theme->winfont_height = RrFontHeight(theme->winfont, theme->winfont_shadow,
|
||||||
theme->winfont_shadow_offset);
|
theme->winfont_shadow_offset);
|
||||||
|
|
||||||
|
@ -156,7 +159,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
theme->mtitlefont_shadow_tint > 100)
|
theme->mtitlefont_shadow_tint > 100)
|
||||||
theme->mtitlefont_shadow_tint = 25;
|
theme->mtitlefont_shadow_tint = 25;
|
||||||
|
|
||||||
theme->mtitlefont = RrFontOpen(inst, font_str);
|
if (!(theme->mtitlefont = RrFontOpen(inst, font_str))) {
|
||||||
|
RrThemeFree(theme);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
theme->mtitlefont_height = RrFontHeight(theme->mtitlefont,
|
theme->mtitlefont_height = RrFontHeight(theme->mtitlefont,
|
||||||
theme->mtitlefont_shadow,
|
theme->mtitlefont_shadow,
|
||||||
theme->mtitlefont_shadow_offset);
|
theme->mtitlefont_shadow_offset);
|
||||||
|
@ -188,7 +194,10 @@ RrTheme* RrThemeNew(const RrInstance *inst, gchar *name)
|
||||||
theme->mfont_shadow_tint > 100)
|
theme->mfont_shadow_tint > 100)
|
||||||
theme->mfont_shadow_tint = 25;
|
theme->mfont_shadow_tint = 25;
|
||||||
|
|
||||||
theme->mfont = RrFontOpen(inst, font_str);
|
if (!(theme->mfont = RrFontOpen(inst, font_str))) {
|
||||||
|
RrThemeFree(theme);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
theme->mfont_height = RrFontHeight(theme->mfont, theme->mfont_shadow,
|
theme->mfont_height = RrFontHeight(theme->mfont, theme->mfont_shadow,
|
||||||
theme->mfont_shadow_offset);
|
theme->mfont_shadow_offset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue