SF.net SVN: geany-plugins:[906] trunk/geany-plugins

funto66 at users.sourceforge.net funto66 at xxxxx
Tue Aug 25 22:02:38 UTC 2009


Revision: 906
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=906&view=rev
Author:   funto66
Date:     2009-08-25 22:02:37 +0000 (Tue, 25 Aug 2009)

Log Message:
-----------
[CodeNavigation] :
- replaced GArrayS with GSListS
- made it compile (thanks Thomas Martitz)
- bugfix for the separator on the edit menu when the plugin is deactivating (thanks FraLan)
- started an interface to configure header/implementation switching

Modified Paths:
--------------
    trunk/geany-plugins/codenav/src/codenavigation.c
    trunk/geany-plugins/po/fr.po

Modified: trunk/geany-plugins/codenav/src/codenavigation.c
===================================================================
--- trunk/geany-plugins/codenav/src/codenavigation.c	2009-08-24 19:43:29 UTC (rev 905)
+++ trunk/geany-plugins/codenav/src/codenavigation.c	2009-08-25 22:02:37 UTC (rev 906)
@@ -52,13 +52,13 @@
 GeanyData		*geany_data;
 GeanyFunctions	*geany_functions;
 
-/* #define CODE_NAVIGATION_DEBUG */
+//#define CODE_NAVIGATION_DEBUG
 #define CODE_NAVIGATION_VERSION "0.1"
 
 #ifdef CODE_NAVIGATION_DEBUG
 #define log_debug g_print
 #else
-inline void log_debug(const gchar* s, ...) {}
+static void log_debug(const gchar* s, ...) {}
 #endif
 
 /* Check that the running Geany supports the plugin API used below, and check
@@ -66,22 +66,25 @@
 PLUGIN_VERSION_CHECK(112)
 
 /* All plugins must set name, description, version and author. */
-PLUGIN_SET_INFO(_("Code navigation"), _("This plugin adds features to facilitate navigation between source files.\n"
-										"As for the moment, it implements :\n"
-										"- switching between a .cpp file and the corresponding .h file\n"
-										"- opening a file by typing its name"), CODE_NAVIGATION_VERSION, _("Lionel Fuentes"))
+PLUGIN_SET_INFO(_("Code navigation"),
+	_(	"This plugin adds features to facilitate navigation between source files.\n"
+		"As for the moment, it implements :\n"
+		"- switching between a .cpp file and the corresponding .h file\n"
+		"- [opening a file by typing its name -> TODO]"), CODE_NAVIGATION_VERSION, _("Lionel Fuentes"))
 
 static GtkWidget* switch_menu_item = NULL;
 static GtkWidget* goto_file_menu_item = NULL;
+static GtkWidget* file_menu_item_separator = NULL;
 
 typedef struct
 {
-	GArray* head_extensions;	/* e.g. : "h", "hpp", ... */
-	GArray* impl_extensions; /* e.g. : "cpp", "cxx", ... */
+	const gchar* language_name;
+	GSList* head_extensions;	/* e.g. : "h", "hpp", ... */
+	GSList* impl_extensions; /* e.g. : "cpp", "cxx", ... */
 } LanguageExtensions;
 
-/* Array of LanguageExtensions */
-static GArray* languages_extensions;
+/* List of LanguageExtensions */
+static GSList* languages_extensions;
 
 /* Keybindings */
 enum
@@ -93,20 +96,6 @@
 
 PLUGIN_KEY_GROUP(code_navigation, PLUGIN_KEYS_NUMBER)
 
-/* Utility function to check if a string is in a given string array */
-static gboolean
-str_is_in_garray(const gchar* str, GArray* garray)
-{
-	guint i;
-
-	for(i=0 ; i < garray->len ; i++)
-	{
-		if(g_strcmp0(str, g_array_index(garray, gchar*, i)) == 0)
-			return TRUE;
-	}
-	return FALSE;
-}
-
 /* Utility function, which returns a newly-allocated string containing the
  * extension of the file path which is given, or NULL if it did not found any extension.
  */
@@ -165,17 +154,19 @@
 
 	gchar* extension = NULL;	/* e.g. : "hpp" */
 
-	GArray* p_extensions_to_test = NULL;	/* e.g. : {"cpp", "cxx", ...} */
+	GSList* p_extensions_to_test = NULL;	/* e.g. : ["cpp", "cxx", ...] */
 
-	GArray* filenames_to_test = NULL;	/* e.g. : {"f.cpp", "f.cxx", ...} */
+	GSList* filenames_to_test = NULL;	/* e.g. : ["f.cpp", "f.cxx", ...] */
 
+	GSList* p_lang = NULL;
+	GSList* p_ext = NULL;
+	GSList* p_filename = NULL;
+	gint i=0;
+
 	gchar* dirname = NULL;
 	gchar* basename = NULL;
 	gchar* basename_no_extension = NULL;
 
-	guint i=0;
-	guint j=0;
-
 	gchar* p_str = NULL;	/* Local variables, used as temporaty buffers */
 	gchar* p_str2 = NULL;
 
@@ -183,12 +174,14 @@
 
 	log_debug("DEBUG : current_doc->file_name == %s\n", current_doc->file_name);
 
