diff --git a/include/widgets/listview.h b/include/widgets/listview.h index 1b89902a..fbc1aff7 100644 --- a/include/widgets/listview.h +++ b/include/widgets/listview.h @@ -46,10 +46,11 @@ typedef void ( *listview_mouse_activated_cb )( listview *, xcb_button_press_even * @param cb The update callback. * @param udata The user data to pass to the callback * @param eh The height of one element + * @param reverse Reverse the listview order. * * @returns a new listview */ -listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh ); +listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ); /** * @param lv The listview handle @@ -184,13 +185,6 @@ void listview_set_num_lines ( listview *lv, unsigned int num_lines ); */ void listview_set_max_lines ( listview *lv, unsigned int max_lines ); -/** - * @param lv Handler to the listview object. - * @param reverse Reverse the listview order. - * - * Set reversing the listview. - */ -void listview_reverse ( listview *lv, gboolean reverse ); /* @} */ #endif // ROFI_LISTVIEW_H diff --git a/source/view.c b/source/view.c index d207a3c1..6ec5b0b7 100644 --- a/source/view.c +++ b/source/view.c @@ -1505,10 +1505,7 @@ RofiViewState *rofi_view_create ( Mode *sw, state->overlay = textbox_create ( "overlay.textbox", TB_AUTOWIDTH|TB_AUTOHEIGHT, URGENT, "blaat" ); widget_disable ( WIDGET ( state->overlay ) ); - state->list_view = listview_create ( "listview", update_callback, state, config.element_height ); - if ( end ){ - listview_reverse ( state->list_view, TRUE ); - } + state->list_view = listview_create ( "listview", update_callback, state, config.element_height, end ); // Set configuration listview_set_multi_select ( state->list_view, ( state->menu_flags & MENU_INDICATOR ) == MENU_INDICATOR ); listview_set_scroll_type ( state->list_view, config.scroll_method ); diff --git a/source/widgets/box.c b/source/widgets/box.c index e485c5e4..72c52ff9 100644 --- a/source/widgets/box.c +++ b/source/widgets/box.c @@ -282,8 +282,8 @@ void box_add ( box *box, widget *child, gboolean expand, gboolean end ) height = MAX (height, child->h+widget_padding_get_padding_height ( WIDGET ( box ))); box->widget.h = height; } - child->expand = expand; - child->end = end; + child->expand = rofi_theme_get_boolean ( child->class_name, child->name, child->state, "expand", expand); + child->end = rofi_theme_get_boolean ( child->class_name, child->name, child->state, "end", end); child->parent = WIDGET ( box ); box->children = g_list_append ( box->children, (void *) child ); widget_update ( WIDGET ( box ) ); diff --git a/source/widgets/listview.c b/source/widgets/listview.c index 41551a80..604139e5 100644 --- a/source/widgets/listview.c +++ b/source/widgets/listview.c @@ -336,7 +336,7 @@ static gboolean listview_motion_notify ( widget *wid, xcb_motion_notify_event_t return FALSE; } -listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh ) +listview *listview_create ( const char *name, listview_update_callback cb, void *udata, unsigned int eh, gboolean reverse ) { listview *lv = g_malloc0 ( sizeof ( listview ) ); @@ -371,6 +371,7 @@ listview *listview_create ( const char *name, listview_update_callback cb, void lv->fixed_num_lines = rofi_theme_get_boolean (lv->widget.class_name, lv->widget.name, NULL, "fixed-height", config.fixed_num_lines ); lv->dynamic = rofi_theme_get_boolean (lv->widget.class_name, lv->widget.name, NULL, "dynamic", TRUE ); + lv->reverse = rofi_theme_get_boolean (lv->widget.class_name, lv->widget.name, NULL, "reverse", reverse ); listview_set_show_scrollbar ( lv, rofi_theme_get_boolean ( lv->widget.class_name, lv->widget.name, NULL, "scrollbar", !config.hide_scrollbar )); listview_set_scrollbar_width ( lv, rofi_theme_get_integer ( lv->widget.class_name, lv->widget.name, NULL, "scrollbar-width", config.scrollbar_width )); lv->cycle = rofi_theme_get_boolean ( lv->widget.class_name, lv->widget.name, NULL, "cycle", config.cycle ); @@ -580,7 +581,3 @@ void listview_set_max_lines ( listview *lv, unsigned int max_lines ) lv->max_displayed_lines = max_lines; } } -void listview_reverse ( listview *lv, gboolean reverse ) -{ - lv->reverse = reverse; -}