Fix separator class and tweak parser inheritance.

This commit is contained in:
Dave Davenport 2016-12-13 00:09:51 +01:00
parent fd64bb7a41
commit 38035568f3
3 changed files with 18 additions and 1 deletions

View File

@ -89,6 +89,7 @@ CLASS_PREFIX class_name state_path BOPEN optional_properties BCLOSE
gchar *classn = g_strconcat ( "@", $2, NULL);
Widget *widget = rofi_theme_find_or_create_class ( rofi_theme , classn );
g_free(classn);
widget->set = TRUE;
for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) {
widget = rofi_theme_find_or_create_class ( widget, iter->data );
}
@ -109,6 +110,7 @@ CLASS_PREFIX class_name state_path BOPEN optional_properties BCLOSE
}
g_list_foreach ( $2, (GFunc)g_free , NULL );
g_list_free ( $2 );
widget->set = TRUE;
for ( GList *iter = g_list_first ( $3 ); iter ; iter = g_list_next ( iter ) ) {
widget = rofi_theme_find_or_create_class ( widget, iter->data );
}

View File

@ -177,6 +177,9 @@ int rofi_theme_get_integer ( const char *wclass, const char *name, const char *
return def;
}
Widget *widget = rofi_theme_find ( rofi_theme, name );
if ( widget != rofi_theme ){
widget = rofi_theme_find ( widget, state );
}
if ( widget == rofi_theme || widget->set == FALSE ){
// Fall back to class
widget = rofi_theme_find ( rofi_theme, wclass);
@ -195,6 +198,9 @@ int rofi_theme_get_boolean ( const char *wclass, const char *name, const char *
return def;
}
Widget *widget = rofi_theme_find ( rofi_theme, name );
if ( widget != rofi_theme ){
widget = rofi_theme_find ( widget, state );
}
if ( widget == rofi_theme || widget->set == FALSE ){
// Fall back to class
widget = rofi_theme_find ( rofi_theme, wclass);
@ -213,6 +219,9 @@ char *rofi_theme_get_string ( const char *wclass, const char *name, const char
return def;
}
Widget *widget = rofi_theme_find ( rofi_theme, name );
if ( widget != rofi_theme ){
widget = rofi_theme_find ( widget, state );
}
if ( widget == rofi_theme || widget->set == FALSE ){
// Fall back to class
widget = rofi_theme_find ( rofi_theme, wclass);
@ -230,6 +239,9 @@ double rofi_theme_get_double ( const char *wclass, const char *name, const char
return def;
}
Widget *widget = rofi_theme_find ( rofi_theme, name );
if ( widget != rofi_theme ){
widget = rofi_theme_find ( widget, state );
}
if ( widget == rofi_theme || widget->set == FALSE ){
// Fall back to class
widget = rofi_theme_find ( rofi_theme, wclass);
@ -247,6 +259,9 @@ void rofi_theme_get_color ( const char *wclass, const char *name, const char *s
return ;
}
Widget *widget = rofi_theme_find ( rofi_theme, name );
if ( widget != rofi_theme ){
widget = rofi_theme_find ( widget, state );
}
if ( widget == rofi_theme || widget->set == FALSE ){
// Fall back to class
widget = rofi_theme_find ( rofi_theme, wclass);

View File

@ -88,7 +88,7 @@ separator *separator_create ( const char *name, separator_type type, short sw )
// Enabled by default
sb->widget.enabled = TRUE;
const char *line_style = rofi_theme_get_string ( "@scrollbar", sb->widget.name, NULL, "line-style", "solid");
const char *line_style = rofi_theme_get_string ( "@separator", sb->widget.name, NULL, "line-style", "solid");
separator_set_line_style_from_string ( sb, line_style );
return sb;
}