Add 'Ensure consistent line endings' file saving pref (patch by
Manuel Bua, thanks). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5321 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
a274363275
commit
c25d9856fe
@ -4,6 +4,10 @@
|
||||
Move HTML automatic <table> tag completion into a 'table' snippet
|
||||
so the user can decide when to use it (patch by Eugene Arshinov,
|
||||
thanks).
|
||||
* src/interface.c, src/prefs.c, src/about.c, src/keyfile.c,
|
||||
src/document.c, src/document.h, THANKS, geany.glade:
|
||||
Add 'Ensure consistent line endings' file saving pref (patch by
|
||||
Manuel Bua, thanks).
|
||||
|
||||
|
||||
2010-10-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||
|
||||
1
THANKS
1
THANKS
@ -86,6 +86,7 @@ Thomas Huth <th(dot)huth(at)googlemail(dot)com> - Forth filetype
|
||||
Adam Ples <adamples(at)users(dot)sourceforge(dot)net> - Group encodings in open dialog
|
||||
Mário Silva <sharelider(at)gmail(dot)com> - Lisp filetype
|
||||
Taylor Venable <taylor(at)metasyntax(dot)net> - Erlang filetype
|
||||
Manuel Bua <manuel(dot)bua(at)gmail(dot)com> - Ensure consistent line endings pref.
|
||||
|
||||
Translators:
|
||||
------------
|
||||
|
||||
20
geany.glade
20
geany.glade
@ -7855,6 +7855,26 @@ Match braces</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_ensure_convert_new_lines">
|
||||
<property name="visible">True</property>
|
||||
<property name="tooltip" translatable="yes">Ensures that newline characters always get converted before saving, avoiding mixed line endings in the same file</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ensure consistent line endings</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="check_trailing_spaces">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@ -95,7 +95,7 @@ static const gchar *contributors =
|
||||
"Jean-François Wauthy, Jeff Pohlmeyer, Jesse Mayes, Jiří Techet, "
|
||||
"John Gabriele, Jon Senior, Jon Strait, Josef Whiter, "
|
||||
"Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, "
|
||||
"Mário Silva, Marko Peric, Matti Mårds, "
|
||||
"Manuel Bua, Mário Silva, Marko Peric, Matti Mårds, "
|
||||
"Moritz Barsnick, Ondrej Donek, Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, "
|
||||
"Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, "
|
||||
"Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Taylor Venable, "
|
||||
|
||||
@ -1801,6 +1801,9 @@ gboolean document_save_file(GeanyDocument *doc, gboolean force)
|
||||
/* ensure the file has a newline at the end */
|
||||
if (file_prefs.final_new_line)
|
||||
editor_ensure_final_newline(doc->editor);
|
||||
/* ensure newlines are consistent */
|
||||
if (file_prefs.ensure_convert_new_lines)
|
||||
sci_convert_eols(doc->editor->sci, sci_get_eol_mode(doc->editor->sci));
|
||||
|
||||
/* notify plugins which may wish to modify the document before it's saved */
|
||||
g_signal_emit_by_name(geany_object, "document-before-save", doc);
|
||||
|
||||
@ -43,6 +43,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
/** File Prefs. */
|
||||
typedef struct GeanyFilePrefs
|
||||
{
|
||||
gint default_new_encoding;
|
||||
@ -58,6 +59,7 @@ typedef struct GeanyFilePrefs
|
||||
gint disk_check_timeout;
|
||||
gboolean cmdline_new_files; /* New file if command-line filename doesn't exist */
|
||||
gboolean use_safe_file_saving;
|
||||
gboolean ensure_convert_new_lines;
|
||||
}
|
||||
GeanyFilePrefs;
|
||||
|
||||
|
||||
@ -2674,6 +2674,7 @@ create_prefs_dialog (void)
|
||||
GtkWidget *alignment3;
|
||||
GtkWidget *vbox6;
|
||||
GtkWidget *check_new_line;
|
||||
GtkWidget *check_ensure_convert_new_lines;
|
||||
GtkWidget *check_trailing_spaces;
|
||||
GtkWidget *check_replace_tabs;
|
||||
GtkWidget *label19;
|
||||
@ -4280,6 +4281,11 @@ create_prefs_dialog (void)
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), check_new_line, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, check_new_line, _("Ensures that at the end of the file is a new line"), NULL);
|
||||
|
||||
check_ensure_convert_new_lines = gtk_check_button_new_with_mnemonic (_("Ensure consistent line endings"));
|
||||
gtk_widget_show (check_ensure_convert_new_lines);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), check_ensure_convert_new_lines, FALSE, FALSE, 0);
|
||||
gtk_tooltips_set_tip (tooltips, check_ensure_convert_new_lines, _("Ensures that newline characters always get converted before saving, avoiding mixed line endings in the same file"), NULL);
|
||||
|
||||
check_trailing_spaces = gtk_check_button_new_with_mnemonic (_("Strip trailing spaces and tabs"));
|
||||
gtk_widget_show (check_trailing_spaces);
|
||||
gtk_box_pack_start (GTK_BOX (vbox6), check_trailing_spaces, FALSE, FALSE, 0);
|
||||
@ -5143,6 +5149,7 @@ create_prefs_dialog (void)
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, alignment3, "alignment3");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, vbox6, "vbox6");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_new_line, "check_new_line");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_ensure_convert_new_lines, "check_ensure_convert_new_lines");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_trailing_spaces, "check_trailing_spaces");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, check_replace_tabs, "check_replace_tabs");
|
||||
GLADE_HOOKUP_OBJECT (prefs_dialog, label19, "label19");
|
||||
|
||||
@ -405,6 +405,7 @@ static void save_dialog_prefs(GKeyFile *config)
|
||||
g_key_file_set_string(config, PACKAGE, "pref_editor_default_open_encoding", encodings[file_prefs.default_open_encoding].charset);
|
||||
g_key_file_set_integer(config, PACKAGE, "default_eol_character", file_prefs.default_eol_character);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_new_line", file_prefs.final_new_line);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_ensure_convert_line_endings", file_prefs.ensure_convert_new_lines);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_replace_tabs", file_prefs.replace_tabs);
|
||||
g_key_file_set_boolean(config, PACKAGE, "pref_editor_trail_space", file_prefs.strip_trailing_spaces);
|
||||
|
||||
@ -723,6 +724,7 @@ static void load_dialog_prefs(GKeyFile *config)
|
||||
}
|
||||
file_prefs.default_eol_character = utils_get_setting_integer(config, PACKAGE, "default_eol_character", GEANY_DEFAULT_EOL_CHARACTER);
|
||||
file_prefs.replace_tabs = utils_get_setting_boolean(config, PACKAGE, "pref_editor_replace_tabs", FALSE);
|
||||
file_prefs.ensure_convert_new_lines = utils_get_setting_boolean(config, PACKAGE, "pref_editor_ensure_convert_line_endings", FALSE);
|
||||
file_prefs.final_new_line = utils_get_setting_boolean(config, PACKAGE, "pref_editor_new_line", TRUE);
|
||||
file_prefs.strip_trailing_spaces = utils_get_setting_boolean(config, PACKAGE, "pref_editor_trail_space", FALSE);
|
||||
|
||||
|
||||
@ -511,6 +511,9 @@ static void prefs_init_dialog(void)
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.final_new_line);
|
||||
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ensure_convert_new_lines");
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), file_prefs.ensure_convert_new_lines);
|
||||
|
||||
/* Editor settings */
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "entry_toggle_mark");
|
||||
gtk_entry_set_text(GTK_ENTRY(widget), editor_prefs.comment_toggle_mark);
|
||||
@ -961,6 +964,9 @@ on_prefs_dialog_response(GtkDialog *dialog, gint response, gpointer user_data)
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_new_line");
|
||||
file_prefs.final_new_line = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_ensure_convert_new_lines");
|
||||
file_prefs.ensure_convert_new_lines = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
widget = ui_lookup_widget(ui_widgets.prefs_dialog, "check_replace_tabs");
|
||||
file_prefs.replace_tabs = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user