summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2017-06-07 07:53:33 +0200
committerDave Davenport <qball@gmpclient.org>2017-06-07 07:53:33 +0200
commit07076d154a02a76e866cb00e14c8ec1837494451 (patch)
tree81db9f2c8f76be67ed517bf3dc458098e6005fcb
parentd33edaf09d53a9502959fefa69e075c998a9a1d6 (diff)
Load theme-str after loading fallback themes.
* If no theme loaded, try converting old theme. * If still no theme loaded, try default theme. * Then load modifications (theme-str option)
-rw-r--r--source/rofi.c26
-rw-r--r--source/theme.c12
-rw-r--r--source/widgets/textbox.c6
3 files changed, 25 insertions, 19 deletions
diff --git a/source/rofi.c b/source/rofi.c
index 07639164..0a6207ec 100644
--- a/source/rofi.c
+++ b/source/rofi.c
@@ -838,16 +838,10 @@ int main ( int argc, char *argv[] )
TICK_N ( "Setup Modi" );
}
- const char ** theme_str = find_arg_strv ( "-theme-str" );
- if ( theme_str ) {
- for ( int index = 0; theme_str && theme_str[index]; index++ ) {
- if ( rofi_theme_parse_string ( theme_str[index] ) ) {
- rofi_theme_free ( rofi_theme );
- rofi_theme = NULL;
- }
- }
- g_free ( theme_str );
+ if ( rofi_theme_is_empty ( ) ) {
+ rofi_theme_convert_old ();
}
+
if ( rofi_theme_is_empty ( ) ) {
if ( rofi_theme_parse_string ( default_theme ) ) {
g_warning ( "Failed to parse default theme. Giving up.." );
@@ -862,7 +856,19 @@ int main ( int argc, char *argv[] )
cleanup ();
return EXIT_FAILURE;
}
- rofi_theme_convert_old ();
+ }
+ /**
+ * Make small commandline changes to the current theme.
+ */
+ const char ** theme_str = find_arg_strv ( "-theme-str" );
+ if ( theme_str ) {
+ for ( int index = 0; theme_str && theme_str[index]; index++ ) {
+ if ( rofi_theme_parse_string ( theme_str[index] ) ) {
+ rofi_theme_free ( rofi_theme );
+ rofi_theme = NULL;
+ }
+ }
+ g_free ( theme_str );
}
if ( find_arg ( "-dump-theme" ) >= 0 ) {
diff --git a/source/theme.c b/source/theme.c
index e261c0ee..1b8e7c4e 100644
--- a/source/theme.c
+++ b/source/theme.c
@@ -164,17 +164,17 @@ static void rofi_theme_print_property_index ( size_t pnl, int depth, Property *p
switch ( p->type )
{
case P_LIST:
- printf ("[ ");
+ printf ( "[ " );
for ( GList *iter = p->value.list; iter != NULL; iter = g_list_next ( iter ) ) {
- printf("%s", (char*)(iter->data));
+ printf ( "%s", (char *) ( iter->data ) );
if ( iter->next != NULL ) {
- printf(",");
+ printf ( "," );
}
}
- printf (" ];");
+ printf ( " ];" );
break;
case P_ORIENTATION:
- printf("%s;", (p->value.i == ROFI_ORIENTATION_HORIZONTAL)? "horizontal":"vertical" );
+ printf ( "%s;", ( p->value.i == ROFI_ORIENTATION_HORIZONTAL ) ? "horizontal" : "vertical" );
break;
case P_HIGHLIGHT:
if ( p->value.highlight.style & ROFI_HL_BOLD ) {
@@ -624,7 +624,7 @@ GList *rofi_theme_get_list ( const widget *widget, const char * property, const
Property *p = rofi_theme_find_property ( wid2, P_LIST, property, TRUE );
if ( p ) {
if ( p->type == P_LIST ) {
- return g_list_copy_deep ( p->value.list, (GCopyFunc)g_strdup, NULL );
+ return g_list_copy_deep ( p->value.list, (GCopyFunc) g_strdup, NULL );
}
}
char **r = defaults ? g_strsplit ( defaults, ",", 0 ) : NULL;
diff --git a/source/widgets/textbox.c b/source/widgets/textbox.c
index 87f1a57a..6081176b 100644
--- a/source/widgets/textbox.c
+++ b/source/widgets/textbox.c
@@ -420,7 +420,7 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
int bottom = widget_padding_get_bottom ( WIDGET ( tb ) );
top = ( tb->widget.h - bottom - height - top ) * tb->yalign + top;
}
- y+=top;
+ y += top;
// draw Icon
if ( ( tb->flags & TB_ICON ) == TB_ICON && tb->icon != NULL ) {
@@ -447,8 +447,8 @@ static void textbox_draw ( widget *wid, cairo_t *draw )
}
else if ( tb->flags & TB_CENTER ) {
int tw = textbox_get_font_width ( tb );
- x = ( ( tb->widget.w - tw - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ) / 2;
- x += widget_padding_get_left ( WIDGET (tb) ) ;
+ x = ( ( tb->widget.w - tw - widget_padding_get_padding_width ( WIDGET ( tb ) ) - offset ) ) / 2;
+ x += widget_padding_get_left ( WIDGET ( tb ) );
}
// TODO check if this is still needed after flatning.
cairo_set_operator ( draw, CAIRO_OPERATOR_OVER );