Mercurial > pidgin
annotate libgaim/plugins/perl/common/PluginPref.xs @ 15065:e53cceebebb3
[gaim-migrate @ 17849]
Update the Perl HOWTO to include working samples and various other fixes.
In order to actually do this, I had to also make some fixes to the perl bindings.
committer: Tailor Script <tailor@pidgin.im>
| author | Daniel Atallah <daniel.atallah@gmail.com> |
|---|---|
| date | Wed, 29 Nov 2006 23:46:55 +0000 |
| parents | 60b1bc8dbf37 |
| children |
| rev | line source |
|---|---|
| 14192 | 1 #include "module.h" |
| 2 | |
| 3 MODULE = Gaim::PluginPref PACKAGE = Gaim::PluginPref::Frame PREFIX = gaim_plugin_pref_frame_ | |
| 4 PROTOTYPES: ENABLE | |
| 5 | |
| 6 void | |
| 7 gaim_plugin_pref_frame_add(frame, pref) | |
| 8 Gaim::PluginPref::Frame frame | |
| 9 Gaim::PluginPref pref | |
| 10 | |
| 11 void | |
| 12 gaim_plugin_pref_frame_destroy(frame) | |
| 13 Gaim::PluginPref::Frame frame | |
| 14 | |
| 15 void | |
| 16 gaim_plugin_pref_frame_get_prefs(frame) | |
| 17 Gaim::PluginPref::Frame frame | |
| 18 PREINIT: | |
| 19 GList *l; | |
| 20 PPCODE: | |
| 21 for (l = gaim_plugin_pref_frame_get_prefs(frame); l != NULL; l = l->next) { | |
| 22 XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::PluginPref"))); | |
| 23 } | |
| 24 | |
| 25 Gaim::PluginPref::Frame | |
| 26 gaim_plugin_pref_frame_new(class) | |
| 27 C_ARGS: /* void */ | |
| 28 | |
| 29 MODULE = Gaim::PluginPref PACKAGE = Gaim::PluginPref PREFIX = gaim_plugin_pref_ | |
| 30 PROTOTYPES: ENABLE | |
| 31 | |
| 32 void | |
| 33 gaim_plugin_pref_add_choice(pref, label, choice) | |
| 34 Gaim::PluginPref pref | |
| 35 const char *label | |
|
15065
e53cceebebb3
[gaim-migrate @ 17849]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
36 # Do the appropriate conversion based on the perl type specified. |
|
e53cceebebb3
[gaim-migrate @ 17849]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
37 # Currently only Strings and Ints will work. |
|
e53cceebebb3
[gaim-migrate @ 17849]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
14192
diff
changeset
|
38 gpointer choice = (SvPOKp($arg) ? SvPV($arg, PL_na) : (SvIOKp($arg) ? GINT_TO_POINTER(SvIV($arg)) : NULL)); |
| 14192 | 39 |
| 40 void | |
| 41 gaim_plugin_pref_destroy(pref) | |
| 42 Gaim::PluginPref pref | |
| 43 | |
| 44 | |
| 45 void | |
| 46 gaim_plugin_pref_get_bounds(pref, min, max) | |
| 47 Gaim::PluginPref pref | |
| 48 int *min | |
| 49 int *max | |
| 50 | |
| 51 void | |
| 52 gaim_plugin_pref_get_choices(pref) | |
| 53 Gaim::PluginPref pref | |
| 54 PREINIT: | |
| 55 GList *l; | |
| 56 PPCODE: | |
| 57 for (l = gaim_plugin_pref_get_choices(pref); l != NULL; l = l->next) { | |
| 58 XPUSHs(sv_2mortal(gaim_perl_bless_object(l->data, "Gaim::ListItem"))); | |
| 59 } | |
| 60 | |
| 61 const char * | |
| 62 gaim_plugin_pref_get_label(pref) | |
| 63 Gaim::PluginPref pref | |
| 64 | |
| 65 gboolean | |
| 66 gaim_plugin_pref_get_masked(pref) | |
| 67 Gaim::PluginPref pref | |
| 68 | |
| 69 unsigned int | |
| 70 gaim_plugin_pref_get_max_length(pref) | |
| 71 Gaim::PluginPref pref | |
| 72 | |
| 73 const char * | |
| 74 gaim_plugin_pref_get_name(pref) | |
| 75 Gaim::PluginPref pref | |
| 76 | |
| 77 Gaim::PluginPrefType | |
| 78 gaim_plugin_pref_get_type(pref) | |
| 79 Gaim::PluginPref pref | |
| 80 | |
| 81 Gaim::PluginPref | |
| 82 gaim_plugin_pref_new(class) | |
| 83 C_ARGS: /* void */ | |
| 84 | |
| 85 Gaim::PluginPref | |
| 86 gaim_plugin_pref_new_with_label(class, label) | |
| 87 const char *label | |
| 88 C_ARGS: | |
| 89 label | |
| 90 | |
| 91 Gaim::PluginPref | |
| 92 gaim_plugin_pref_new_with_name(class, name) | |
| 93 const char *name | |
| 94 C_ARGS: | |
| 95 name | |
| 96 | |
| 97 Gaim::PluginPref | |
| 98 gaim_plugin_pref_new_with_name_and_label(class, name, label) | |
| 99 const char *name | |
| 100 const char *label | |
| 101 C_ARGS: | |
| 102 name, label | |
| 103 | |
| 104 void | |
| 105 gaim_plugin_pref_set_bounds(pref, min, max) | |
| 106 Gaim::PluginPref pref | |
| 107 int min | |
| 108 int max | |
| 109 | |
| 110 void | |
| 111 gaim_plugin_pref_set_label(pref, label) | |
| 112 Gaim::PluginPref pref | |
| 113 const char *label | |
| 114 | |
| 115 void | |
| 116 gaim_plugin_pref_set_masked(pref, mask) | |
| 117 Gaim::PluginPref pref | |
| 118 gboolean mask | |
| 119 | |
| 120 void | |
| 121 gaim_plugin_pref_set_max_length(pref, max_length) | |
| 122 Gaim::PluginPref pref | |
| 123 unsigned int max_length | |
| 124 | |
| 125 void | |
| 126 gaim_plugin_pref_set_name(pref, name) | |
| 127 Gaim::PluginPref pref | |
| 128 const char *name | |
| 129 | |
| 130 void | |
| 131 gaim_plugin_pref_set_type(pref, type) | |
| 132 Gaim::PluginPref pref | |
| 133 Gaim::PluginPrefType type | |
| 134 PREINIT: | |
| 135 GaimPluginPrefType gpp_type; | |
| 136 CODE: | |
| 137 gpp_type = GAIM_PLUGIN_PREF_NONE; | |
| 138 | |
| 139 if (type == 1) { | |
| 140 gpp_type = GAIM_PLUGIN_PREF_CHOICE; | |
| 141 } else if (type == 2) { | |
| 142 gpp_type = GAIM_PLUGIN_PREF_INFO; | |
| 143 } | |
| 144 gaim_plugin_pref_set_type(pref, gpp_type); |