+	log_debug("DEBUG : geany->documents_array->len == %d\n", geany->documents_array->len);
+
 	if(current_doc != NULL && current_doc->file_name != NULL && current_doc->file_name[0] != '\0')
 	{
 		/* Get the basename, e.g. : "/home/me/file.cpp" -> "file.cpp" */
 		basename = g_path_get_basename(current_doc->file_name);
 
-		if(strlen(basename) < 2)
+		if(g_utf8_strlen(basename, -1) < 2)
 			goto free_mem;
 
 		log_debug("DEBUG : basename == %s\n", basename);
@@ -196,33 +189,33 @@
 		/* Get the extension , e.g. : "cpp" */
 		extension = get_extension(basename);
 
-		if(extension == NULL || strlen(extension) == 0)
+		if(extension == NULL || g_utf8_strlen(extension, -1) == 0)
 			goto free_mem;
 
 		log_debug("DEBUG : extension == %s\n", extension);
 
 		/* Get the basename without any extension */
 		basename_no_extension = copy_and_remove_extension(basename);
-		if(basename_no_extension == NULL || strlen(basename_no_extension) == 0)
+		if(basename_no_extension == NULL || g_utf8_strlen(basename_no_extension, -1) == 0)
 			goto free_mem;
 
 		/* Identify the language and whether the file is a header or an implementation. */
 		/* For each recognized language : */
-		for(i=0 ; i < languages_extensions->len ; i++)
+		for(p_lang = languages_extensions ; p_lang != NULL ; p_lang = p_lang->next)
 		{
-			LanguageExtensions* p_lang = &(g_array_index(languages_extensions, LanguageExtensions, i));
+			LanguageExtensions* p_lang_data = (LanguageExtensions*)(p_lang->data);
 
 			/* Test the headers : */
-			if(str_is_in_garray(extension, p_lang->head_extensions))
+			if(g_slist_find_custom(p_lang_data->head_extensions, extension, (GCompareFunc)(&g_strcmp0)) != NULL)
 			{
-				p_extensions_to_test = p_lang->impl_extensions;
+				p_extensions_to_test = p_lang_data->impl_extensions;
 				break;
 			}
 
 			/* Test the implementations : */
-			else if(str_is_in_garray(extension, p_lang->impl_extensions))
+			else if(g_slist_find_custom(p_lang_data->impl_extensions, extension, (GCompareFunc)(&g_strcmp0)) != NULL)
 			{
-				p_extensions_to_test = p_lang->head_extensions;
+				p_extensions_to_test = p_lang_data->head_extensions;
 				break;
 			}
 		}
@@ -230,35 +223,43 @@
 		if(p_extensions_to_test == NULL)
 			goto free_mem;
 
+#ifdef CODE_NAVIGATION_DEBUG
 		log_debug("DEBUG : extension known !\n");
 		log_debug("DEBUG : p_extensions_to_test : ");
-		for(i=0 ; i < p_extensions_to_test->len ; i++)
-			log_debug("\"%s\", ", g_array_index(p_extensions_to_test, gchar*, i));
+		g_slist_foreach(p_extensions_to_test, (GFunc)(&log_debug), NULL);
 		log_debug("\n");
+#endif
 
-		/* Build an array of filenames to test : */
-		filenames_to_test = g_array_sized_new(FALSE, FALSE, sizeof(gchar*), p_extensions_to_test->len);
-		for(i=0 ; i < p_extensions_to_test->len ; i++)
+		/* Build a list of filenames to test : */
+		filenames_to_test = NULL;
+		for(p_ext = p_extensions_to_test ; p_ext != NULL ; p_ext = p_ext->next)
 		{
-			p_str = g_strdup_printf("%s.%s", basename_no_extension, g_array_index(p_extensions_to_test, gchar*, i));
-			g_array_append_val(filenames_to_test, p_str);
-			log_debug("DEBUG : filenames_to_test[%d] == \"%s\"", i, g_array_index(filenames_to_test, gchar*, i));
+			p_str = g_strdup_printf("%s.%s", basename_no_extension, (const gchar*)(p_ext->data));
+			filenames_to_test = g_slist_prepend(filenames_to_test, p_str);
 		}
 
+		filenames_to_test = g_slist_reverse(filenames_to_test);
+
+#ifdef CODE_NAVIGATION_DEBUG
+		log_debug("DEBUG : filenames to test :\n");
+		g_slist_foreach(filenames_to_test, (GFunc)(&log_debug), NULL);
+		log_debug("\n");
+#endif
+
 		/* First : look for a corresponding file in the opened files.
 		 * If found, open it. */
 		for(i=0 ; i < nb_documents ; i++)
 		{
 			new_doc = document_index(i);
 
-			for(j=0 ; j < p_extensions_to_test->len ; j++)
+			for(p_filename = filenames_to_test ; p_filename != NULL ; p_filename = p_filename->next)
 			{
 				p_str = g_path_get_basename(new_doc->file_name);
 
-				log_debug("DEBUG : comparing \"%s\" and \"%s\"\n", g_array_index(filenames_to_test, gchar*, j), p_str);
-				if(g_strcmp0(g_array_index(filenames_to_test, gchar*, j), p_str) == 0)
+				log_debug("DEBUG : comparing \"%s\" and \"%s\"\n", (const gchar*)(p_filename->data), p_str);
+				if(g_strcmp0((const gchar*)(p_filename->data), p_str) == 0)
 				{
-					log_debug("DEBUG : FOUND ! i == %d\n", i);
+					log_debug("DEBUG : FOUND !\n");
 					g_free(p_str);
 
 					p_str = g_locale_from_utf8(new_doc->file_name, -1, NULL, NULL, NULL);
@@ -283,10 +284,10 @@
 		log_debug("DEBUG : dirname == \"%s\"", dirname);
 
 		/* -> try all the extensions we should test */
-		for(i=0 ; i < p_extensions_to_test->len ; i++)
+		for(p_ext = p_extensions_to_test ; p_ext != NULL ; p_ext = p_ext->next)
 		{
 			p_str = g_strdup_printf(	"%s" G_DIR_SEPARATOR_S "%s.%s",
-										dirname, basename_no_extension, g_array_index(p_extensions_to_test, gchar*, i));
+										dirname, basename_no_extension, (const gchar*)(p_ext->data));
 
 			p_str2 = g_locale_from_utf8(p_str, -1, NULL, NULL, NULL);
 			g_free(p_str);
@@ -305,7 +306,7 @@
 
 		/* Third : if not found, ask the user if he wants to create it or not. */
 		{
-			p_str = g_strdup_printf("%s.%s", basename_no_extension, g_array_index(p_extensions_to_test, gchar*, 0));
+			p_str = g_strdup_printf("%s.%s", basename_no_extension, (const gchar*)(p_extensions_to_test->data));
 
 			GtkWidget* dialog = gtk_message_dialog_new(	GTK_WINDOW(geany_data->main_widgets->window),
 														GTK_DIALOG_MODAL,
@@ -328,13 +329,7 @@
 
 		/* Free the memory */
 free_mem:
-		if(filenames_to_test != NULL)
-		{
-			for(i=0 ; i < filenames_to_test->len ; i++)
-				g_free(g_array_index(filenames_to_test, gchar*, i));
-			g_array_free(filenames_to_test, TRUE);
-		}
-
+		g_slist_foreach(filenames_to_test, (GFunc)(&g_free), NULL);
 		g_free(dirname);
 		g_free(basename_no_extension);
 		g_free(extension);
@@ -367,21 +362,21 @@
  * Note: data is the same as geany_data. */
 void plugin_init(GeanyData *data)
 {
-	log_debug("DEBUG : plugin_init : POUET\n");
+	LanguageExtensions* le = NULL;
 
-	LanguageExtensions le;
-
 	gchar* p_str = NULL;
 
 	/* Get a pointer to the "Edit" menu */
 	GtkWidget* edit_menu = ui_lookup_widget(geany->main_widgets->window, "edit1_menu");
 
+	log_debug("DEBUG : plugin_init\n");
+
 	/* Add items to the Edit menu : */
 
 	/* - add a separator */
-	GtkWidget* separator = gtk_separator_menu_item_new();
-	gtk_container_add(GTK_CONTAINER(edit_menu), separator);
-	gtk_widget_show(separator);
+	file_menu_item_separator = gtk_separator_menu_item_new();
+	gtk_container_add(GTK_CONTAINER(edit_menu), file_menu_item_separator);
+	gtk_widget_show(file_menu_item_separator);
 
 	/* - add the "Switch header/implementation" menu item */
 	switch_menu_item = gtk_menu_item_new_with_mnemonic(_("Switch header/implementation"));
@@ -398,64 +393,82 @@
 	ui_add_document_sensitive(goto_file_menu_item);
 
 	/* Initialize the key bindings : */
-	plugin_keys[PLUGIN_KEYS_SWITCH].key = GDK_s;
-	plugin_keys[PLUGIN_KEYS_SWITCH].mods = GDK_MOD1_MASK | GDK_SHIFT_MASK;
-	plugin_keys[PLUGIN_KEYS_SWITCH].name = _("switch_header_impl");
-	plugin_keys[PLUGIN_KEYS_SWITCH].label = _("Switch header/implementation");
-	plugin_keys[PLUGIN_KEYS_SWITCH].callback = (GeanyKeyCallback)(&switch_menu_item_activate);
-	plugin_keys[PLUGIN_KEYS_SWITCH].menu_item = switch_menu_item;
+	keybindings_set_item(	plugin_key_group,
+							PLUGIN_KEYS_SWITCH,
+							(GeanyKeyCallback)(&switch_menu_item_activate),
+ 							GDK_s, GDK_MOD1_MASK | GDK_SHIFT_MASK,
+ 							_("switch_header_impl"),
+ 							_("Switch header/implementation"),
+ 							switch_menu_item);
 
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].key = GDK_g;
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].mods = GDK_MOD1_MASK | GDK_SHIFT_MASK;
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].name = _("goto_file");
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].label = _("Goto file...");
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].callback = (GeanyKeyCallback)(&goto_file_menu_item_activate);
-	plugin_keys[PLUGIN_KEYS_GOTO_FILE].menu_item = goto_file_menu_item;
+ 	keybindings_set_item(	plugin_key_group,
+ 							PLUGIN_KEYS_GOTO_FILE,
+ 							(GeanyKeyCallback)(&goto_file_menu_item_activate),
+ 							GDK_g, GDK_MOD1_MASK | GDK_SHIFT_MASK,
+ 							_("goto_file"),
+ 							_("Goto file..."),
+ 							goto_file_menu_item);
 
-	/* Initialize the extensions array.
+	/* Initialize the extensions list.
 	 * TODO : we should let the user configure this. */
-	languages_extensions = g_array_new(FALSE, FALSE, sizeof(LanguageExtensions));
+	languages_extensions = NULL;
+	le = NULL;
 
+#define HEAD_PREPEND(str_ext) { p_str = g_strdup(str_ext); le->head_extensions = g_slist_prepend(le->head_extensions, p_str); }
+#define IMPL_PREPEND(str_ext) { p_str = g_strdup(str_ext); le->impl_extensions = g_slist_prepend(le->impl_extensions, p_str); }
+
 	/* C/C++ */
-	le.head_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
-	le.impl_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
+	le = g_malloc0(sizeof(LanguageExtensions));
+	le->language_name = "c_cpp";
 
-	p_str = g_strdup("h");   g_array_append_val(le.head_extensions, p_str);
-	p_str = g_strdup("hpp"); g_array_append_val(le.head_extensions, p_str);
-	p_str = g_strdup("hxx"); g_array_append_val(le.head_extensions, p_str);
-	p_str = g_strdup("h++"); g_array_append_val(le.head_extensions, p_str);
-	p_str = g_strdup("hh");  g_array_append_val(le.head_extensions, p_str);
+	HEAD_PREPEND("h");
+	HEAD_PREPEND("hpp");
+	HEAD_PREPEND("hxx");
+	HEAD_PREPEND("h++");
+	HEAD_PREPEND("hh");
+	le->head_extensions = g_slist_reverse(le->head_extensions);
 
-	p_str = g_strdup("cpp"); g_array_append_val(le.impl_extensions, p_str);
-	p_str = g_strdup("cxx"); g_array_append_val(le.impl_extensions, p_str);
-	p_str = g_strdup("c++"); g_array_append_val(le.impl_extensions, p_str);
-	p_str = g_strdup("cc");  g_array_append_val(le.impl_extensions, p_str);
-	p_str = g_strdup("C"); g_array_append_val(le.impl_extensions, p_str);
-	p_str = g_strdup("c"); g_array_append_val(le.impl_extensions, p_str);
+	IMPL_PREPEND("cpp");
+	IMPL_PREPEND("cxx");
+	IMPL_PREPEND("c++");
+	IMPL_PREPEND("cc");
+	IMPL_PREPEND("C");
+	IMPL_PREPEND("c");
+	le->impl_extensions = g_slist_reverse(le->impl_extensions);
 
-	g_array_append_val(languages_extensions, le);
+	languages_extensions = g_slist_prepend(languages_extensions, le);
 
-
 	/* GLSL */
-	le.head_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
-	le.impl_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
 
-	p_str = g_strdup("vert");   g_array_append_val(le.head_extensions, p_str);
+	le = g_malloc0(sizeof(LanguageExtensions));
+	le->language_name = "glsl";
 
-	p_str = g_strdup("frag"); g_array_append_val(le.impl_extensions, p_str);
+	HEAD_PREPEND("vert");
+	le->head_extensions = g_slist_reverse(le->head_extensions);
 
-	g_array_append_val(languages_extensions, le);
+	IMPL_PREPEND("frag");
+	le->impl_extensions = g_slist_reverse(le->impl_extensions);
 
+	languages_extensions = g_slist_prepend(languages_extensions, le);
 
 	/* Ada */
-	le.head_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
-	le.impl_extensions = g_array_new(FALSE, FALSE, sizeof(gchar*));
 
-	p_str = g_strdup("ads");   g_array_append_val(le.head_extensions, p_str);
+	le = g_malloc0(sizeof(LanguageExtensions));
+	le->language_name = "ada";
 
-	p_str = g_strdup("adb"); g_array_append_val(le.impl_extensions, p_str);
+	HEAD_PREPEND("ads");
+	le->head_extensions = g_slist_reverse(le->head_extensions);
 
-	g_array_append_val(languages_extensions, le);
+	IMPL_PREPEND("adb");
+	le->impl_extensions = g_slist_reverse(le->impl_extensions);
+
+	languages_extensions = g_slist_prepend(languages_extensions, le);
+
+	/* Done : */
+	languages_extensions = g_slist_reverse(languages_extensions);
+
+#undef HEAD_PREPEND
+#undef IMPL_PREPEND
 }
 
 
@@ -471,6 +484,49 @@
 		 * all plugin specific files should be created in:
 		 * geany->app->configdir G_DIR_SEPARATOR_S plugins G_DIR_SEPARATOR_S pluginname G_DIR_SEPARATOR_S
 		 * e.g. this could be: ~/.config/geany/plugins/Demo/, please use geany->app->configdir */
+
+		const gchar** lang_names = NULL;
+		GSList* lang_iterator = NULL;
+		guint i=0;
+		const guint nb_languages = g_slist_length(languages_extensions);
+
+		/* Open the GKeyFile */
+		GKeyFile* key_file = g_key_file_new();
+		gchar* config_dir = g_strconcat(geany->app->configdir, G_DIR_SEPARATOR_S "plugins" G_DIR_SEPARATOR_S
+			"codenav" G_DIR_SEPARATOR_S, NULL);
+		gchar* config_filename = g_strconcat(config_dir, "codenav.conf", NULL);
+
+		g_key_file_load_from_file(key_file, config_filename, G_KEY_FILE_NONE, NULL);
+
+		/* Build an array of language names */
+		lang_names = g_malloc(nb_languages * sizeof(gchar*));
+		for(lang_iterator = languages_extensions, i=0 ;
+			lang_iterator != NULL ;
+			lang_iterator = lang_iterator->next, i++)
+		{
+			lang_names[i] = ((const LanguageExtensions*)(lang_iterator->data))->language_name;
+		}
+
+		g_key_file_set_string_list(key_file, "switching", "languages", lang_names, nb_languages);
+
+		g_free(lang_names);
+
+		/* Finally write to the config file */
+		if (!g_file_test(config_dir, G_FILE_TEST_IS_DIR)
+		    && utils_mkdir(config_dir, TRUE) != 0)
+		{
+			dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("Plugin configuration directory could not be created."));
+		}
+		else
+		{
+			gchar* data = g_key_file_to_data(key_file, NULL, NULL);
+			utils_write_file(config_filename, data);
+			g_free(data);
+		}
+
+		g_free(config_dir);
+		g_free(config_filename);
+		g_key_file_free(key_file);
 	}
 }
 
