line_wrap now takes the wrapping mode instead of a boolean

This commit is contained in:
Scoopta
2020-02-21 00:43:44 -08:00
parent 33a69e713a
commit a1beb82635
2 changed files with 12 additions and 6 deletions

View File

@@ -70,7 +70,7 @@ static uint16_t widget_count = 0;
static enum sort_order sort_order;
static int64_t min_height = INT64_MAX;
static uint64_t lines;
static bool line_wrap;
static int8_t line_wrap;
static char* key_up, *key_down, *key_left, *key_right, *key_forward, *key_backward, *key_submit, *key_exit;
static char* mod_up, *mod_down, *mod_left, *mod_right, *mod_forward, *mod_backward, *mod_exit;
@@ -268,7 +268,10 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
gtk_widget_set_name(label, "text");
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
gtk_label_set_line_wrap(GTK_LABEL(label), line_wrap);
if(line_wrap >= 0) {
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_line_wrap_mode(GTK_LABEL(label), line_wrap);
}
gtk_container_add(GTK_CONTAINER(box), label);
} else {
char* tmp = ret;
@@ -321,7 +324,10 @@ static GtkWidget* create_label(char* mode, char* text, char* search_text, char*
gtk_widget_set_name(label, "text");
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
gtk_label_set_line_wrap(GTK_LABEL(label), line_wrap);
if(line_wrap >= 0) {
gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
gtk_label_set_line_wrap_mode(GTK_LABEL(label), line_wrap);
}
gtk_container_add(GTK_CONTAINER(box), label);
}
if(parse_search) {
@@ -1214,7 +1220,7 @@ void wofi_init(struct map* _config) {
lines = strtol(config_get(config, "lines", "0"), NULL, 10);
columns = strtol(config_get(config, "columns", "1"), NULL, 10);
sort_order = config_get_mnemonic(config, "sort_order", "default", 2, "default", "alphabetical");
line_wrap = strcmp(config_get(config, "line_wrap", "false"), "true") == 0;
line_wrap = config_get_mnemonic(config, "line_wrap", "off", 4, "off", "word", "char", "word_char") - 1;
key_up = config_get(config, "key_up", "Up");
key_down = config_get(config, "key_down", "Down");