Permalink
Browse files

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
  • Loading branch information...
1 parent 5975931 commit 7c6f48e4f56999eef6e5f29b4106c3e1d05ffe47 @b4n b4n committed Jan 17, 2014
Showing with 9 additions and 4 deletions.
  1. +0 −2 data/geany.glade
  2. +1 −1 src/dialogs.c
  3. +8 −1 src/prefs.c
View
@@ -4369,7 +4369,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">encoding_list</property>
- <property name="wrap_width">3</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext6"/>
<attributes>
@@ -4436,7 +4435,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">encoding_list</property>
- <property name="wrap_width">3</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext7"/>
<attributes>
View
@@ -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);
@codebrainz

codebrainz Jan 18, 2014

Owner

It's funny how one little re-ordering of a line of code can save someone (me) minutes a day :) Thanks!

@b4n

b4n Jan 18, 2014

Owner

See, life is sometimes simple when you know the source ;)

gtk_combo_box_set_active(GTK_COMBO_BOX(filetype_combo), 0);
/* fill encoding combo box */
View
@@ -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."));

0 comments on commit 7c6f48e

Please sign in to comment.