changeset 15295:7d6bd7a4994f

[gaim-migrate @ 18086] core-ify some code...and someone tell me why my gvim and svn aren't getting along and I have to type out this damn message on the command line committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Mon, 08 Jan 2007 04:26:16 +0000
parents e5c75076c6d1
children fd1a584dd5be
files console/gntplugin.c gtk/gtkplugin.c libgaim/plugin.c libgaim/plugin.h
diffstat 4 files changed, 35 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/console/gntplugin.c	Mon Jan 08 04:04:16 2007 +0000
+++ b/console/gntplugin.c	Mon Jan 08 04:26:16 2007 +0000
@@ -88,22 +88,7 @@
 void
 gg_plugins_save_loaded(void)
 {
-	GList *pl;
-	GList *files = NULL;
-	GaimPlugin *p;
-
-	for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
-		p = pl->data;
-
-		if (p->info->type != GAIM_PLUGIN_PROTOCOL &&
-			p->info->type != GAIM_PLUGIN_LOADER) {
-
-			files = g_list_append(files, p->path);
-		}
-	}
-
-	gaim_prefs_set_string_list("/gaim/gnt/plugins/loaded", files);
-	g_list_free(files);
+	gaim_plugins_save_loaded("/gaim/gnt/plugins/loaded");
 }
 
 static void
--- a/gtk/gtkplugin.c	Mon Jan 08 04:04:16 2007 +0000
+++ b/gtk/gtkplugin.c	Mon Jan 08 04:26:16 2007 +0000
@@ -90,22 +90,7 @@
 void
 gaim_gtk_plugins_save(void)
 {
-	GList *pl;
-	GList *files = NULL;
-	GaimPlugin *p;
-
-	for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
-		p = pl->data;
-
-		if (p->info->type != GAIM_PLUGIN_PROTOCOL &&
-			p->info->type != GAIM_PLUGIN_LOADER) {
-
-			files = g_list_append(files, p->path);
-		}
-	}
-
-	gaim_prefs_set_string_list("/gaim/gtk/plugins/loaded", files);
-	g_list_free(files);
+	gaim_plugins_save_loaded("/gaim/gtk/plugins/loaded");
 }
 
 static void
--- a/libgaim/plugin.c	Mon Jan 08 04:04:16 2007 +0000
+++ b/libgaim/plugin.c	Mon Jan 08 04:26:16 2007 +0000
@@ -1200,6 +1200,30 @@
 }
 
 void
+gaim_plugins_save_loaded(const char *key)
+{
+#ifdef GAIM_PLUGINS
+	GList *pl;
+	GList *f;
+	GList *files = NULL;
+	GaimPlugin *p;
+
+	for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) {
+		p = pl->data;
+
+		if (p->info->type != GAIM_PLUGIN_PROTOCOL &&
+			p->info->type != GAIM_PLUGIN_LOADER) {
+				files = g_list_append(files, p->path);
+		}
+	}
+
+	gaim_prefs_set_string_list(key, files);
+	g_list_foreach(files, (GFunc)g_free, NULL);
+	g_list_free(files);
+#endif
+}
+
+void
 gaim_plugins_load_saved(const char *key)
 {
 #ifdef GAIM_PLUGINS
@@ -1256,6 +1280,8 @@
 
 		g_free(basename);
 
+		g_free(filename);
+
 		g_free(f->data);
 	}
 
--- a/libgaim/plugin.h	Mon Jan 08 04:04:16 2007 +0000
+++ b/libgaim/plugin.h	Mon Jan 08 04:26:16 2007 +0000
@@ -469,6 +469,13 @@
 void gaim_plugins_destroy_all(void);
 
 /**
+ * Saves the list of loaded plugins to the specified preference key
+ *
+ * @param key The preference key to save the list of plugins to.
+ */
+void gaim_plugins_save_loaded(const char *key);
+
+/**
  * Attempts to load all the plugins in the specified preference key
  * that were loaded when gaim last quit.
  *