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
This commit is contained in:
Colomban Wendling 2014-01-17 18:26:23 +01:00
parent 5975931be8
commit 7c6f48e4f5
3 changed files with 9 additions and 4 deletions

View File

@ -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 File

@ -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 */

View File

@ -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."));