@@ -519,9 +575,9 @@
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *cell_renderer;
 	GtkTreeIter iter;
-	guint i, j, k;
-	gchar** str_array = NULL;
-	gchar* str = NULL;
+	GSList* p_le = NULL;
+	gchar* p_str = NULL;
+	gint i=0;
 
 	typedef enum { COLUMN_HEAD, COLUMN_IMPL, NB_COLUMNS } Column;
 
@@ -542,52 +598,41 @@
 	/* Add a list containing the extensions for each language (headers / implementations) */
 	/* - create the GtkListStore */
 	list_store = gtk_list_store_new(NB_COLUMNS, G_TYPE_STRING, G_TYPE_STRING);
-	for(i=0 ; i < languages_extensions->len ; i++)
+	for(p_le = languages_extensions ; p_le != NULL ; p_le = p_le->next)
 	{
-		LanguageExtensions* le = &(g_array_index(languages_extensions, LanguageExtensions, i));
-		GArray* extensions = NULL;
+		LanguageExtensions* le = (LanguageExtensions*)(p_le->data);
+		GSList* p_extensions = NULL;
+		GSList* p_ext = NULL;
 		Column col;
 
-		if(le->head_extensions->len == 0 || le->impl_extensions->len == 0)
+		if(le->head_extensions == NULL || le->impl_extensions == NULL)
 			continue;
 
 		/* Fill the GtkListStore with comma-separated strings */
 		/* loop : "headers", then "implementations" */
 		col = COLUMN_HEAD;
-		extensions = le->head_extensions;
-		for(j=0 ; j<2 ; j++)
+		p_extensions = le->head_extensions;
+		for(i=0 ; i<2 ; i++)
 		{
 			/* Copy extensions to str_array and then join the strings, separated with commas. */
-			str_array = g_malloc((extensions->len+1) * sizeof(gchar*));
-
-			log_debug("DEBUG : extensions->len == %d", extensions->len);
-			log_debug("DEBUG : head_extensions->len == %d", le->head_extensions->len);
-			log_debug("DEBUG : impl_extensions->len == %d", le->impl_extensions->len);
-			for(k=0 ; k < extensions->len ; k++)
+			p_str = NULL;
+			for(p_ext = p_extensions ; p_ext != NULL ; p_ext = p_ext->next)
 			{
-				str_array[k] = g_strdup(g_array_index(extensions, gchar*, k));
-				log_debug("DEBUG : str_array[%d] == %s", k, str_array[k]);
+				gchar* temp = p_str;
+				p_str = g_strjoin(",", (const gchar*)(p_ext->data), p_str, NULL);
+				g_free(temp);
 			}
-			str_array[k] = NULL;
+			log_debug("DEBUG : str == \"%s\"", p_str);
 
-			str = g_strjoinv(",", str_array);
-
-			log_debug("DEBUG : str == \"%s\"", str);
-
-			if(j == 0)
+			if(i == 0)
 				gtk_list_store_append(list_store, &iter);
-			gtk_list_store_set(list_store, &iter, col, str, -1);
+			gtk_list_store_set(list_store, &iter, col, p_str, -1);
 
-			g_free(str);
+			g_free(p_str);
 
-			for(k=0 ; k < extensions->len ; k++)
-				g_free(str_array[k]);
-
-			g_free(str_array);
-
 			/* Next iteration : "implementations" */
 			col = COLUMN_IMPL;
-			extensions = le->impl_extensions;
+			p_extensions = le->impl_extensions;
 		}
 	}
 
