SF.net SVN: geany:[5321] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Mon Oct 25 16:24:55 UTC 2010


Revision: 5321
          http://geany.svn.sourceforge.net/geany/?rev=5321&view=rev
Author:   ntrel
Date:     2010-10-25 16:24:55 +0000 (Mon, 25 Oct 2010)

Log Message:
-----------
Add 'Ensure consistent line endings' file saving pref (patch by
Manuel Bua, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/THANKS
    trunk/geany.glade
    trunk/src/about.c
    trunk/src/document.c
    trunk/src/document.h
    trunk/src/interface.c
    trunk/src/keyfile.c
    trunk/src/prefs.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/ChangeLog	2010-10-25 16:24:55 UTC (rev 5321)
@@ -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>

Modified: trunk/THANKS
===================================================================
--- trunk/THANKS	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/THANKS	2010-10-25 16:24:55 UTC (rev 5321)
@@ -86,6 +86,7 @@
 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:
 ------------

Modified: trunk/geany.glade
===================================================================
--- trunk/geany.glade	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/geany.glade	2010-10-25 16:24:55 UTC (rev 5321)
@@ -7856,6 +7856,26 @@
 			  </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>
 			      <property name="tooltip" translatable="yes">Removes trailing spaces and tabs and the end of lines</property>

Modified: trunk/src/about.c
===================================================================
--- trunk/src/about.c	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/about.c	2010-10-25 16:24:55 UTC (rev 5321)
@@ -95,7 +95,7 @@
 "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, "

Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/document.c	2010-10-25 16:24:55 UTC (rev 5321)
@@ -1801,6 +1801,9 @@
 	/* 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);

Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/document.h	2010-10-25 16:24:55 UTC (rev 5321)
@@ -43,6 +43,7 @@
 #endif
 
 
+/** File Prefs. */
 typedef struct GeanyFilePrefs
 {
 	gint			default_new_encoding;
@@ -58,6 +59,7 @@
 	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;
 

Modified: trunk/src/interface.c
===================================================================
--- trunk/src/interface.c	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/interface.c	2010-10-25 16:24:55 UTC (rev 5321)
@@ -2674,6 +2674,7 @@
   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 @@
   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 @@
   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");

Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/keyfile.c	2010-10-25 16:24:55 UTC (rev 5321)
@@ -405,6 +405,7 @@
 		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 @@
 	}
 	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);
 

Modified: trunk/src/prefs.c
===================================================================
--- trunk/src/prefs.c	2010-10-25 16:07:15 UTC (rev 5320)
+++ trunk/src/prefs.c	2010-10-25 16:24:55 UTC (rev 5321)
@@ -511,6 +511,9 @@
 	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 @@
 		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));
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list