From d6ec7b1de8094d20887f72be32af09ecfe3da4fe Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 12 Dec 2016 09:11:57 +0100 Subject: [PATCH] Cleanup, fix missing initializer. --- source/theme.c | 16 +++++++++------- source/xrmoptions.c | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/source/theme.c b/source/theme.c index a4017076..ba57a3d0 100644 --- a/source/theme.c +++ b/source/theme.c @@ -134,9 +134,11 @@ void rofi_theme_parse_file ( const char *file ) while ( yyparse() ); } -static Widget *rofi_theme_find ( const char *name ) +static Widget *rofi_theme_find ( Widget *widget , const char *name ) { - Widget *widget = rofi_theme; + if ( name == NULL ) { + return widget; + } char **names = g_strsplit ( name, "." , 0 ); int found = TRUE; for ( unsigned int i = 0; found && names && names[i]; i++ ){ @@ -172,7 +174,7 @@ int rofi_theme_get_integer ( const char *name, const char *property, int def ) if ( rofi_theme == NULL ) { return def; } - Widget *widget = rofi_theme_find ( name ); + Widget *widget = rofi_theme_find ( rofi_theme, name ); Property *p = rofi_theme_find_property ( widget, P_INTEGER, property ); if ( p ){ return p->value.i; @@ -185,7 +187,7 @@ int rofi_theme_get_boolean ( const char *name, const char *property, int def ) if ( rofi_theme == NULL ) { return def; } - Widget *widget = rofi_theme_find ( name ); + Widget *widget = rofi_theme_find ( rofi_theme, name ); Property *p = rofi_theme_find_property ( widget, P_BOOLEAN, property ); if ( p ){ return p->value.b; @@ -198,7 +200,7 @@ char *rofi_theme_get_string ( const char *name, const char *property, char *def if ( rofi_theme == NULL ) { return def; } - Widget *widget = rofi_theme_find ( name ); + Widget *widget = rofi_theme_find ( rofi_theme, name ); Property *p = rofi_theme_find_property ( widget, P_STRING, property ); if ( p ){ return p->value.s; @@ -210,7 +212,7 @@ double rofi_theme_get_double ( const char *name, const char *property, double d if ( rofi_theme == NULL ) { return def; } - Widget *widget = rofi_theme_find ( name ); + Widget *widget = rofi_theme_find ( rofi_theme, name ); Property *p = rofi_theme_find_property ( widget, P_DOUBLE, property ); if ( p ){ return p->value.b; @@ -222,7 +224,7 @@ void rofi_theme_get_color ( const char *name, const char *property, cairo_t *d) if ( rofi_theme == NULL ) { return ; } - Widget *widget = rofi_theme_find ( name ); + Widget *widget = rofi_theme_find ( rofi_theme, name ); Property *p = rofi_theme_find_property ( widget, P_COLOR, property ); if ( p ){ cairo_set_source_rgba ( d, diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 98152b59..ef77a36f 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -195,7 +195,7 @@ static XrmOption xrmOptions[] = { { xrm_Boolean, "show-match", { .snum = &config.show_match }, NULL, "Indicate how it match by underlining it.", CONFIG_DEFAULT }, { xrm_String, "theme", { .str = &config.theme }, NULL, - "New style theme file" }, + "New style theme file", CONFIG_DEFAULT }, }; /** Dynamic array of extra options */