Mercurial > pidgin
changeset 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 |
files | plugins/perl/perl-common.h plugins/perl/perl-handlers.c plugins/perl/perl.c |
diffstat | 3 files changed, 38 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/perl/perl-common.h Sat Jan 14 07:12:46 2006 +0000 +++ b/plugins/perl/perl-common.h Sat Jan 14 08:28:05 2006 +0000 @@ -9,6 +9,7 @@ #include <EXTERN.h> #include <perl.h> +#include "plugin.h" #include "value.h" #define is_hvref(o) \ @@ -23,6 +24,16 @@ #define GAIM_PERL_BOOT(x) \ gaim_perl_callXS(boot_Gaim__##x, cv, mark) +typedef struct +{ + GaimPlugin *plugin; + char *package; + char *load_sub; + char *unload_sub; + char *prefs_sub; + char *gtk_prefs_sub; +} GaimPerlScript; + void gaim_perl_normalize_script_name(char *name); SV *newSVGChar(const char *str);
--- a/plugins/perl/perl-handlers.c Sat Jan 14 07:12:46 2006 +0000 +++ b/plugins/perl/perl-handlers.c Sat Jan 14 08:28:05 2006 +0000 @@ -130,10 +130,13 @@ { /* Sets up the Perl Stack for our call back into the script to run the * plugin_pref... sub */ + int count; + GaimPerlScript *gps; GaimPluginPrefFrame *ret_frame; - int count; dSP; + gps = (GaimPerlScript *)plugin->info->extra_info; + ENTER; SAVETMPS; /* Some perl magic to run perl_plugin_pref_frame_SV perl sub and @@ -141,7 +144,7 @@ PUSHMARK(SP); PUTBACK; - count = call_pv(perl_plugin_pref_cb, G_SCALAR | G_NOARGS); + count = call_pv(gps->prefs_sub, G_SCALAR | G_NOARGS); SPAGAIN;
--- 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 = >k_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; }