anjuta r4370 - in trunk: . libanjuta plugins/file-loader plugins/language-support-cpp-java



Author: jhs
Date: Sun Nov  2 18:07:12 2008
New Revision: 4370
URL: http://svn.gnome.org/viewvc/anjuta?rev=4370&view=rev

Log:
2008-11-02  Johannes Schmid  <jhs gnome org>

	* plugins/file-loader/plugin.c (iloader_load):
	Fix localisation (from Marc Lorber)

Modified:
   trunk/ChangeLog
   trunk/libanjuta/anjuta-debug.h
   trunk/plugins/file-loader/plugin.c
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c

Modified: trunk/libanjuta/anjuta-debug.h
==============================================================================
--- trunk/libanjuta/anjuta-debug.h	(original)
+++ trunk/libanjuta/anjuta-debug.h	Sun Nov  2 18:07:12 2008
@@ -34,26 +34,13 @@
 /**
  * DEBUG_PRINT:
  * 
- * Equivalent to g_message(), except it has only effect when DEBUG is
- * defined. Used for printing debug messages.
- */
-
-#ifdef DEBUG
-#  define DEBUG_PRINT g_message
-#else
-#  define DEBUG_PRINT(...)
-#endif
-
-/**
- * DEBUG_PRINTF:
- * 
  * Equivalent to g_debug() showing the FILE, the LINE and the FUNC,
  * except it has only effect when DEBUG is defined. Used for printing debug messages.
  */
 #if defined (DEBUG) && defined (__GNUCC__)
-#  define DEBUG_PRINTF(format, ...) g_debug ("%s:%d (%s)" format, __FILE__, __LINE__, G_STRFUNC, __VA_ARGS__)
+#  define DEBUG_PRINT(format, ...) g_debug ("%s:%d (%s)" format, __FILE__, __LINE__, G_STRFUNC, __VA_ARGS__)
 #else
-#  define DEBUG_PRINTF(...)
+#  define DEBUG_PRINT(...)
 #endif
 
 #endif

Modified: trunk/plugins/file-loader/plugin.c
==============================================================================
--- trunk/plugins/file-loader/plugin.c	(original)
+++ trunk/plugins/file-loader/plugin.c	Sun Nov  2 18:07:12 2008
@@ -1405,11 +1405,11 @@
 	if (g_list_length (plugin_descs) > 1)
 	{
 		gchar* basename = g_path_get_basename (uri);
-		gchar* message = g_strdup_printf ("Please select a plugin to open <b>%s</b>.", 
+		gchar* message = g_strdup_printf (_("Please select a plugin to open <b>%s</b>."), 
 										 basename);
 		plugin =
 			anjuta_plugin_manager_select_and_activate (plugin_manager,
-													   "Open With",
+													   _("Open With"),
 													   message,
 													   plugin_descs);
 		g_free (basename);

Modified: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Sun Nov  2 18:07:12 2008
@@ -181,6 +181,8 @@
 	return completion;
 }
 
+#define SCOPE_BRACE_JUMP_LIMIT 50
+
 static gchar*
 cpp_java_assist_get_scope_context (IAnjutaEditor* editor,
 								   const gchar *scope_operator,
@@ -196,14 +198,27 @@
 	
 	ch = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (iter), 0, NULL);
 	
-	while (ch && is_scope_context_character (ch))
+	while (ch)
 	{
-		scope_chars_found = TRUE;
+		if (is_scope_context_character (ch))
+		{
+			scope_chars_found = TRUE;
+		}
+		else if (ch == ')')
+		{
+			if (!cpp_java_util_jump_to_matching_brace (iter, ch, SCOPE_BRACE_JUMP_LIMIT))
+			{
+				out_of_range = TRUE;
+				break;
+			}
+		}
+		else
+			break;
 		if (!ianjuta_iterable_previous (iter, NULL))
 		{
 			out_of_range = TRUE;
 			break;
-		}
+		}		
 		ch = ianjuta_editor_cell_get_char (IANJUTA_EDITOR_CELL (iter), 0, NULL);
 	}
 	if (scope_chars_found)