@@ -641,32 +686,25 @@
  * Be sure to leave Geany as it was before plugin_init(). */
 void plugin_cleanup(void)
 {
-	guint i=0, j=0;
-	LanguageExtensions* p_lang = NULL;
+	GSList* p_le = NULL;
 
 	log_debug("DEBUG : plugin_cleanup\n");
 
-	/* For each language : */
-	for(i=0 ; i < languages_extensions->len ; i++)
+	for(p_le = languages_extensions ; p_le != NULL ; p_le = p_le->next)
 	{
-		p_lang = &(g_array_index(languages_extensions, LanguageExtensions, i));
+		LanguageExtensions* le = (LanguageExtensions*)(p_le->data);
 
-		/* Free the headers' extensions array */
-		for(j=0 ; j < p_lang->head_extensions->len ; j++)
-			g_free(g_array_index(p_lang->head_extensions, gchar*, j));
+		g_slist_foreach(le->head_extensions, (GFunc)(&g_free), NULL);
+		g_slist_free(le->head_extensions);
 
-		g_array_free(p_lang->head_extensions, TRUE);
-
-		/* Free the implementations' extensions array */
-		for(j=0 ; j < p_lang->impl_extensions->len ; j++)
-			g_free(g_array_index(p_lang->impl_extensions, gchar*, j));
-
-		g_array_free(p_lang->impl_extensions, TRUE);
+		g_slist_foreach(le->impl_extensions, (GFunc)(&g_free), NULL);
+		g_slist_free(le->impl_extensions);
 	}
 
-	g_array_free(languages_extensions, TRUE);
+	g_slist_free(languages_extensions);
 
 	/* remove the menu item added in plugin_init() */
 	gtk_widget_destroy(switch_menu_item);
 	gtk_widget_destroy(goto_file_menu_item);
+	gtk_widget_destroy(file_menu_item_separator);
 }

