SF.net SVN: geany:[5903] trunk

colombanw at users.sourceforge.net colombanw at xxxxx
Thu Aug 25 20:14:40 UTC 2011


Revision: 5903
          http://geany.svn.sourceforge.net/geany/?rev=5903&view=rev
Author:   colombanw
Date:     2011-08-25 20:14:40 +0000 (Thu, 25 Aug 2011)
Log Message:
-----------
Add and use editor_set_indent_width() to only set indentation width

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/editor.c
    trunk/src/editor.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-08-25 20:14:17 UTC (rev 5902)
+++ trunk/ChangeLog	2011-08-25 20:14:40 UTC (rev 5903)
@@ -4,6 +4,8 @@
    doc/geany.html, data/filetypes.*:
    Add support for filetype-specific indentation settings (closes
    #3339420 and #3390435).
+ * src/callbacks.c, src/editor.c, src/editor.h:
+   Add editor_set_indent_width() to only set indentation width.
 
 
 2011-08-24  Colomban Wendling  <colomban(at)geany(dot)org>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2011-08-25 20:14:17 UTC (rev 5902)
+++ trunk/src/callbacks.c	2011-08-25 20:14:40 UTC (rev 5903)
@@ -2066,31 +2066,25 @@
 }
 
 
-static void set_indent_width(guint width)
+void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
 	GeanyDocument *doc;
+	gchar *label;
+	gint width;
 
 	if (ignore_callback)
 		return;
 
-	doc = document_get_current();
-	g_return_if_fail(doc != NULL);
+	label = ui_menu_item_get_text(menuitem);
+	width = atoi(label);
+	g_free(label);
 
-	editor_set_indent(doc->editor, doc->editor->indent_type, width);
+	doc = document_get_current();
+	if (doc != NULL && width > 0)
+		editor_set_indent_width(doc->editor, width);
 }
 
 
-void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data)
-{
-	gchar *label = ui_menu_item_get_text(menuitem);
-	gint width = atoi(label);
-
-	g_free(label);
-	if (width)
-		set_indent_width(width);
-}
-
-
 void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data)
 {
 	guint i;

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2011-08-25 20:14:17 UTC (rev 5902)
+++ trunk/src/editor.c	2011-08-25 20:14:40 UTC (rev 5903)
@@ -4468,6 +4468,12 @@
 }
 
 
+void editor_set_indent_width(GeanyEditor *editor, gint width)
+{
+	editor_set_indent(editor, editor->indent_type, width);
+}
+
+
 void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width)
 {
 	const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2011-08-25 20:14:17 UTC (rev 5902)
+++ trunk/src/editor.h	2011-08-25 20:14:40 UTC (rev 5903)
@@ -294,6 +294,8 @@
 
 void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type);
 
+void editor_set_indent_width(GeanyEditor *editor, gint width);
+
 void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width);
 
 void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap);

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