@@ -320,29 +335,90 @@
 											   const gchar *scope_operator,
 											   const gchar *scope_context)
 {
-	DEBUG_PRINT ("TODO: cpp_java_assist_create_scope_completion_cache ()");
-#if 0	
+	DEBUG_PRINT ("scope context: %s", scope_context);
 	cpp_java_assist_destroy_completion_cache (assist);
 	if (g_str_equal (scope_operator, "::"))
 	{
-		IAnjutaIterable* iter = 
-			ianjuta_symbol_manager_get_members (assist->priv->isymbol_manager,
-												scope_context, TRUE, NULL);
-		if (iter)
-		{
-			assist->priv->completion_cache =
-				create_completion (assist->priv->iassist, iter);
-			assist->priv->scope_context_cache = g_strdup (scope_context);
-			g_object_unref (iter);
+		/* Go through the possible namespace (Gnome::Glade, for example) */
+		GStrv contexts = g_strsplit (scope_context, "::", -1);
+		gint cur_context = 0;
+		if (contexts[0] != NULL)
+		{
+			DEBUG_PRINT ("Scope[%d] = %s", cur_context, contexts[0]);
+			IAnjutaIterable* symbol = 
+				ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
+											   IANJUTA_SYMBOL_TYPE_CLASS | IANJUTA_SYMBOL_TYPE_NAMESPACE,
+											   TRUE,
+											   IANJUTA_SYMBOL_FIELD_SIMPLE,
+											   contexts[0],
+											   FALSE,
+											   TRUE,
+											   TRUE,
+											   1,
+											   -1,
+											   NULL);
+			if (symbol && ianjuta_iterable_get_length(symbol, NULL))
+			{
+				while (contexts[++cur_context] != NULL)
+				{							
+					DEBUG_PRINT ("Scope[%d] = %s", cur_context, contexts[0]);
+					IAnjutaIterable* members = 
+						ianjuta_symbol_manager_get_members(assist->priv->isymbol_manager,
+														   IANJUTA_SYMBOL(symbol),
+														   IANJUTA_SYMBOL_FIELD_SIMPLE,
+														   TRUE, NULL);
+					if (members && ianjuta_iterable_get_length (members, NULL))
+					{
+						gboolean found = FALSE;
+						do
+						{
+							if (g_str_equal (ianjuta_symbol_get_name (IANJUTA_SYMBOL(members),
+																	  NULL),
+											 contexts[cur_context]))
+							{
+								g_object_unref (symbol);
+								symbol = members;
+								found = TRUE;
+								break;
+							}
+						}
+						while (ianjuta_iterable_next (members, NULL));
+						if (found)
+							continue;
+						else
+						{
+							g_object_unref (symbol);
+							symbol = NULL;
+							break;
+						}
+					}
+				}
+				if (symbol)
+				{
+					IAnjutaIterable* members = 
+						ianjuta_symbol_manager_get_members(assist->priv->isymbol_manager,
+														   IANJUTA_SYMBOL(symbol),
+														   IANJUTA_SYMBOL_FIELD_SIMPLE,
+														   TRUE, NULL);
+					if (members)
+					{
+						assist->priv->completion_cache =
+							create_completion (assist->priv->iassist, members, NULL);
+						assist->priv->scope_context_cache = g_strdup (scope_context);
+						g_object_unref (members);
+					}
+					g_object_unref (symbol);
+				}
+			}
 		}
-	} 
+		g_strfreev(contexts);
+	}
 	else if (g_str_equal (scope_operator, ".") ||
 			 g_str_equal (scope_operator, "->"))	
 	{
 		/* TODO: Find the type of context by parsing the file somehow and
 		search for the member as it is done with the :: context */
-	}
-#endif	
+	}	
 }
 
 static void



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