Modified: trunk/geany-plugins/po/fr.po
===================================================================
--- trunk/geany-plugins/po/fr.po	2009-08-24 19:43:29 UTC (rev 905)
+++ trunk/geany-plugins/po/fr.po	2009-08-25 22:02:37 UTC (rev 906)
@@ -9,7 +9,7 @@
 "Project-Id-Version: geany-plugins 0.17\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2009-07-04 18:21+0200\n"
-"PO-Revision-Date: 2009-07-04 11:46+0100\n"
+"PO-Revision-Date: 2009-07-20 20:02+0100\n"
 "Last-Translator: Lionel Fuentes <funto66 at gmail.com>\n"
 "Language-Team: French <geany-i18n at uvena.de>\n"
 "MIME-Version: 1.0\n"
@@ -37,18 +37,18 @@
 msgid "Various small addons for Geany."
 msgstr "Diverses petites additions pour Geany"
 
-#: ../addons/src/addons.c:176 ../geanylatex/src/geanylatex.c:181
+#: ../addons/src/addons.c:176
+#: ../geanylatex/src/geanylatex.c:181
 #: ../geanysendmail/src/geanysendmail.c:151
-#: ../geanysendmail/src/geanysendmail.c:312 ../geanyvc/src/geanyvc.c:1673
+#: ../geanysendmail/src/geanysendmail.c:312
+#: ../geanyvc/src/geanyvc.c:1673
 #: ../spellcheck/src/scplugin.c:143
 msgid "Plugin configuration directory could not be created."
 msgstr "Le répertoire de configuration du plugin n'a pas pu être créé."
 
 #: ../addons/src/addons.c:198
 msgid "Show toolbar item to show a list of currently open documents"
