From 7c6f48e4f56999eef6e5f29b4106c3e1d05ffe47 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 17 Jan 2014 18:26:23 +0100 Subject: [PATCH] Workaround a slowness in multi-column combo boxes under GTK3 Always set the combo boxes' wrap-width after their models are fully filled to work around dramatic slowness described in GTK bug https://bugzilla.gnome.org/show_bug.cgi?id=722388 --- data/geany.glade | 2 -- src/dialogs.c | 2 +- src/prefs.c | 9 ++++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/data/geany.glade b/data/geany.glade index 10f64eb5..d2c44f72 100644 --- a/data/geany.glade +++ b/data/geany.glade @@ -4369,7 +4369,6 @@ True False encoding_list - 3 @@ -4436,7 +4435,6 @@ True False encoding_list - 3 diff --git a/src/dialogs.c b/src/dialogs.c index e1074760..02976e7d 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -321,7 +321,6 @@ static GtkWidget *add_file_open_extra_widget(GtkWidget *dialog) /* the ebox is for the tooltip, because gtk_combo_box can't show tooltips */ filetype_ebox = gtk_event_box_new(); filetype_combo = gtk_combo_box_text_new(); - gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(filetype_combo), 2); gtk_widget_set_tooltip_text(filetype_ebox, _("Explicitly defines a filetype for the file, if it would not be detected by filename extension.\nNote if you choose multiple files, they will all be opened with the chosen filetype.")); gtk_container_add(GTK_CONTAINER(filetype_ebox), filetype_combo); @@ -394,6 +393,7 @@ static GtkWidget *create_open_file_dialog(void) gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(filetype_combo), ft->title); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog), filetypes_create_file_filter(ft)); } + gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(filetype_combo), 3); gtk_combo_box_set_active(GTK_COMBO_BOX(filetype_combo), 0); /* fill encoding combo box */ diff --git a/src/prefs.c b/src/prefs.c index 14d00beb..6b7ad8a1 100644 --- a/src/prefs.c +++ b/src/prefs.c @@ -1664,7 +1664,7 @@ void prefs_show_dialog(void) if (ui_widgets.prefs_dialog == NULL) { GtkListStore *encoding_list, *eol_list; - GtkWidget *label; + GtkWidget *label, *widget; guint i; gchar *encoding_string; @@ -1687,6 +1687,13 @@ void prefs_show_dialog(void) list_store_append_text(eol_list, utils_get_eol_name(SC_EOL_CR)); list_store_append_text(eol_list, utils_get_eol_name(SC_EOL_LF)); + /* wet combo box wrap width after having filled the encoding to workaround + * GTK bug https://bugzilla.gnome.org/show_bug.cgi?id=722388 */ + widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding"); + gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(widget), 3); + widget = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding"); + gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(widget), 3); + /* add manually GeanyWrapLabels because they can't be added with Glade */ /* page Tools */ label = geany_wrap_label_new(_("Enter tool paths below. Tools you do not need can be left blank."));