[anjuta/gnome-3-6] indentation-c-style: remove java_indentation() method



commit c74b184f72cf10be847c5e6e2f859ab19d08aa3c
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Thu Oct 4 01:13:25 2012 +0200

    indentation-c-style: remove java_indentation() method
    
    It was only calling cpp_indentation() anyway and it caused problems when blocking
    the signal handler since we always blocked the cpp one. Also rename cpp_indentation()
    to cpp_java_indentation_char_added() to facilitate adding another function that acts on
    the IAnjutaEditor::changed signal instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687216

 plugins/indentation-c-style/indentation.c |   22 ++++++----------------
 plugins/indentation-c-style/indentation.h |   13 ++++---------
 plugins/indentation-c-style/plugin.c      |   25 ++++++-------------------
 3 files changed, 16 insertions(+), 44 deletions(-)
---
diff --git a/plugins/indentation-c-style/indentation.c b/plugins/indentation-c-style/indentation.c
index 7b7fee3..177bb97 100644
--- a/plugins/indentation-c-style/indentation.c
+++ b/plugins/indentation-c-style/indentation.c
@@ -1181,16 +1181,16 @@ insert_editor_blocked (IAnjutaEditor* editor,
                        gchar* text,
                        IndentCPlugin* plugin)
 {
-	g_signal_handlers_block_by_func (editor, cpp_indentation, plugin);
+	g_signal_handlers_block_by_func (editor, cpp_java_indentation_char_added, plugin);
 	ianjuta_editor_insert (editor, iter, text, -1, NULL);
-	g_signal_handlers_unblock_by_func (editor, cpp_indentation, plugin);
+	g_signal_handlers_unblock_by_func (editor, cpp_java_indentation_char_added, plugin);
 }
 
 void
-cpp_indentation (IAnjutaEditor *editor,
-                 IAnjutaIterable *insert_pos,
-                 gchar ch,
-                 IndentCPlugin *plugin)
+cpp_java_indentation_char_added (IAnjutaEditor *editor,
+                                 IAnjutaIterable *insert_pos,
+                                 gchar ch,
+                                 IndentCPlugin *plugin)
 {
 	IAnjutaEditorAttribute attrib;
 	IAnjutaIterable *iter;
@@ -1404,13 +1404,3 @@ cpp_auto_indentation (IAnjutaEditor *editor,
 	}
 	ianjuta_document_end_undo_action (IANJUTA_DOCUMENT(editor), NULL);
 }
-
-
-void
-java_indentation (IAnjutaEditor *editor,
-                  IAnjutaIterable *insert_pos,
-                  gchar ch,
-                  IndentCPlugin *plugin)
-{
-	cpp_indentation (editor, insert_pos, ch, plugin);
-}
diff --git a/plugins/indentation-c-style/indentation.h b/plugins/indentation-c-style/indentation.h
index b661227..38970c1 100644
--- a/plugins/indentation-c-style/indentation.h
+++ b/plugins/indentation-c-style/indentation.h
@@ -21,10 +21,10 @@
 #include "plugin.h"
 
 void
-cpp_indentation (IAnjutaEditor *editor,
-                 IAnjutaIterable *insert_pos,
-                 gchar ch,
-                 IndentCPlugin *plugin);
+cpp_java_indentation_char_added (IAnjutaEditor *editor,
+                                 IAnjutaIterable *insert_pos,
+                                 gchar ch,
+                                 IndentCPlugin *plugin);
 
 void
 cpp_auto_indentation (IAnjutaEditor *editor,
@@ -32,8 +32,3 @@ cpp_auto_indentation (IAnjutaEditor *editor,
                       IAnjutaIterable *start,
                       IAnjutaIterable *end);
 
-void
-java_indentation (IAnjutaEditor *editor,
-                  IAnjutaIterable *insert_pos,
-                  gchar ch,
-                  IndentCPlugin *plugin);
diff --git a/plugins/indentation-c-style/plugin.c b/plugins/indentation-c-style/plugin.c
index 5baaed8..59eed5b 100644
--- a/plugins/indentation-c-style/plugin.c
+++ b/plugins/indentation-c-style/plugin.c
@@ -349,19 +349,12 @@ install_support (IndentCPlugin *lang_plugin)
     if (lang_plugin->current_language &&
         (g_str_equal (lang_plugin->current_language, "C")
         || g_str_equal (lang_plugin->current_language, "C++")
-        || g_str_equal (lang_plugin->current_language, "Vala")))
+        || g_str_equal (lang_plugin->current_language, "Vala")
+        || g_str_equal (lang_plugin->current_language, "Java")))
     {
         g_signal_connect (lang_plugin->current_editor,
                           "char-added",
-                          G_CALLBACK (cpp_indentation),
-                          lang_plugin);
-    }
-    else if (lang_plugin->current_language &&
-        (g_str_equal (lang_plugin->current_language, "Java")))
-    {
-        g_signal_connect (lang_plugin->current_editor,
-                          "char-added",
-                          G_CALLBACK (java_indentation),
+                          G_CALLBACK (cpp_java_indentation_char_added),
                           lang_plugin);
     }
     else
@@ -382,17 +375,11 @@ uninstall_support (IndentCPlugin *lang_plugin)
     if (lang_plugin->current_language &&
         (g_str_equal (lang_plugin->current_language, "C")
         || g_str_equal (lang_plugin->current_language, "C++")
-        || g_str_equal (lang_plugin->current_language, "Vala")))
-    {
-        g_signal_handlers_disconnect_by_func (lang_plugin->current_editor,
-                                    G_CALLBACK (cpp_indentation),
-                                    lang_plugin);
-    }
-    else if (lang_plugin->current_language &&
-        (g_str_equal (lang_plugin->current_language, "Java")))
+        || g_str_equal (lang_plugin->current_language, "Vala")
+        || g_str_equal (lang_plugin->current_language, "Java")))
     {
         g_signal_handlers_disconnect_by_func (lang_plugin->current_editor,
-                                    G_CALLBACK (java_indentation),
+                                    G_CALLBACK (cpp_java_indentation_char_added),
                                     lang_plugin);
     }
     



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