-msgstr ""
-"Montrer le bouton dans la barre d'outils servant à montrer la liste des "
-"documents actuellement ouverts"
+msgstr "Montrer le bouton dans la barre d'outils servant à montrer la liste des documents actuellement ouverts"
 
 #. TODO fix the string
 #: ../addons/src/addons.c:205
@@ -57,7 +57,7 @@
 
 #: ../addons/src/addons.c:211
 msgid "Show available tasks in the Message Window"
-msgstr "Montrer l'icône d'état dans la zone de notification"
+msgstr "Montrer les tâches disponibles dans la fenêtre des messages"
 
 #: ../addons/src/addons.c:217
 msgid "Show status icon in the Notification Area"
@@ -137,9 +137,7 @@
 msgstr ""
 
 #: ../geanygdb/src/gdb-io-read.c:277
-msgid ""
-"This executable does not appear to contain the required debugging "
-"information."
+msgid "This executable does not appear to contain the required debugging information."
 msgstr ""
 
 #: ../geanygdb/src/gdb-io-read.c:539
@@ -217,7 +215,8 @@
 msgid "reason:"
 msgstr "raison:"
 
-#: ../geanygdb/src/gdb-io-run.c:541 ../geanygdb/src/gdb-io-run.c:606
+#: ../geanygdb/src/gdb-io-run.c:541
+#: ../geanygdb/src/gdb-io-run.c:606
 #, c-format
 msgid "Directory %s not found!\n"
 msgstr "Répertoire %s introuvable !\n"
@@ -279,11 +278,13 @@
 msgid "No %s selected"
 msgstr ""
 
-#: ../geanygdb/src/gdb-ui-break.c:108 ../geanygdb/src/gdb-ui-break.c:343
+#: ../geanygdb/src/gdb-ui-break.c:108
+#: ../geanygdb/src/gdb-ui-break.c:343
 msgid "watchpoint"
 msgstr ""
 
-#: ../geanygdb/src/gdb-ui-break.c:108 ../geanygdb/src/gdb-ui-break.c:343
+#: ../geanygdb/src/gdb-ui-break.c:108
+#: ../geanygdb/src/gdb-ui-break.c:343
 #: ../geanygdb/src/gdb-ui-break.c:397
 msgid "breakpoint"
 msgstr ""
@@ -368,7 +369,8 @@
 " Search path for executables:"
 msgstr ""
 
-#: ../geanygdb/src/gdb-ui-envir.c:151 ../geanylua/gsdlg.c:226
+#: ../geanygdb/src/gdb-ui-envir.c:151
+#: ../geanylua/gsdlg.c:226
 msgid "Select Font"
 msgstr "Sélectionner une police"
 
@@ -416,7 +418,8 @@
 msgid "Return to previous dialog."
 msgstr ""
 
-#: ../geanygdb/src/gdb-ui-frame.c:297 ../geanygdb/src/gdb-ui-frame.c:371
+#: ../geanygdb/src/gdb-ui-frame.c:297
+#: ../geanygdb/src/gdb-ui-frame.c:371
 msgid "Display additional information about the selected item."
 msgstr "Affiche des informations supplémentaires sur l'item sélectionné"
 
@@ -796,11 +799,13 @@
 msgid "Choose the kind of document you want to write"
 msgstr ""
 
-#: ../geanylatex/src/geanylatex.c:750 ../geanylatex/src/bibtexlabels.c:27
+#: ../geanylatex/src/geanylatex.c:750
+#: ../geanylatex/src/bibtexlabels.c:27
 msgid "Book"
 msgstr ""
 
-#: ../geanylatex/src/geanylatex.c:752 ../geanylatex/src/bibtexlabels.c:26
+#: ../geanylatex/src/geanylatex.c:752
+#: ../geanylatex/src/bibtexlabels.c:26
 msgid "Article"
 msgstr ""
 
@@ -840,9 +845,7 @@
 msgstr ""
 
 #: ../geanylatex/src/geanylatex.c:805
-msgid ""
-"Sets the value of the \\author command. In most cases this should be your "
-"name"
+msgid "Sets the value of the \\author command. In most cases this should be your name"
 msgstr ""
 
 #. Date
@@ -851,10 +854,7 @@
 msgstr ""
 
 #: ../geanylatex/src/geanylatex.c:819
-msgid ""
-"Sets the value of the \\date command inside header of your\t\t newly created "
-"LaTeX-document. Keeping it at \\today is a good \t\t decision if you don't "
-"need any fixed date."
+msgid "Sets the value of the \\date command inside header of your\t\t newly created LaTeX-document. Keeping it at \\today is a good \t\t decision if you don't need any fixed date."
 msgstr ""
 
 #. Title of the new document
@@ -887,8 +887,7 @@
 #: ../geanylatex/src/geanylatex.c:868
 msgid ""
 "Uses the KOMA-script classes by Markus Kohm.\n"
-"Keep in mind: To compile your document these classeshave to be installed "
-"before."
+"Keep in mind: To compile your document these classeshave to be installed before."
 msgstr ""
 
 #: ../geanylatex/src/geanylatex.c:875
@@ -896,9 +895,7 @@
 msgstr ""
 
 #: ../geanylatex/src/geanylatex.c:877
-msgid ""
-"Set the draft flag inside new created documents to get documents with a "
-"number of debugging helpers"
+msgid "Set the draft flag inside new created documents to get documents with a number of debugging helpers"
 msgstr ""
 
 #: ../geanylatex/src/geanylatex.c:1091
@@ -1084,7 +1081,8 @@
 msgid "IBM 852 code page"
 msgstr ""
 
