Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/widget_builder.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ void wofi_widget_builder_insert_image_with_list(struct widget_builder* builder,
cairo_surface_destroy(surface);
gtk_container_add(GTK_CONTAINER(builder->box), img);
gtk_widget_set_name(img, "img");
gtk_widget_set_size_request(img, wofi_get_image_size(), wofi_get_image_size());

GtkStyleContext* ctx = gtk_widget_get_style_context(img);

Expand Down
17 changes: 15 additions & 2 deletions src/wofi.c
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
{
GtkWidget* label = gtk_label_new(data1);
gtk_widget_set_name(label, "text");
gtk_label_set_max_width_chars(GTK_LABEL(label), 18);
gtk_widget_set_size_request(GTK_WIDGET(label), 180, -1);
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
if(line_wrap >= 0)
Expand Down Expand Up @@ -433,6 +436,9 @@ static char* parse_images(WofiPropertyBox* box, const char* text, bool create_wi
free(filename);

gtk_widget_set_name(label, "text");
gtk_label_set_max_width_chars(GTK_LABEL(label), 18);
gtk_widget_set_size_request(GTK_WIDGET(label), 180, -1);
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
if(line_wrap >= 0)
Expand Down Expand Up @@ -577,6 +583,9 @@ static GtkWidget* create_label(char* mode, char* text, char* search_text, char*
} else {
GtkWidget* label = gtk_label_new(text);
gtk_widget_set_name(label, "text");
gtk_label_set_max_width_chars(GTK_LABEL(label), 18);
gtk_widget_set_size_request(GTK_WIDGET(label), 180, -1);
gtk_label_set_ellipsize(GTK_LABEL(label), PANGO_ELLIPSIZE_END);
gtk_label_set_use_markup(GTK_LABEL(label), allow_markup);
gtk_label_set_xalign(GTK_LABEL(label), 0);
if(line_wrap >= 0) {
Expand Down Expand Up @@ -757,6 +766,9 @@ static gboolean _insert_widget(gpointer data) {
gtk_widget_set_halign(parent, content_halign);
GtkWidget* child = gtk_flow_box_child_new();
gtk_widget_set_name(child, "entry");
if(columns > 0 && width > columns * 16) {
gtk_widget_set_size_request(child, (width - columns * 16) / columns, -1);
}
g_signal_connect(child, "size-allocate", G_CALLBACK(widget_allocate), NULL);

gtk_container_add(GTK_CONTAINER(child), parent);
Expand Down Expand Up @@ -1851,7 +1863,6 @@ void wofi_init(struct map* _config) {
y = map_get(config, "y");
bool normal_window = strcmp(config_get(config, "normal_window", "false"), "true") == 0;
char* mode = map_get(config, "mode");
GtkOrientation orientation = config_get_mnemonic(config, "orientation", "vertical", 2, "vertical", "horizontal");
outer_orientation = config_get_mnemonic(config, "orientation", "vertical", 2, "horizontal", "vertical");
GtkAlign halign = config_get_mnemonic(config, "halign", "fill", 4, "fill", "start", "end", "center");
content_halign = config_get_mnemonic(config, "content_halign", "fill", 4, "fill", "start", "end", "center");
Expand Down Expand Up @@ -2163,8 +2174,10 @@ void wofi_init(struct map* _config) {

inner_box = gtk_flow_box_new();
gtk_flow_box_set_selection_mode(GTK_FLOW_BOX(inner_box), GTK_SELECTION_BROWSE);
gtk_flow_box_set_homogeneous(GTK_FLOW_BOX(inner_box), TRUE);
gtk_flow_box_set_max_children_per_line(GTK_FLOW_BOX(inner_box), columns);
gtk_orientable_set_orientation(GTK_ORIENTABLE(inner_box), orientation);
gtk_flow_box_set_min_children_per_line(GTK_FLOW_BOX(inner_box), columns);
gtk_orientable_set_orientation(GTK_ORIENTABLE(inner_box), outer_orientation == GTK_ORIENTATION_VERTICAL ? GTK_ORIENTATION_HORIZONTAL : GTK_ORIENTATION_VERTICAL);
gtk_widget_set_halign(inner_box, halign);
gtk_widget_set_valign(inner_box, valign);

Expand Down