# HG changeset patch # User Nathan Walp # Date 1168230376 0 # Node ID 7d6bd7a4994f98f13d0398f87dfaaa6cd1441626 # Parent e5c75076c6d184612deed536e3a05d77706d16d1 [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 diff -r e5c75076c6d1 -r 7d6bd7a4994f console/gntplugin.c --- 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 diff -r e5c75076c6d1 -r 7d6bd7a4994f gtk/gtkplugin.c --- 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 diff -r e5c75076c6d1 -r 7d6bd7a4994f libgaim/plugin.c --- 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); } diff -r e5c75076c6d1 -r 7d6bd7a4994f libgaim/plugin.h --- 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. *