Revision: 1641 http://svn.sourceforge.net/geany/?rev=1641&view=rev Author: eht16 Date: 2007-06-26 08:41:27 -0700 (Tue, 26 Jun 2007)
Log Message: ----------- Add option to set a default encoding when opening files and disable auto detection of the file encoding.
Modified Paths: -------------- trunk/ChangeLog trunk/geany.glade trunk/src/document.c trunk/src/editor.h trunk/src/interface.c trunk/src/keyfile.c trunk/src/prefs.c
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/ChangeLog 2007-06-26 15:41:27 UTC (rev 1641) @@ -1,3 +1,11 @@ +2007-06-26 Enrico Tröger enrico.troeger@uvena.de + + * geany.glade, src/document.c, src/editor.h, src/interface.c, + src/keyfile.c, src/prefs.c: + Add option to set a default encoding when opening files and disable + auto detection of the file encoding. + + 2007-06-25 Enrico Tröger enrico.troeger@uvena.de
* src/main.c: Use setlocale to enable translation of strings before
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/geany.glade 2007-06-26 15:41:27 UTC (rev 1641) @@ -4970,16 +4970,41 @@ <child> <widget class="GtkTable" id="table5"> <property name="visible">True</property> - <property name="n_rows">2</property> + <property name="n_rows">4</property> <property name="n_columns">2</property> <property name="homogeneous">False</property> <property name="row_spacing">3</property> <property name="column_spacing">25</property>
<child> - <widget class="GtkLabel" id="label116"> + <widget class="GtkEventBox" id="eventbox1"> <property name="visible">True</property> - <property name="label" translatable="yes">Tab Width:</property> + <property name="tooltip" translatable="yes">Sets the default encoding for newly created files.</property> + <property name="visible_window">True</property> + <property name="above_child">False</property> + + <child> + <widget class="GtkComboBox" id="combo_new_encoding"> + <property name="visible">True</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label153"> + <property name="visible">True</property> + <property name="label" translatable="yes">Default encoding (new files):</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> @@ -4997,35 +5022,38 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child>
<child> - <widget class="GtkEventBox" id="eventbox1"> + <widget class="GtkLabel" id="label116"> <property name="visible">True</property> - <property name="tooltip" translatable="yes">Sets the default encoding for newly created files.</property> - <property name="visible_window">True</property> - <property name="above_child">False</property> - - <child> - <widget class="GtkComboBox" id="combo_encoding"> - <property name="visible">True</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> - </widget> - </child> + <property name="label" translatable="yes">Tab Width:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> </widget> <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> </packing> </child>
@@ -5045,23 +5073,22 @@ <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> + <property name="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="y_options"></property> </packing> </child>
<child> - <widget class="GtkLabel" id="label153"> + <widget class="GtkLabel" id="label_open_encoding"> <property name="visible">True</property> - <property name="label" translatable="yes">Default encoding:</property> + <property name="label" translatable="yes">Default encoding (existing files):</property> <property name="use_underline">False</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property> <property name="selectable">False</property> - <property name="xalign">0.5</property> + <property name="xalign">0</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> @@ -5073,12 +5100,59 @@ <packing> <property name="left_attach">0</property> <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> + + <child> + <widget class="GtkCheckButton" id="check_open_encoding"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed).</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Use fixed encoding when opening files</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">False</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkEventBox" id="eventbox3"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Sets the default encoding for opening existing files.</property> + <property name="visible_window">True</property> + <property name="above_child">False</property> + + <child> + <widget class="GtkComboBox" id="combo_open_encoding"> + <property name="visible">True</property> + <property name="add_tearoffs">False</property> + <property name="focus_on_click">True</property> + </widget> + </child> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options">fill</property> + </packing> + </child> </widget> <packing> <property name="padding">0</property>
Modified: trunk/src/document.c =================================================================== --- trunk/src/document.c 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/src/document.c 2007-06-26 15:41:27 UTC (rev 1641) @@ -442,7 +442,7 @@ sci_set_undo_collection(doc_list[idx].sci, TRUE); sci_empty_undo_buffer(doc_list[idx].sci);
- doc_list[idx].encoding = g_strdup(encodings[editor_prefs.default_encoding].charset); + doc_list[idx].encoding = g_strdup(encodings[editor_prefs.default_new_encoding].charset); // store the opened encoding for undo/redo store_saved_encoding(idx);
@@ -783,6 +783,10 @@ } }
+ // if default encoding for opening files is set, use it if no forced encoding is set + if (editor_prefs.default_open_encoding >= 0 && forced_enc == NULL) + forced_enc = encodings[editor_prefs.default_open_encoding].charset; + if (! load_text_file(locale_filename, utf8_filename, &filedata, forced_enc)) { g_free(utf8_filename);
Modified: trunk/src/editor.h =================================================================== --- trunk/src/editor.h 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/src/editor.h 2007-06-26 15:41:27 UTC (rev 1641) @@ -61,7 +61,8 @@ gint tab_width; gint caret_blink_time; gboolean use_tabs; - gint default_encoding; + gint default_new_encoding; + gint default_open_encoding; gboolean new_line; gboolean replace_tabs; gboolean trail_space;
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/src/interface.c 2007-06-26 15:41:27 UTC (rev 1641) @@ -2535,12 +2535,16 @@ GtkWidget *alignment7; GtkWidget *vbox8; GtkWidget *table5; + GtkWidget *eventbox1; + GtkWidget *combo_new_encoding; + GtkWidget *label153; GtkWidget *label116; - GtkWidget *eventbox1; - GtkWidget *combo_encoding; GtkObject *spin_tab_width_adj; GtkWidget *spin_tab_width; - GtkWidget *label153; + GtkWidget *label_open_encoding; + GtkWidget *check_open_encoding; + GtkWidget *eventbox3; + GtkWidget *combo_open_encoding; GtkWidget *label109; GtkWidget *frame2; GtkWidget *alignment3; @@ -3301,19 +3305,12 @@ gtk_widget_show (vbox8); gtk_container_add (GTK_CONTAINER (alignment7), vbox8);
- table5 = gtk_table_new (2, 2, FALSE); + table5 = gtk_table_new (4, 2, FALSE); gtk_widget_show (table5); gtk_box_pack_start (GTK_BOX (vbox8), table5, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table5), 3); gtk_table_set_col_spacings (GTK_TABLE (table5), 25);
- label116 = gtk_label_new (_("Tab Width:")); - gtk_widget_show (label116); - gtk_table_attach (GTK_TABLE (table5), label116, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), - (GtkAttachOptions) (0), 0, 0); - gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5); - eventbox1 = gtk_event_box_new (); gtk_widget_show (eventbox1); gtk_table_attach (GTK_TABLE (table5), eventbox1, 1, 2, 0, 1, @@ -3321,27 +3318,61 @@ (GtkAttachOptions) (GTK_FILL), 0, 0); gtk_tooltips_set_tip (tooltips, eventbox1, _("Sets the default encoding for newly created files."), NULL);
- combo_encoding = gtk_combo_box_new_text (); - gtk_widget_show (combo_encoding); - gtk_container_add (GTK_CONTAINER (eventbox1), combo_encoding); + combo_new_encoding = gtk_combo_box_new_text (); + gtk_widget_show (combo_new_encoding); + gtk_container_add (GTK_CONTAINER (eventbox1), combo_new_encoding);
+ label153 = gtk_label_new (_("Default encoding (new files):")); + gtk_widget_show (label153); + gtk_table_attach (GTK_TABLE (table5), label153, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label153), 0, 0.5); + + label116 = gtk_label_new (_("Tab Width:")); + gtk_widget_show (label116); + gtk_table_attach (GTK_TABLE (table5), label116, 0, 1, 3, 4, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label116), 0, 0.5); + spin_tab_width_adj = gtk_adjustment_new (-1, 1, 99, 1, 10, 10); spin_tab_width = gtk_spin_button_new (GTK_ADJUSTMENT (spin_tab_width_adj), 1, 0); gtk_widget_show (spin_tab_width); - gtk_table_attach (GTK_TABLE (table5), spin_tab_width, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_FILL), + gtk_table_attach (GTK_TABLE (table5), spin_tab_width, 1, 2, 3, 4, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_tooltips_set_tip (tooltips, spin_tab_width, _("The width in chars, which one tab character will take"), NULL); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (spin_tab_width), TRUE); gtk_spin_button_set_update_policy (GTK_SPIN_BUTTON (spin_tab_width), GTK_UPDATE_IF_VALID); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (spin_tab_width), TRUE);
- label153 = gtk_label_new (_("Default encoding:")); - gtk_widget_show (label153); - gtk_table_attach (GTK_TABLE (table5), label153, 0, 1, 0, 1, + label_open_encoding = gtk_label_new (_("Default encoding (existing files):")); + gtk_widget_show (label_open_encoding); + gtk_table_attach (GTK_TABLE (table5), label_open_encoding, 0, 1, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); + gtk_misc_set_alignment (GTK_MISC (label_open_encoding), 0, 0.5);
+ check_open_encoding = gtk_check_button_new_with_mnemonic (_("Use fixed encoding when opening files")); + gtk_widget_show (check_open_encoding); + gtk_table_attach (GTK_TABLE (table5), check_open_encoding, 0, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_tooltips_set_tip (tooltips, check_open_encoding, _("This option disables the automatic detection of the file encoding when opening files and opens the file with the specified encoding (usually not needed)."), NULL); + gtk_button_set_focus_on_click (GTK_BUTTON (check_open_encoding), FALSE); + + eventbox3 = gtk_event_box_new (); + gtk_widget_show (eventbox3); + gtk_table_attach (GTK_TABLE (table5), eventbox3, 1, 2, 2, 3, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (GTK_FILL), 0, 0); + gtk_tooltips_set_tip (tooltips, eventbox3, _("Sets the default encoding for opening existing files."), NULL); + + combo_open_encoding = gtk_combo_box_new_text (); + gtk_widget_show (combo_open_encoding); + gtk_container_add (GTK_CONTAINER (eventbox3), combo_open_encoding); + label109 = gtk_label_new (_("<b>New files</b>")); gtk_widget_show (label109); gtk_frame_set_label_widget (GTK_FRAME (frame6), label109); @@ -4169,11 +4200,15 @@ GLADE_HOOKUP_OBJECT (prefs_dialog, alignment7, "alignment7"); GLADE_HOOKUP_OBJECT (prefs_dialog, vbox8, "vbox8"); GLADE_HOOKUP_OBJECT (prefs_dialog, table5, "table5"); + GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox1, "eventbox1"); + GLADE_HOOKUP_OBJECT (prefs_dialog, combo_new_encoding, "combo_new_encoding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, label153, "label153"); GLADE_HOOKUP_OBJECT (prefs_dialog, label116, "label116"); - GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox1, "eventbox1"); - GLADE_HOOKUP_OBJECT (prefs_dialog, combo_encoding, "combo_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, spin_tab_width, "spin_tab_width"); - GLADE_HOOKUP_OBJECT (prefs_dialog, label153, "label153"); + GLADE_HOOKUP_OBJECT (prefs_dialog, label_open_encoding, "label_open_encoding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, check_open_encoding, "check_open_encoding"); + GLADE_HOOKUP_OBJECT (prefs_dialog, eventbox3, "eventbox3"); + GLADE_HOOKUP_OBJECT (prefs_dialog, combo_open_encoding, "combo_open_encoding"); GLADE_HOOKUP_OBJECT (prefs_dialog, label109, "label109"); GLADE_HOOKUP_OBJECT (prefs_dialog, frame2, "frame2"); GLADE_HOOKUP_OBJECT (prefs_dialog, alignment3, "alignment3");
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/src/keyfile.c 2007-06-26 15:41:27 UTC (rev 1641) @@ -268,7 +268,11 @@ g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", editor_prefs.replace_tabs); g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", editor_prefs.trail_space); g_key_file_set_boolean(config, PACKAGE, "pref_editor_disable_dnd", editor_prefs.disable_dnd); - g_key_file_set_string(config, PACKAGE, "pref_editor_default_encoding", encodings[editor_prefs.default_encoding].charset); + g_key_file_set_string(config, PACKAGE, "pref_editor_default_new_encoding", encodings[editor_prefs.default_new_encoding].charset); + if (editor_prefs.default_open_encoding == -1) + g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", "none"); + else + g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", encodings[editor_prefs.default_open_encoding].charset); g_key_file_set_string(config, PACKAGE, "pref_template_developer", app->pref_template_developer); g_key_file_set_string(config, PACKAGE, "pref_template_company", app->pref_template_company); g_key_file_set_string(config, PACKAGE, "pref_template_mail", app->pref_template_mail); @@ -443,20 +447,31 @@
editor_prefs.tab_width = utils_get_setting_integer(config, PACKAGE, "pref_editor_tab_width", 4); editor_prefs.use_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_use_tabs", TRUE); - // use current locale encoding as default for new files (should be in most cases UTF-8) + // use current locale encoding as default for new files (should be UTF-8 in most cases) g_get_charset(&default_charset); - tmp_string = utils_get_setting_string(config, PACKAGE, "pref_editor_default_encoding", + tmp_string = utils_get_setting_string(config, PACKAGE, "pref_editor_default_new_encoding", default_charset); if (tmp_string) { const GeanyEncoding *enc = encodings_get_from_charset(tmp_string); if (enc != NULL) - editor_prefs.default_encoding = enc->idx; + editor_prefs.default_new_encoding = enc->idx; else - editor_prefs.default_encoding = GEANY_ENCODING_UTF_8; + editor_prefs.default_new_encoding = GEANY_ENCODING_UTF_8;
g_free(tmp_string); } + tmp_string = utils_get_setting_string(config, PACKAGE, "pref_editor_default_open_encoding", "none"); + if (tmp_string) + { + const GeanyEncoding *enc = encodings_get_from_charset(tmp_string); + if (enc != NULL) + editor_prefs.default_open_encoding = enc->idx; + else + editor_prefs.default_open_encoding = -1; + + g_free(tmp_string); + } app->pref_main_confirm_exit = utils_get_setting_boolean(config, PACKAGE, "pref_main_confirm_exit", FALSE); app->pref_main_suppress_search_dialogs = utils_get_setting_boolean(config, PACKAGE, "pref_main_suppress_search_dialogs", FALSE); app->pref_main_load_session = utils_get_setting_boolean(config, PACKAGE, "pref_main_load_session", TRUE);
Modified: trunk/src/prefs.c =================================================================== --- trunk/src/prefs.c 2007-06-25 17:49:45 UTC (rev 1640) +++ trunk/src/prefs.c 2007-06-26 15:41:27 UTC (rev 1641) @@ -70,6 +70,7 @@ static void on_show_notebook_tabs_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_use_folding_toggled(GtkToggleButton *togglebutton, gpointer user_data); static void on_symbol_auto_completion_toggled(GtkToggleButton *togglebutton, gpointer user_data); +static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data);
void prefs_init_dialog(void) @@ -231,10 +232,23 @@ widget = lookup_widget(app->prefs_dialog, "spin_tab_width"); gtk_spin_button_set_value(GTK_SPIN_BUTTON(widget), editor_prefs.tab_width);
- widget = lookup_widget(app->prefs_dialog, "combo_encoding"); + widget = lookup_widget(app->prefs_dialog, "combo_new_encoding"); // luckily the index of the combo box items match the index of the encodings array - gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.default_encoding); + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.default_new_encoding);
+ widget = lookup_widget(app->prefs_dialog, "check_open_encoding"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), + (editor_prefs.default_open_encoding >= 0) ? TRUE : FALSE); + on_open_encoding_toggled(GTK_TOGGLE_BUTTON(widget), NULL); + + widget = lookup_widget(app->prefs_dialog, "combo_open_encoding"); + if (editor_prefs.default_open_encoding >= 0) + { + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), editor_prefs.default_open_encoding); + } + else + gtk_combo_box_set_active(GTK_COMBO_BOX(widget), GEANY_ENCODING_UTF_8); + widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces"); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), editor_prefs.trail_space);
@@ -561,9 +575,18 @@ widget = lookup_widget(app->prefs_dialog, "spin_tab_width"); editor_prefs.tab_width = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(widget));
- widget = lookup_widget(app->prefs_dialog, "combo_encoding"); - editor_prefs.default_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); + widget = lookup_widget(app->prefs_dialog, "combo_new_encoding"); + editor_prefs.default_new_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget));
+ widget = lookup_widget(app->prefs_dialog, "check_open_encoding"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) + { + widget = lookup_widget(app->prefs_dialog, "combo_open_encoding"); + editor_prefs.default_open_encoding = gtk_combo_box_get_active(GTK_COMBO_BOX(widget)); + } + else + editor_prefs.default_open_encoding = -1; + widget = lookup_widget(app->prefs_dialog, "check_trailing_spaces"); editor_prefs.trail_space = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -1018,11 +1041,20 @@ }
+static void on_open_encoding_toggled(GtkToggleButton *togglebutton, gpointer user_data) +{ + gboolean sens = gtk_toggle_button_get_active(togglebutton); + + gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "eventbox3"), sens); + gtk_widget_set_sensitive(lookup_widget(app->prefs_dialog, "label_open_encoding"), sens); +} + + void prefs_show_dialog(void) { if (app->prefs_dialog == NULL) { - GtkWidget *combo; + GtkWidget *combo_new, *combo_open; guint i; gchar *encoding_string;
@@ -1031,12 +1063,15 @@ gtk_window_set_transient_for(GTK_WINDOW(app->prefs_dialog), GTK_WINDOW(app->window));
// init the default file encoding combo box - combo = lookup_widget(app->prefs_dialog, "combo_encoding"); - gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 3); + combo_new = lookup_widget(app->prefs_dialog, "combo_new_encoding"); + combo_open = lookup_widget(app->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); for (i = 0; i < GEANY_ENCODINGS_MAX; i++) { encoding_string = encodings_to_string(&encodings[i]); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), encoding_string); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_new), encoding_string); + gtk_combo_box_append_text(GTK_COMBO_BOX(combo_open), encoding_string); g_free(encoding_string); }
@@ -1080,6 +1115,8 @@ "toggled", G_CALLBACK(on_use_folding_toggled), NULL); g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "check_symbol_auto_completion"), "toggled", G_CALLBACK(on_symbol_auto_completion_toggled), NULL); + g_signal_connect((gpointer) lookup_widget(app->prefs_dialog, "check_open_encoding"), + "toggled", G_CALLBACK(on_open_encoding_toggled), NULL); }
prefs_init_dialog();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.