[anjuta] language-support-cpp: Use common settings for indentation



commit 34eb1f3474544e562455ccafb542de50661befb4
Author: SÃbastien Granjoux <seb sfo free fr>
Date:   Sun Apr 22 12:14:18 2012 +0200

    language-support-cpp: Use common settings for indentation

 .../anjuta-language-cpp-java.ui                    |    2 +-
 .../cpp-java-indentation.c                         |    3 +--
 .../org.gnome.anjuta.cpp.gschema.xml.in            |    3 ---
 plugins/language-support-cpp-java/plugin.c         |    5 ++++-
 plugins/language-support-cpp-java/plugin.h         |   11 ++++++-----
 5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui b/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
index ba18ea8..9fa1733 100644
--- a/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
+++ b/plugins/language-support-cpp-java/anjuta-language-cpp-java.ui
@@ -153,7 +153,7 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkSpinButton" id="preferences_spin:int:4:1:cpp-indent-statement-size">
+                                  <object class="GtkSpinButton" id="preferences:.editor.indent-width">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                     <property name="invisible_char">â</property>
diff --git a/plugins/language-support-cpp-java/cpp-java-indentation.c b/plugins/language-support-cpp-java/cpp-java-indentation.c
index 2f60668..ca0cfa2 100644
--- a/plugins/language-support-cpp-java/cpp-java-indentation.c
+++ b/plugins/language-support-cpp-java/cpp-java-indentation.c
@@ -34,7 +34,6 @@
 #include "cpp-java-indentation.h"
 #include "cpp-java-utils.h"
 
-#define PREF_INDENT_STATEMENT_SIZE "cpp-indent-statement-size"
 #define PREF_INDENT_BRACE_SIZE "cpp-indent-brace-size"
 #define PREF_INDENT_PARANTHESE_LINEUP "cpp-indent-paranthese-lineup"
 #define PREF_INDENT_PARANTHESE_SIZE "cpp-indent-paranthese-size"
@@ -47,7 +46,7 @@
 #define INDENT_SIZE \
 	(plugin->param_statement_indentation >= 0? \
 		plugin->param_statement_indentation : \
-		g_settings_get_int (plugin->settings, PREF_INDENT_STATEMENT_SIZE))
+		g_settings_get_int (plugin->editor_settings, IANJUTA_EDITOR_INDENT_WIDTH_KEY))
 
 #define BRACE_INDENT \
 	(plugin->param_brace_indentation >= 0? \
diff --git a/plugins/language-support-cpp-java/org.gnome.anjuta.cpp.gschema.xml.in b/plugins/language-support-cpp-java/org.gnome.anjuta.cpp.gschema.xml.in
index 9d87419..15da8d6 100644
--- a/plugins/language-support-cpp-java/org.gnome.anjuta.cpp.gschema.xml.in
+++ b/plugins/language-support-cpp-java/org.gnome.anjuta.cpp.gschema.xml.in
@@ -15,9 +15,6 @@
 		<key name="cpp-indent-brace-size" type="i">
 			<default>0</default>
 		</key>
-		<key name="cpp-indent-statement-size" type="i">
-			<default>4</default>
-		</key>
 		<key name="cpp-indent-paranthese-lineup" type="b">
 			<default>true</default>
 		</key>
diff --git a/plugins/language-support-cpp-java/plugin.c b/plugins/language-support-cpp-java/plugin.c
index 56a1405..7b0821e 100644
--- a/plugins/language-support-cpp-java/plugin.c
+++ b/plugins/language-support-cpp-java/plugin.c
@@ -63,6 +63,7 @@
 
 /* Preferences keys */
 
+#define ANJUTA_PREF_SCHEMA_PREFIX "org.gnome.anjuta."
 #define PREF_SCHEMA "org.gnome.anjuta.cpp"
 #define PREF_INDENT_AUTOMATIC "cpp-indent-automatic"
 #define PREF_INDENT_MODELINE "cpp-indent-modeline"
@@ -895,7 +896,7 @@ glade_widget_already_in_scope (IAnjutaEditor* editor, gchar* widget_name,
 
        int line = ianjuta_editor_get_line_from_position (editor, mark_position, NULL);
        g_object_unref(mark_position);
-       
+
 
        IAnjutaSymbolManager *symbol_manager =
               anjuta_shell_get_interface (ANJUTA_PLUGIN (lang_plugin)->shell, IAnjutaSymbolManager, NULL);
@@ -1523,6 +1524,7 @@ cpp_java_plugin_dispose (GObject *obj)
 	/* Disposition codes */
 
 	g_object_unref (plugin->settings);
+	g_object_unref (plugin->editor_settings);
 
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
@@ -1538,6 +1540,7 @@ cpp_java_plugin_instance_init (GObject *obj)
 	plugin->uiid = 0;
 	plugin->assist = NULL;
 	plugin->settings = g_settings_new (PREF_SCHEMA);
+	plugin->editor_settings = g_settings_new (ANJUTA_PREF_SCHEMA_PREFIX IANJUTA_EDITOR_PREF_SCHEMA);
 	plugin->packages = NULL;
 }
 
diff --git a/plugins/language-support-cpp-java/plugin.h b/plugins/language-support-cpp-java/plugin.h
index 0060c5b..1d4f02f 100644
--- a/plugins/language-support-cpp-java/plugin.h
+++ b/plugins/language-support-cpp-java/plugin.h
@@ -49,16 +49,17 @@ typedef enum
 
 struct _CppJavaPlugin {
 	AnjutaPlugin parent;
-	
+
 	GtkActionGroup *action_group;
 	gint uiid;
-	
+
 	GSettings* settings;
+	GSettings* editor_settings;
 	gint editor_watch_id;
 	GObject *current_editor;
 	gboolean support_installed;
 	const gchar *current_language;
-	
+
 	/* Adaptive indentation parameters */
 	gint param_tab_size;
 	gint param_use_spaces;
@@ -67,7 +68,7 @@ struct _CppJavaPlugin {
 	gint param_case_indentation;
 	gint param_label_indentation;
 	gboolean smart_indentation;
-	
+
 	/* Assist */
 	CppJavaAssist *assist;
 	CppFileType filetype;
@@ -83,4 +84,4 @@ struct _CppJavaPluginClass {
 	AnjutaPluginClass parent_class;
 };
 
-#endif
\ No newline at end of file
+#endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]