SF.net SVN: geany:[4200] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Sep 16 17:30:30 UTC 2009


Revision: 4200
          http://geany.svn.sourceforge.net/geany/?rev=4200&view=rev
Author:   ntrel
Date:     2009-09-16 17:30:30 +0000 (Wed, 16 Sep 2009)

Log Message:
-----------
Make editor_prefs.snippets hash table private (not a pref).

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-09-16 14:13:38 UTC (rev 4199)
+++ trunk/ChangeLog	2009-09-16 17:30:30 UTC (rev 4200)
@@ -6,6 +6,8 @@
    in).
  * src/document.c:
    Don't move the cursor when reloading.
+ * src/plugindata.h, src/editor.c, src/editor.h:
+   Make editor_prefs.snippets hash table private (not a pref).
 
 
 2009-09-15  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>

Modified: trunk/src/editor.c
===================================================================
--- trunk/src/editor.c	2009-09-16 14:13:38 UTC (rev 4199)
+++ trunk/src/editor.c	2009-09-16 17:30:30 UTC (rev 4200)
@@ -66,6 +66,7 @@
 #define SSM(s, m, w, l) scintilla_send_message(s, m, w, l)
 
 
+static GHashTable *snippet_hash = NULL;
 static GeanyQueue *snippet_queue = NULL;
 static gint snippet_cursor_insert_pos;
 
@@ -105,7 +106,7 @@
 
 void editor_snippets_free(void)
 {
-	g_hash_table_destroy(editor_prefs.snippets);
+	g_hash_table_destroy(snippet_hash);
 	queue_destroy(snippet_queue);
 }
 
@@ -136,7 +137,7 @@
 	g_key_file_load_from_file(userconfig, userconfigfile, G_KEY_FILE_NONE, NULL);
 
 	/* keys are strings, values are GHashTables, so use g_free and g_hash_table_destroy */
-	editor_prefs.snippets =
+	snippet_hash =
 		g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_destroy);
 
 	/* first read all globally defined auto completions */
@@ -146,7 +147,7 @@
 		keys_sys = g_key_file_get_keys(sysconfig, groups_sys[i], &len_keys, NULL);
 		/* create new hash table for the read section (=> filetype) */
 		tmp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-		g_hash_table_insert(editor_prefs.snippets, g_strdup(groups_sys[i]), tmp);
+		g_hash_table_insert(snippet_hash, g_strdup(groups_sys[i]), tmp);
 
 		for (j = 0; j < len_keys; j++)
 		{
@@ -162,11 +163,11 @@
 	{
 		keys_user = g_key_file_get_keys(userconfig, groups_user[i], &len_keys, NULL);
 
-		tmp = g_hash_table_lookup(editor_prefs.snippets, groups_user[i]);
+		tmp = g_hash_table_lookup(snippet_hash, groups_user[i]);
 		if (tmp == NULL)
 		{	/* new key found, create hash table */
 			tmp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
-			g_hash_table_insert(editor_prefs.snippets, g_strdup(groups_user[i]), tmp);
+			g_hash_table_insert(snippet_hash, g_strdup(groups_user[i]), tmp);
 		}
 		for (j = 0; j < len_keys; j++)
 		{
@@ -2012,7 +2013,7 @@
 
 	g_return_val_if_fail(type != NULL && name != NULL, NULL);
 
-	tmp = g_hash_table_lookup(editor_prefs.snippets, type);
+	tmp = g_hash_table_lookup(snippet_hash, type);
 	if (tmp != NULL)
 	{
 		result = g_hash_table_lookup(tmp, name);
@@ -2021,7 +2022,7 @@
 	 * the particular completion for this filetype is not set (result is NULL) */
 	if (tmp == NULL || result == NULL)
 	{
-		tmp = g_hash_table_lookup(editor_prefs.snippets, "Default");
+		tmp = g_hash_table_lookup(snippet_hash, "Default");
 		if (tmp != NULL)
 		{
 			result = g_hash_table_lookup(tmp, name);
@@ -2226,7 +2227,7 @@
 	pos -= str_len; /* pos has changed while deleting */
 
 	/* replace 'special' completions */
-	specials = g_hash_table_lookup(editor_prefs.snippets, "Special");
+	specials = g_hash_table_lookup(snippet_hash, "Special");
 	if (G_LIKELY(specials != NULL))
 	{
 		/* ugly hack using global_pattern */

Modified: trunk/src/editor.h
===================================================================
--- trunk/src/editor.h	2009-09-16 14:13:38 UTC (rev 4199)
+++ trunk/src/editor.h	2009-09-16 17:30:30 UTC (rev 4200)
@@ -120,7 +120,6 @@
 	gboolean	complete_snippets;
 	gint		symbolcompletion_min_chars;
 	gint		symbolcompletion_max_height;
-	GHashTable	*snippets;
 	gboolean	brace_match_ltgt;	/* whether to highlight < and > chars (hidden pref) */
 	gboolean	use_gtk_word_boundaries;	/* hidden pref */
 	gboolean	complete_snippets_whilst_editing;	/* hidden pref */

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2009-09-16 14:13:38 UTC (rev 4199)
+++ trunk/src/plugindata.h	2009-09-16 17:30:30 UTC (rev 4200)
@@ -56,7 +56,7 @@
 	 * existing fields in the plugin data types have to be changed or reordered. */
 	/* This should usually stay the same if fields are only appended, assuming only pointers to
 	 * structs and not structs themselves are declared by plugins. */
-	GEANY_ABI_VERSION = 65
+	GEANY_ABI_VERSION = 66
 };
 
 /** Check the plugin can be loaded by Geany.


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