diff plugins/perl/perl.c @ 12872:59ff3e1c874e

[gaim-migrate @ 15224] Perl plugins can now each have their own plugin pref frame. Plugin actions are still limited to one per plugin I'll deal with that a bit later. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Sat, 14 Jan 2006 08:28:05 +0000
parents 2422097a7a5e
children 96d611ab3fcb
line wrap: on
line diff
--- a/plugins/perl/perl.c	Sat Jan 14 07:12:46 2006 +0000
+++ b/plugins/perl/perl.c	Sat Jan 14 08:28:05 2006 +0000
@@ -95,15 +95,20 @@
 
 #define PERL_PLUGIN_ID "core-perl"
 
-typedef struct
+PerlInterpreter *my_perl = NULL;
+
+static GaimPluginUiInfo ui_info =
 {
-	GaimPlugin *plugin;
-	char *package;
-	char *load_sub;
-	char *unload_sub;
-} GaimPerlScript;
+	gaim_perl_get_plugin_frame,
+	0,   /* page_num (Reserved) */
+	NULL /* frame (Reserved)    */
+};
 
-PerlInterpreter *my_perl = NULL;
+static GaimGtkPluginUiInfo gtk_ui_info =
+{
+	gaim_perl_gtk_get_plugin_frame,
+	0 /* page_num (Reserved) */
+};
 
 static void
 #ifdef OLD_PERL
@@ -344,20 +349,22 @@
 		/********************************************************/
 			if ((key = hv_fetch(plugin_info, "prefs_info",
 			                    strlen("prefs_info"), 0))) {
-				char *tmp = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len));
 				/* key now is the name of the Perl sub that
 				 * will create a frame for us */
-				info->prefs_info = gaim_perl_plugin_pref(tmp);
-				g_free(tmp);
+				gps->prefs_sub = g_strdup_printf("%s::%s",
+				                                 gps->package,
+				                                 SvPV(*key, len));
+				info->prefs_info = &ui_info;
 			}
 			
 			if ((key = hv_fetch(plugin_info, "gtk_prefs_info",
 			                    strlen("gtk_prefs_info"), 0))) {
-				char *tmp = g_strdup_printf("%s::%s", gps->package, SvPV(*key, len));
 				/* key now is the name of the Perl sub that
 				 * will create a frame for us */
-				info->ui_info = gaim_perl_gtk_plugin_pref(tmp);
-				g_free(tmp);
+				gps->gtk_prefs_sub = g_strdup_printf("%s::%s",
+				                                     gps->package,
+				                                     SvPV(*key, len));
+				info->ui_info = &gtk_ui_info;
 			}
 
 		/********************************************************/
@@ -537,6 +544,8 @@
 			g_free(gps->load_sub);
 			g_free(gps->unload_sub);
 			g_free(gps->package);
+			g_free(gps->prefs_sub);
+			g_free(gps->gtk_prefs_sub);
 			g_free(gps);
 			plugin->info->extra_info = NULL;
 		}