-#: ../geanylatex/src/latexencodings.c:57 ../geanylatex/src/letters.c:41
+#: ../geanylatex/src/latexencodings.c:57
+#: ../geanylatex/src/letters.c:41
 #: ../geanylatex/src/bibtexlabels.c:35
 msgid "Misc"
 msgstr ""
@@ -1307,9 +1305,7 @@
 msgstr ""
 
 #: ../geanylatex/src/bibtexlabels.c:111
-msgid ""
-"Hidden field used for specifying or overriding the alphabetical order of "
-"entries"
+msgid "Hidden field used for specifying or overriding the alphabetical order of entries"
 msgstr ""
 
 #: ../geanylatex/src/bibtexlabels.c:112
@@ -1466,9 +1462,7 @@
 msgstr ""
 
 #: ../geanysendmail/src/geanysendmail.c:47
-msgid ""
-"A little plugin to send the current file as attachment by user's favorite "
-"mailer"
+msgid "A little plugin to send the current file as attachment by user's favorite mailer"
 msgstr ""
 
 #: ../geanysendmail/src/geanysendmail.c:107
@@ -1484,9 +1478,7 @@
 msgstr ""
 
 #: ../geanysendmail/src/geanysendmail.c:172
-msgid ""
-"Recipient address placeholder not found. The executed command might have "
-"failed."
+msgid "Recipient address placeholder not found. The executed command might have failed."
 msgstr ""
 
 #: ../geanysendmail/src/geanysendmail.c:184
@@ -1547,8 +1539,7 @@
 msgstr "Envoyer par _mail"
 
 #: ../geanysendmail/src/geanysendmail.c:414
-msgid ""
-"Sends the opened file as unzipped attachment by any mailer from your $PATH"
+msgid "Sends the opened file as unzipped attachment by any mailer from your $PATH"
 msgstr ""
 
 #: ../geanyvc/src/geanyvc.c:64
@@ -1574,12 +1565,14 @@
 msgid "geanyvc: s_spawn_sync error: %s"
 msgstr ""
 
-#: ../geanyvc/src/geanyvc.c:600 ../geanyvc/src/geanyvc.c:611
+#: ../geanyvc/src/geanyvc.c:600
+#: ../geanyvc/src/geanyvc.c:611
 #, c-format
 msgid "geanyvc: vcdiff_file_activated: Unable to rename '%s' to '%s'"
 msgstr ""
 
-#: ../geanyvc/src/geanyvc.c:637 ../geanyvc/src/geanyvc.c:686
+#: ../geanyvc/src/geanyvc.c:637
+#: ../geanyvc/src/geanyvc.c:686
 msgid "No changes were made."
 msgstr ""
 
@@ -1587,7 +1580,8 @@
 msgid "No history avaible"
 msgstr ""
 
-#: ../geanyvc/src/geanyvc.c:905 ../geanyvc/src/geanyvc.c:913
+#: ../geanyvc/src/geanyvc.c:905
+#: ../geanyvc/src/geanyvc.c:913
 #, c-format
 msgid "Do you really want to revert: %s?"
 msgstr ""
@@ -1627,7 +1621,8 @@
 msgstr ""
 
 #. Commit all changes
-#: ../geanyvc/src/geanyvc.c:1314 ../geanyvc/src/geanyvc.c:2170
+#: ../geanyvc/src/geanyvc.c:1314
+#: ../geanyvc/src/geanyvc.c:2170
 msgid "_Commit"
 msgstr ""
 
@@ -1642,9 +1637,7 @@
 
 #: ../geanyvc/src/geanyvc.c:1442
 #, c-format
-msgid ""
-"Error while setting up language for spellchecking. Please check "
-"configuration. Error message was: %s"
+msgid "Error while setting up language for spellchecking. Please check configuration. Error message was: %s"
 msgstr ""
 
 #: ../geanyvc/src/geanyvc.c:1706
@@ -1652,10 +1645,7 @@
 msgstr ""
 
 #: ../geanyvc/src/geanyvc.c:1709
-msgid ""
-"If this option is activated, every new by the VC-plugin created document tab "
-"will be marked as changed. Even this option is useful in some cases, it "
-"could cause a big number of annoying \"Do you want to save\"-dialogs."
+msgid "If this option is activated, every new by the VC-plugin created document tab will be marked as changed. Even this option is useful in some cases, it could cause a big number of annoying \"Do you want to save\"-dialogs."
 msgstr ""
 
 #: ../geanyvc/src/geanyvc.c:1717
@@ -1717,7 +1707,8 @@
 #. Diff of current file
 #. Diff of the current dir
 #. Complete diff of base directory
-#: ../geanyvc/src/geanyvc.c:1927 ../geanyvc/src/geanyvc.c:2011
+#: ../geanyvc/src/geanyvc.c:1927
+#: ../geanyvc/src/geanyvc.c:2011
 #: ../geanyvc/src/geanyvc.c:2052
 msgid "_Diff"
 msgstr ""
@@ -1729,7 +1720,8 @@
 #. Revert current file
 #. Revert current dir
 #. Revert everything
-#: ../geanyvc/src/geanyvc.c:1936 ../geanyvc/src/geanyvc.c:2020
+#: ../geanyvc/src/geanyvc.c:1936
+#: ../geanyvc/src/geanyvc.c:2020
 #: ../geanyvc/src/geanyvc.c:2061
 msgid "_Revert"
 msgstr ""
@@ -1750,7 +1742,8 @@
 #. History/log of current file
 #. History/log of the current dir
 #. Complete History/Log of base directory
-#: ../geanyvc/src/geanyvc.c:1960 ../geanyvc/src/geanyvc.c:2031
+#: ../geanyvc/src/geanyvc.c:1960
+#: ../geanyvc/src/geanyvc.c:2031
 #: ../geanyvc/src/geanyvc.c:2073
 msgid "_History"
 msgstr ""
