Wed, 30 Jul 2008 03:58:21 +0000
Cleanup unnecessary casts and etc.
| 11118 | 1 | #include "module.h" |
|
23930
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
2 | #include "../perl-handlers.h" |
| 11118 | 3 | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
4 | MODULE = Purple::Prefs PACKAGE = Purple::Prefs PREFIX = purple_prefs_ |
| 11118 | 5 | PROTOTYPES: ENABLE |
| 6 | ||
|
16773
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
7 | BOOT: |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
8 | { |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
9 | HV *stash = gv_stashpv("Purple::Pref::Type", 1); |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
10 | |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
11 | static const constiv *civ, const_iv[] = { |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
12 | #define const_iv(name) {#name, (IV)PURPLE_PREF_##name} |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
13 | const_iv(NONE), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
14 | const_iv(BOOLEAN), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
15 | const_iv(INT), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
16 | const_iv(STRING), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
17 | const_iv(STRING_LIST), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
18 | const_iv(PATH), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
19 | const_iv(PATH_LIST), |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
20 | }; |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
21 | |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
22 | for (civ = const_iv + sizeof(const_iv) / sizeof(const_iv[0]); civ-- > const_iv; ) |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
23 | newCONSTSUB(stash, (char *)civ->name, newSViv(civ->iv)); |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
24 | } |
|
e1171eb45f07
Remove the const-c and const-xs stuff and replace it with real constants
Etan Reisner <deryni@pidgin.im>
parents:
15894
diff
changeset
|
25 | |
| 12780 | 26 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
27 | purple_prefs_add_bool(name, value) |
| 11118 | 28 | const char *name |
| 29 | gboolean value | |
| 30 | ||
| 12780 | 31 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
32 | purple_prefs_add_int(name, value) |
| 11118 | 33 | const char *name |
| 34 | int value | |
| 35 | ||
| 12780 | 36 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
37 | purple_prefs_add_none(name) |
| 11118 | 38 | const char *name |
| 39 | ||
| 12780 | 40 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
41 | purple_prefs_add_string(name, value) |
| 11118 | 42 | const char *name |
| 43 | const char *value | |
| 44 | ||
| 12780 | 45 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
46 | purple_prefs_add_string_list(name, value) |
| 11118 | 47 | const char *name |
| 48 | SV *value | |
| 49 | PREINIT: | |
| 12780 | 50 | GList *t_GL; |
| 51 | int i, t_len; | |
| 11118 | 52 | PPCODE: |
| 12780 | 53 | t_GL = NULL; |
| 54 | t_len = av_len((AV *)SvRV(value)); | |
| 11118 | 55 | |
| 12780 | 56 | for (i = 0; i < t_len; i++) { |
| 57 | STRLEN t_sl; | |
| 58 | t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); | |
| 59 | } | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
60 | purple_prefs_add_string_list(name, t_GL); |
|
21737
fa92350ed598
applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17283
diff
changeset
|
61 | g_list_free(t_GL); |
| 11118 | 62 | |
| 12780 | 63 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
64 | purple_prefs_destroy() |
| 11118 | 65 | |
|
23930
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
66 | guint |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
67 | purple_prefs_connect_callback(plugin, name, callback, data = 0); |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
68 | Purple::Plugin plugin |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
69 | const char *name |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
70 | SV *callback |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
71 | SV *data |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
72 | CODE: |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
73 | RETVAL = purple_perl_prefs_connect_callback(plugin, name, callback, data); |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
74 | OUTPUT: |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
75 | RETVAL |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
76 | |
| 12780 | 77 | void |
|
23930
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
78 | purple_prefs_disconnect_by_handle(plugin) |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
79 | Purple::Plugin plugin |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
80 | CODE: |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
81 | purple_perl_pref_cb_clear_for_plugin(plugin); |
| 11118 | 82 | |
| 12780 | 83 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
84 | purple_prefs_disconnect_callback(callback_id) |
| 11118 | 85 | guint callback_id |
|
23930
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
86 | CODE: |
|
c1c3d7cab338
Add support to the Perl plugin loader for listing for pref changes.
Daniel Atallah <datallah@pidgin.im>
parents:
22835
diff
changeset
|
87 | purple_perl_prefs_disconnect_callback(callback_id); |
| 11118 | 88 | |
| 12780 | 89 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
90 | purple_prefs_exists(name) |
| 11118 | 91 | const char *name |
| 92 | ||
| 12780 | 93 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
94 | purple_prefs_get_bool(name) |
| 11118 | 95 | const char *name |
| 96 | ||
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
97 | Purple::Handle |
|
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
98 | purple_prefs_get_handle() |
| 11118 | 99 | |
| 12780 | 100 | int |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
101 | purple_prefs_get_int(name) |
| 11118 | 102 | const char *name |
| 103 | ||
| 104 | const char * | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
105 | purple_prefs_get_string(name) |
| 11118 | 106 | const char *name |
| 107 | ||
| 108 | void | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
109 | purple_prefs_get_string_list(name) |
| 11118 | 110 | const char *name |
| 111 | PREINIT: | |
| 12780 | 112 | GList *l; |
| 11118 | 113 | PPCODE: |
|
17283
ceb0e3374ddf
Plug a few more memory leaks for some perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17282
diff
changeset
|
114 | for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) { |
|
17282
7d015f747d02
Fix _prefs_get_string_list for perl.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16773
diff
changeset
|
115 | XPUSHs(sv_2mortal(newSVpv(l->data, 0))); |
|
17283
ceb0e3374ddf
Plug a few more memory leaks for some perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
17282
diff
changeset
|
116 | g_free(l->data); |
| 12780 | 117 | } |
| 11118 | 118 | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
119 | Purple::PrefType |
|
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
120 | purple_prefs_get_type(name) |
| 11118 | 121 | const char *name |
| 122 | ||
| 12780 | 123 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
124 | purple_prefs_init() |
| 11118 | 125 | |
| 12780 | 126 | gboolean |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
127 | purple_prefs_load() |
| 11118 | 128 | |
| 12780 | 129 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
130 | purple_prefs_remove(name) |
| 11118 | 131 | const char *name |
| 132 | ||
| 12780 | 133 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
134 | purple_prefs_rename(oldname, newname) |
| 11118 | 135 | const char *oldname |
| 136 | const char *newname | |
| 137 | ||
| 12780 | 138 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
139 | purple_prefs_rename_boolean_toggle(oldname, newname) |
| 11118 | 140 | const char *oldname |
| 141 | const char *newname | |
| 142 | ||
| 12780 | 143 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
144 | purple_prefs_set_bool(name, value) |
| 11118 | 145 | const char *name |
| 146 | gboolean value | |
| 147 | ||
| 12780 | 148 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
149 | purple_prefs_set_generic(name, value) |
| 11118 | 150 | const char *name |
| 151 | gpointer value | |
| 152 | ||
| 12780 | 153 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
154 | purple_prefs_set_int(name, value) |
| 11118 | 155 | const char *name |
| 156 | int value | |
| 157 | ||
| 12780 | 158 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
159 | purple_prefs_set_string(name, value) |
| 11118 | 160 | const char *name |
| 161 | const char *value | |
| 162 | ||
| 12780 | 163 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
164 | purple_prefs_set_string_list(name, value) |
| 11118 | 165 | const char *name |
| 166 | SV *value | |
| 167 | PREINIT: | |
| 12780 | 168 | GList *t_GL; |
| 169 | int i, t_len; | |
| 11118 | 170 | PPCODE: |
| 12780 | 171 | t_GL = NULL; |
| 172 | t_len = av_len((AV *)SvRV(value)); | |
| 11118 | 173 | |
| 12780 | 174 | for (i = 0; i < t_len; i++) { |
| 175 | STRLEN t_sl; | |
| 176 | t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(value), i, 0), t_sl)); | |
| 177 | } | |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
178 | purple_prefs_set_string_list(name, t_GL); |
|
21737
fa92350ed598
applied changes from 8d953d5714cb202c5fa66fda1b0f31f01a969622
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17283
diff
changeset
|
179 | g_list_free(t_GL); |
| 11118 | 180 | |
| 12780 | 181 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
182 | purple_prefs_trigger_callback(name) |
| 11118 | 183 | const char *name |
| 184 | ||
| 12780 | 185 | void |
|
22835
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
186 | purple_prefs_get_children_names(name) |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
187 | const char *name |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
188 | PREINIT: |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
189 | GList *l; |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
190 | PPCODE: |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
191 | for (l = purple_prefs_get_children_names(name); l != NULL; l = g_list_delete_link(l, l)) { |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
192 | XPUSHs(sv_2mortal(newSVpv(l->data, 0))); |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
193 | g_free(l->data); |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
194 | } |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
195 | |
|
1c120805ad06
Expose Purple::Prefs::get_children_names to perl plugins.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21737
diff
changeset
|
196 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
197 | purple_prefs_uninit() |
| 11118 | 198 | |
| 12780 | 199 | void |
|
15894
765ec644ac47
Perl fixes for s/gaim/purple/. This hasn't really been tested yet.
Daniel Atallah <datallah@pidgin.im>
parents:
15435
diff
changeset
|
200 | purple_prefs_update_old() |