Cleanup, fix missing initializer.

This commit is contained in:
Dave Davenport 2016-12-12 09:11:57 +01:00
parent 6d9ce47974
commit d6ec7b1de8
2 changed files with 10 additions and 8 deletions

View File

@ -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,

View File

@ -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 */