@@ -1977,7 +1970,8 @@
 msgid "Default (%s)"
 msgstr ""
 
-#: ../spellcheck/src/gui.c:423 ../spellcheck/src/gui.c:434
+#: ../spellcheck/src/gui.c:423
+#: ../spellcheck/src/gui.c:434
 msgid "unknown"
 msgstr ""
 
@@ -1998,15 +1992,18 @@
 msgid "Shift a selection left and right"
 msgstr "Déplacer une sélection vers la gauche ou la droite"
 
-#: ../shiftcolumn/src/shiftcolumn.c:375 ../shiftcolumn/src/shiftcolumn.c:395
+#: ../shiftcolumn/src/shiftcolumn.c:375
+#: ../shiftcolumn/src/shiftcolumn.c:395
 msgid "Shift Left"
 msgstr "Déplacer vers la gauche"
 
-#: ../shiftcolumn/src/shiftcolumn.c:382 ../shiftcolumn/src/shiftcolumn.c:397
+#: ../shiftcolumn/src/shiftcolumn.c:382
+#: ../shiftcolumn/src/shiftcolumn.c:397
 msgid "Shift Right"
 msgstr "Déplacer vers la droite"
 
-#: ../geanylua/gsdlg_lua.c:95 ../geanylua/glspi_kfile.c:54
+#: ../geanylua/gsdlg_lua.c:95
+#: ../geanylua/glspi_kfile.c:54
 #: ../geanylua/glspi.h:96
 #, c-format
 msgid ""
@@ -2016,7 +2013,8 @@
 "Erreur dans le module \"%s\" à la fonction %s():\n"
 "attendait le type \"%s\" pour l'argument #%d\n"
 
-#: ../geanylua/gsdlg_lua.c:108 ../geanylua/glspi.h:124
+#: ../geanylua/gsdlg_lua.c:108
+#: ../geanylua/glspi.h:124
 #, c-format
 msgid ""
 "Error in module \"%s\" at function %s():\n"
@@ -2084,7 +2082,8 @@
 "Erreur dans le module \"%s\" à la fonction %s():\n"
 "pas assez d'arguments pour la commande \"%s\".\n"
 
-#: ../geanylua/glspi_sci.c:651 ../geanylua/glspi_app.c:399
+#: ../geanylua/glspi_sci.c:651
+#: ../geanylua/glspi_app.c:399
 #, c-format
 msgid ""
 "Error in module \"%s\" at function %s():\n"
@@ -2110,7 +2109,8 @@
 msgid "<too large to display>"
 msgstr "<trop large pour l'afficher>"
 
-#: ../geanylua/gsdlg.c:103 ../geanylua/glspi_dlg.c:421
+#: ../geanylua/gsdlg.c:103
+#: ../geanylua/glspi_dlg.c:421
 msgid "Open file"
 msgstr "Ouvrir"
 
@@ -2256,7 +2256,8 @@
 "attendait la chaîne \"open\" ou \"save\" pour l'argument #1.\n"
 " "
 
-#: ../geanylua/glspi_run.c:112 ../geanylua/glspi_run.c:119
+#: ../geanylua/glspi_run.c:112
+#: ../geanylua/glspi_run.c:119
 msgid "Lua script error:"
 msgstr "Erreur du script Lua :"
 
@@ -2298,10 +2299,8 @@
 
 #~ msgid "Load Mini-Script File"
 #~ msgstr "Chargement du mini-script"
-
 #~ msgid "Save Mini-Script File"
 #~ msgstr "Sauvegarde du Mini-script"
-
 #~ msgid ""
 #~ "<b>GMS : Geany Mini-Script filter Plugin</b>\n"
 #~ "This plugin is a tools to apply a script filter on :\n"
@@ -2348,54 +2347,38 @@
 #~ "General Public License as published by the Free\n"
 #~ "Software Foundation; either version 2 of the License,\n"
 #~ "or (at your option) any later version."
-
 #~ msgid "Mini-Script Filter"
 #~ msgstr "Filtre Mini-Script"
-
 #~ msgid "Clear the mini-script window"
 #~ msgstr "Efface la fenêtre du mini-script"
-
 #~ msgid "Load a mini-script into this window"
 #~ msgstr "Charge un fichier mini-script dans la fenêtre"
-
 #~ msgid "Save the mini-script into a file"
 #~ msgstr "Sauve le mini-script courant dans un fichier"
-
 #~ msgid "select the mini-script type"
 #~ msgstr "Sélectionne le type du mini-script"
-
 #~ msgid "filter input"
 #~ msgstr "Entrée du filtre"
-
 #~ msgid "select the input of mini-script filter"
 #~ msgstr "Sélectionne l'entrée du mini-script"
-
 #~ msgid "session"
 #~ msgstr "session"
-
 #~ msgid "filter output"
 #~ msgstr "sortie du filtre"
-
 #~ msgid "select the output of mini-script filter"
 #~ msgstr "Sélectionne la sortie du mini-script"
-
 #~ msgid "Current Doc."
 #~ msgstr "Doc. courant"
-
 #~ msgid "New Doc."
 #~ msgstr "Nouveau Doc."
-
 #~ msgid "script configuration"
 #~ msgstr "Configuration du script"
-
 #~ msgid "geany mini-script"
 #~ msgstr "mini-script pour geany"
-
 #~ msgid "GMS (Geany Mini-Script filter plugin)"
 #~ msgstr "GMS ( plugin Geany Mini-Script)"
-
 #~ msgid "Pascal BURLOT, a Geany user"
 #~ msgstr "Pascal BURLOT, un utilisateur de Geany"
-
 #~ msgid "_Mini-Script"
 #~ msgstr "_Mini-script"
+


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



More information about the Plugins-Commits mailing list