Branch: refs/heads/document-messages Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Fri, 20 Jan 2012 18:28:35 Commit: 7f16b9a4fb3af08239c928df3e634abd6af9ff16 https://github.com/geany/geany/commit/7f16b9a4fb3af08239c928df3e634abd6af9ff...
Log Message: ----------- Fix content of encodings and EOL style prefs ComboBoxes (oops)
I broke them in ca922e0ddc8022283ec3c1f49aaa15ab7c5ba213
Now the two encoding combo boxes shares the same data, which is built only once.
Modified Paths: -------------- data/geany.glade src/prefs.c
Modified: data/geany.glade 14 files changed, 10 insertions(+), 4 deletions(-) =================================================================== @@ -440,7 +440,13 @@ </object> </child> </object> - <object class="GtkListStore" id="empty_chararray_list"> + <object class="GtkListStore" id="encoding_list"> + <columns> + <!-- column-name text --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkListStore" id="eol_list"> <columns> <!-- column-name text --> <column type="gchararray"/> @@ -4157,7 +4163,7 @@ <object class="GtkComboBox" id="combo_eol"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">empty_chararray_list</property> + <property name="model">eol_list</property> <child> <object class="GtkCellRendererText" id="cellrenderertext5"/> <attributes> @@ -4259,7 +4265,7 @@ <object class="GtkComboBox" id="combo_new_encoding"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">empty_chararray_list</property> + <property name="model">encoding_list</property> <child> <object class="GtkCellRendererText" id="cellrenderertext6"/> <attributes> @@ -4325,7 +4331,7 @@ <object class="GtkComboBox" id="combo_open_encoding"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">empty_chararray_list</property> + <property name="model">encoding_list</property> <child> <object class="GtkCellRendererText" id="cellrenderertext7"/> <attributes>
Modified: src/prefs.c 26 files changed, 18 insertions(+), 8 deletions(-) =================================================================== @@ -1589,11 +1589,21 @@ static gboolean prefs_dialog_key_press_response_cb(GtkWidget *dialog, GdkEventKe }
+static void list_store_append_text(GtkListStore *list, const gchar *text) +{ + GtkTreeIter iter; + + gtk_list_store_append(list, &iter); + gtk_list_store_set(list, &iter, 0, text, -1); +} + + void prefs_show_dialog(void) { if (ui_widgets.prefs_dialog == NULL) { - GtkWidget *combo_new, *combo_open, *combo_eol; + GtkWidget *combo_new, *combo_open; + GtkListStore *encoding_list, *eol_list; GtkWidget *label; guint i; gchar *encoding_string; @@ -1606,24 +1616,24 @@ void prefs_show_dialog(void) gtk_window_set_icon(GTK_WINDOW(ui_widgets.prefs_dialog), pb); g_object_unref(pb); /* free our reference */
- /* init the default file encoding combo box */ + /* init the file encoding combo boxes */ combo_new = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_new_encoding"); combo_open = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_open_encoding"); gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo_new), 3); gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo_open), 3); + encoding_list = ui_builder_get_object("encoding_list"); for (i = 0; i < GEANY_ENCODINGS_MAX; i++) { encoding_string = encodings_to_string(&encodings[i]); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_new), encoding_string); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_open), encoding_string); + list_store_append_text(encoding_list, encoding_string); g_free(encoding_string); }
/* init the eol character combo box */ - combo_eol = ui_lookup_widget(ui_widgets.prefs_dialog, "combo_eol"); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_CRLF)); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_CR)); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo_eol), utils_get_eol_name(SC_EOL_LF)); + eol_list = ui_builder_get_object("eol_list"); + list_store_append_text(eol_list, utils_get_eol_name(SC_EOL_CRLF)); + 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));
/* add manually GeanyWrapLabels because they can't be added with Glade */ /* page Tools */
@@ Diff output truncated at 100000 characters. @@
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: TBD).