Mercurial > pidgin.yaz
annotate finch/gntrequest.c @ 17621:bbd92ee894f2
Fixed a bug in the XMPP parser involving event handlers that replace the xmlnode packet. This caused double frees in this situation. The replacing function must free the xmlnode, since multiple event handlers could do this, and the intermediate xml trees would leak otherwise.
author | Andreas Monitzer <pidgin@monitzer.com> |
---|---|
date | Tue, 03 Jul 2007 23:51:26 +0000 |
parents | a236c67e39b6 |
children | 4ca97b26a8fb |
rev | line source |
---|---|
15818 | 1 /** |
2 * @file gntrequest.c GNT Request API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
16164
diff
changeset
|
3 * @ingroup finch |
15818 | 4 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15844
diff
changeset
|
5 * finch |
15818 | 6 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15844
diff
changeset
|
7 * Finch is the legal property of its developers, whose names are too numerous |
15818 | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | |
10 * | |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
25 #include <gnt.h> | |
26 #include <gntbox.h> | |
27 #include <gntbutton.h> | |
28 #include <gntcheckbox.h> | |
29 #include <gntcombobox.h> | |
30 #include <gntentry.h> | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
31 #include <gntfilesel.h> |
15818 | 32 #include <gntlabel.h> |
33 #include <gntline.h> | |
34 #include <gnttree.h> | |
35 | |
15823 | 36 #include "finch.h" |
15818 | 37 #include "gntrequest.h" |
16164
87019c619be0
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15939
diff
changeset
|
38 #include "util.h" |
15818 | 39 |
40 typedef struct | |
41 { | |
42 void *user_data; | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
43 GntWidget *dialog; |
15818 | 44 GCallback *cbs; |
15823 | 45 } PurpleGntFileRequest; |
15818 | 46 |
47 static GntWidget * | |
48 setup_request_window(const char *title, const char *primary, | |
15823 | 49 const char *secondary, PurpleRequestType type) |
15818 | 50 { |
51 GntWidget *window; | |
52 | |
53 window = gnt_vbox_new(FALSE); | |
54 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
55 gnt_box_set_title(GNT_BOX(window), title); | |
56 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
57 | |
58 if (primary) | |
59 gnt_box_add_widget(GNT_BOX(window), | |
60 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); | |
61 if (secondary) | |
62 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); | |
63 | |
15823 | 64 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(purple_request_close), |
15818 | 65 GINT_TO_POINTER(type)); |
66 | |
67 return window; | |
68 } | |
69 | |
70 static GntWidget * | |
71 setup_button_box(gpointer userdata, gpointer cb, gpointer data, ...) | |
72 { | |
73 GntWidget *box, *button; | |
74 va_list list; | |
75 const char *text; | |
76 gpointer callback; | |
77 | |
78 box = gnt_hbox_new(FALSE); | |
79 | |
80 va_start(list, data); | |
81 | |
82 while ((text = va_arg(list, const char *))) | |
83 { | |
84 callback = va_arg(list, gpointer); | |
85 button = gnt_button_new(text); | |
86 gnt_box_add_widget(GNT_BOX(box), button); | |
87 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
88 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); | |
89 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); | |
90 } | |
91 | |
92 va_end(list); | |
93 return box; | |
94 } | |
95 | |
96 static void | |
97 notify_input_cb(GntWidget *button, GntWidget *entry) | |
98 { | |
15823 | 99 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 100 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
101 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
102 | |
103 if (callback) | |
104 callback(data, text); | |
105 | |
106 while (button->parent) | |
107 button = button->parent; | |
108 | |
15823 | 109 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15818 | 110 } |
111 | |
112 static void * | |
113 finch_request_input(const char *title, const char *primary, | |
114 const char *secondary, const char *default_value, | |
115 gboolean multiline, gboolean masked, gchar *hint, | |
116 const char *ok_text, GCallback ok_cb, | |
117 const char *cancel_text, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
118 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 119 void *user_data) |
120 { | |
121 GntWidget *window, *box, *entry; | |
122 | |
15823 | 123 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
15818 | 124 |
125 entry = gnt_entry_new(default_value); | |
126 if (masked) | |
127 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
128 gnt_box_add_widget(GNT_BOX(window), entry); | |
129 | |
130 box = setup_button_box(user_data, notify_input_cb, entry, | |
131 ok_text, ok_cb, cancel_text, cancel_cb, NULL); | |
132 gnt_box_add_widget(GNT_BOX(window), box); | |
133 | |
134 gnt_widget_show(window); | |
135 | |
136 return window; | |
137 } | |
138 | |
139 static void | |
15823 | 140 finch_close_request(PurpleRequestType type, gpointer ui_handle) |
15818 | 141 { |
142 GntWidget *widget = GNT_WIDGET(ui_handle); | |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
143 if (type == PURPLE_REQUEST_FIELDS) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
144 PurpleRequestFields *fields = g_object_get_data(G_OBJECT(widget), "fields"); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
145 purple_request_fields_destroy(fields); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
146 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
147 |
15818 | 148 while (widget->parent) |
149 widget = widget->parent; | |
150 gnt_widget_destroy(widget); | |
151 } | |
152 | |
153 static void | |
154 request_choice_cb(GntWidget *button, GntComboBox *combo) | |
155 { | |
15823 | 156 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 157 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
158 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; | |
159 | |
160 if (callback) | |
161 callback(data, choice); | |
162 | |
163 while (button->parent) | |
164 button = button->parent; | |
165 | |
15823 | 166 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15818 | 167 } |
168 | |
169 static void * | |
170 finch_request_choice(const char *title, const char *primary, | |
171 const char *secondary, unsigned int default_value, | |
172 const char *ok_text, GCallback ok_cb, | |
173 const char *cancel_text, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
174 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 175 void *user_data, va_list choices) |
176 { | |
177 GntWidget *window, *combo, *box; | |
178 const char *text; | |
179 int val; | |
180 | |
15823 | 181 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
15818 | 182 |
183 combo = gnt_combo_box_new(); | |
184 gnt_box_add_widget(GNT_BOX(window), combo); | |
185 while ((text = va_arg(choices, const char *))) | |
186 { | |
187 val = va_arg(choices, int); | |
188 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); | |
189 } | |
190 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); | |
191 | |
192 box = setup_button_box(user_data, request_choice_cb, combo, | |
193 ok_text, ok_cb, cancel_text, cancel_cb, NULL); | |
194 gnt_box_add_widget(GNT_BOX(window), box); | |
195 | |
196 gnt_widget_show(window); | |
197 | |
198 return window; | |
199 } | |
200 | |
201 static void | |
202 request_action_cb(GntWidget *button, GntWidget *window) | |
203 { | |
15823 | 204 PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 205 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
206 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); | |
207 | |
208 if (callback) | |
209 callback(data, id); | |
210 | |
15823 | 211 purple_request_close(PURPLE_REQUEST_ACTION, window); |
15818 | 212 } |
213 | |
214 static void* | |
215 finch_request_action(const char *title, const char *primary, | |
216 const char *secondary, unsigned int default_value, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
217 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 218 void *user_data, size_t actioncount, |
219 va_list actions) | |
220 { | |
221 GntWidget *window, *box, *button; | |
222 int i; | |
223 | |
15823 | 224 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
15818 | 225 |
226 box = gnt_hbox_new(FALSE); | |
227 gnt_box_add_widget(GNT_BOX(window), box); | |
228 for (i = 0; i < actioncount; i++) | |
229 { | |
230 const char *text = va_arg(actions, const char *); | |
15823 | 231 PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
15818 | 232 |
233 button = gnt_button_new(text); | |
234 gnt_box_add_widget(GNT_BOX(box), button); | |
235 | |
236 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
237 g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); | |
238 g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); | |
239 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); | |
240 } | |
241 | |
242 gnt_widget_show(window); | |
243 | |
244 return window; | |
245 } | |
246 | |
247 static void | |
15823 | 248 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
15818 | 249 { |
15823 | 250 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 251 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
252 GList *list; | |
253 | |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
254 /* Update the data of the fields. Pidgin does this differently. Instead of |
15818 | 255 * updating the fields at the end like here, it updates the appropriate field |
256 * instantly whenever a change is made. That allows it to make sure the | |
257 * 'required' fields are entered before the user can hit OK. It's not the case | |
258 * here, althought it can be done. I am not honouring the 'required' fields | |
259 * for the moment. */ | |
15823 | 260 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
15818 | 261 { |
15823 | 262 PurpleRequestFieldGroup *group = list->data; |
263 GList *fields = purple_request_field_group_get_fields(group); | |
15818 | 264 |
265 for (; fields ; fields = fields->next) | |
266 { | |
15823 | 267 PurpleRequestField *field = fields->data; |
268 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
269 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | |
15818 | 270 { |
271 GntWidget *check = field->ui_data; | |
272 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); | |
15823 | 273 purple_request_field_bool_set_value(field, value); |
15818 | 274 } |
15823 | 275 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15818 | 276 { |
277 GntWidget *entry = field->ui_data; | |
278 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
15823 | 279 purple_request_field_string_set_value(field, (text && *text) ? text : NULL); |
15818 | 280 } |
15823 | 281 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15818 | 282 { |
283 GntWidget *entry = field->ui_data; | |
284 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
285 int value = (text && *text) ? atoi(text) : 0; | |
15823 | 286 purple_request_field_int_set_value(field, value); |
15818 | 287 } |
15823 | 288 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15818 | 289 { |
290 GntWidget *combo = field->ui_data; | |
291 int id; | |
292 id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); | |
15823 | 293 purple_request_field_choice_set_value(field, id); |
15818 | 294 } |
15823 | 295 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15818 | 296 { |
297 GList *list = NULL; | |
15823 | 298 if (purple_request_field_list_get_multi_select(field)) |
15818 | 299 { |
300 const GList *iter; | |
301 GntWidget *tree = field->ui_data; | |
302 | |
15823 | 303 iter = purple_request_field_list_get_items(field); |
15818 | 304 for (; iter; iter = iter->next) |
305 { | |
306 const char *text = iter->data; | |
15823 | 307 gpointer key = purple_request_field_list_get_data(field, text); |
15818 | 308 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
309 list = g_list_prepend(list, key); | |
310 } | |
311 } | |
312 else | |
313 { | |
314 GntWidget *combo = field->ui_data; | |
315 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); | |
316 list = g_list_append(list, data); | |
317 } | |
318 | |
15823 | 319 purple_request_field_list_set_selected(field, list); |
15818 | 320 g_list_free(list); |
321 } | |
15823 | 322 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15818 | 323 { |
324 GntWidget *combo = field->ui_data; | |
15823 | 325 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
326 purple_request_field_account_set_value(field, acc); | |
15818 | 327 } |
328 } | |
329 } | |
330 | |
331 if (callback) | |
332 callback(data, fields); | |
333 | |
334 while (button->parent) | |
335 button = button->parent; | |
336 | |
15823 | 337 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
15818 | 338 } |
339 | |
340 static void * | |
341 finch_request_fields(const char *title, const char *primary, | |
15823 | 342 const char *secondary, PurpleRequestFields *allfields, |
15818 | 343 const char *ok, GCallback ok_cb, |
344 const char *cancel, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
345 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 346 void *userdata) |
347 { | |
348 GntWidget *window, *box; | |
349 GList *grlist; | |
350 | |
15823 | 351 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
15818 | 352 |
353 /* This is how it's going to work: the request-groups are going to be | |
354 * stacked vertically one after the other. A GntLine will be separating | |
355 * the groups. */ | |
356 box = gnt_vbox_new(FALSE); | |
357 gnt_box_set_pad(GNT_BOX(box), 0); | |
358 gnt_box_set_fill(GNT_BOX(box), TRUE); | |
15823 | 359 for (grlist = purple_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
15818 | 360 { |
15823 | 361 PurpleRequestFieldGroup *group = grlist->data; |
362 GList *fields = purple_request_field_group_get_fields(group); | |
15818 | 363 GntWidget *hbox; |
15823 | 364 const char *title = purple_request_field_group_get_title(group); |
15818 | 365 |
366 if (title) | |
367 gnt_box_add_widget(GNT_BOX(box), | |
368 gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); | |
369 | |
370 for (; fields ; fields = fields->next) | |
371 { | |
372 /* XXX: Break each of the fields into a separate function? */ | |
15823 | 373 PurpleRequestField *field = fields->data; |
374 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
375 const char *label = purple_request_field_get_label(field); | |
15818 | 376 |
377 hbox = gnt_hbox_new(TRUE); /* hrm */ | |
378 gnt_box_add_widget(GNT_BOX(box), hbox); | |
379 | |
15823 | 380 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
15818 | 381 { |
382 GntWidget *l = gnt_label_new(label); | |
383 gnt_widget_set_size(l, 0, 1); | |
384 gnt_box_add_widget(GNT_BOX(hbox), l); | |
385 } | |
386 | |
15823 | 387 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15818 | 388 { |
389 GntWidget *check = gnt_check_box_new(label); | |
390 gnt_check_box_set_checked(GNT_CHECK_BOX(check), | |
15823 | 391 purple_request_field_bool_get_default_value(field)); |
15818 | 392 gnt_box_add_widget(GNT_BOX(hbox), check); |
393 field->ui_data = check; | |
394 } | |
15823 | 395 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15818 | 396 { |
15830 | 397 const char *hint = purple_request_field_get_type_hint(field); |
15818 | 398 GntWidget *entry = gnt_entry_new( |
15823 | 399 purple_request_field_string_get_default_value(field)); |
15818 | 400 gnt_entry_set_masked(GNT_ENTRY(entry), |
15823 | 401 purple_request_field_string_is_masked(field)); |
15830 | 402 if (purple_str_has_prefix(hint, "screenname")) { |
403 PurpleBlistNode *node = purple_blist_get_root(); | |
404 gboolean offline = purple_str_has_suffix(hint, "all"); | |
405 for (; node; node = purple_blist_node_next(node, offline)) { | |
406 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) | |
15827
f59cfcce68a8
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
407 continue; |
15830 | 408 gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node)); |
15827
f59cfcce68a8
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
409 } |
f59cfcce68a8
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
410 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
15844
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
411 } else if (hint && !strcmp(hint, "group")) { |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
412 PurpleBlistNode *node; |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
413 for (node = purple_blist_get_root(); node; node = node->next) { |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
414 if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
415 gnt_entry_add_suggest(GNT_ENTRY(entry), ((PurpleGroup *)node)->name); |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15830
diff
changeset
|
416 } |
15827
f59cfcce68a8
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15818
diff
changeset
|
417 } |
15818 | 418 gnt_box_add_widget(GNT_BOX(hbox), entry); |
419 field->ui_data = entry; | |
420 } | |
15823 | 421 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15818 | 422 { |
423 char str[256]; | |
15823 | 424 int val = purple_request_field_int_get_default_value(field); |
15818 | 425 GntWidget *entry; |
426 | |
427 snprintf(str, sizeof(str), "%d", val); | |
428 entry = gnt_entry_new(str); | |
429 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); | |
430 gnt_box_add_widget(GNT_BOX(hbox), entry); | |
431 field->ui_data = entry; | |
432 } | |
15823 | 433 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15818 | 434 { |
435 int id; | |
436 const GList *list; | |
437 GntWidget *combo = gnt_combo_box_new(); | |
438 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
439 field->ui_data = combo; | |
440 | |
15823 | 441 list = purple_request_field_choice_get_labels(field); |
15818 | 442 for (id = 1; list; list = list->next, id++) |
443 { | |
444 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), | |
445 GINT_TO_POINTER(id), list->data); | |
446 } | |
447 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), | |
15823 | 448 GINT_TO_POINTER(purple_request_field_choice_get_default_value(field))); |
15818 | 449 } |
15823 | 450 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15818 | 451 { |
452 const GList *list; | |
15823 | 453 gboolean multi = purple_request_field_list_get_multi_select(field); |
15818 | 454 if (multi) |
455 { | |
456 GntWidget *tree = gnt_tree_new(); | |
457 gnt_box_add_widget(GNT_BOX(hbox), tree); | |
458 field->ui_data = tree; | |
459 | |
15823 | 460 list = purple_request_field_list_get_items(field); |
15818 | 461 for (; list; list = list->next) |
462 { | |
463 const char *text = list->data; | |
15823 | 464 gpointer key = purple_request_field_list_get_data(field, text); |
15818 | 465 gnt_tree_add_choice(GNT_TREE(tree), key, |
466 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); | |
15823 | 467 if (purple_request_field_list_is_selected(field, text)) |
15818 | 468 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
469 } | |
470 } | |
471 else | |
472 { | |
473 GntWidget *combo = gnt_combo_box_new(); | |
474 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); | |
475 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
476 field->ui_data = combo; | |
477 | |
15823 | 478 list = purple_request_field_list_get_items(field); |
15818 | 479 for (; list; list = list->next) |
480 { | |
481 const char *text = list->data; | |
15823 | 482 gpointer key = purple_request_field_list_get_data(field, text); |
15818 | 483 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
15823 | 484 if (purple_request_field_list_is_selected(field, text)) |
15818 | 485 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
486 } | |
487 } | |
488 } | |
15823 | 489 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15818 | 490 { |
491 gboolean all; | |
15823 | 492 PurpleAccount *def; |
15818 | 493 GList *list; |
494 GntWidget *combo = gnt_combo_box_new(); | |
495 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); | |
496 gnt_box_add_widget(GNT_BOX(hbox), combo); | |
497 field->ui_data = combo; | |
498 | |
15823 | 499 all = purple_request_field_account_get_show_all(field); |
16938
43abb4942a6d
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16442
diff
changeset
|
500 def = purple_request_field_account_get_value(field); |
43abb4942a6d
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16442
diff
changeset
|
501 if (!def) |
43abb4942a6d
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16442
diff
changeset
|
502 def = purple_request_field_account_get_default_value(field); |
15818 | 503 |
504 if (all) | |
15823 | 505 list = purple_accounts_get_all(); |
15818 | 506 else |
15823 | 507 list = purple_connections_get_all(); |
15818 | 508 |
509 for (; list; list = list->next) | |
510 { | |
15823 | 511 PurpleAccount *account; |
15818 | 512 char *text; |
513 | |
514 if (all) | |
515 account = list->data; | |
516 else | |
15823 | 517 account = purple_connection_get_account(list->data); |
15818 | 518 |
519 text = g_strdup_printf("%s (%s)", | |
15823 | 520 purple_account_get_username(account), |
521 purple_account_get_protocol_name(account)); | |
15818 | 522 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); |
523 g_free(text); | |
524 if (account == def) | |
525 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); | |
526 } | |
527 gnt_widget_set_size(combo, 20, 3); /* ew */ | |
528 } | |
529 else | |
530 { | |
531 gnt_box_add_widget(GNT_BOX(hbox), | |
532 gnt_label_new_with_format(_("Not implemented yet."), | |
533 GNT_TEXT_FLAG_BOLD)); | |
534 } | |
535 } | |
536 if (grlist->next) | |
537 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
538 } | |
539 gnt_box_add_widget(GNT_BOX(window), box); | |
540 | |
541 box = setup_button_box(userdata, request_fields_cb, allfields, | |
542 ok, ok_cb, cancel, cancel_cb, NULL); | |
543 gnt_box_add_widget(GNT_BOX(window), box); | |
544 | |
545 gnt_widget_show(window); | |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
546 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
547 g_object_set_data(G_OBJECT(window), "fields", allfields); |
15818 | 548 |
549 return window; | |
550 } | |
551 | |
552 static void | |
553 file_cancel_cb(GntWidget *wid, gpointer fq) | |
554 { | |
15823 | 555 PurpleGntFileRequest *data = fq; |
15818 | 556 if (data->cbs[1] != NULL) |
15823 | 557 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL); |
15818 | 558 |
15823 | 559 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15818 | 560 } |
561 | |
562 static void | |
563 file_ok_cb(GntWidget *wid, gpointer fq) | |
564 { | |
15823 | 565 PurpleGntFileRequest *data = fq; |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
566 char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog)); |
15818 | 567 if (data->cbs[0] != NULL) |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
568 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
569 g_free(file); |
15818 | 570 |
15823 | 571 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15818 | 572 } |
573 | |
574 static void | |
15823 | 575 file_request_destroy(PurpleGntFileRequest *data) |
15818 | 576 { |
577 g_free(data->cbs); | |
578 g_free(data); | |
579 } | |
580 | |
581 static void * | |
582 finch_request_file(const char *title, const char *filename, | |
583 gboolean savedialog, | |
584 GCallback ok_cb, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
585 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 586 void *user_data) |
587 { | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
588 GntWidget *window = gnt_file_sel_new(); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
589 GntFileSel *sel = GNT_FILE_SEL(window); |
15823 | 590 PurpleGntFileRequest *data = g_new0(PurpleGntFileRequest, 1); |
15818 | 591 |
592 data->user_data = user_data; | |
593 data->cbs = g_new0(GCallback, 2); | |
594 data->cbs[0] = ok_cb; | |
595 data->cbs[1] = cancel_cb; | |
596 data->dialog = window; | |
597 gnt_box_set_title(GNT_BOX(window), title ? title : (savedialog ? _("Save File...") : _("Open File..."))); | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
598 gnt_file_sel_set_current_location(sel, purple_home_dir()); /* XXX: */ |
15939 | 599 if (savedialog) |
600 gnt_file_sel_set_suggested_filename(sel, filename); | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
601 g_signal_connect(G_OBJECT(sel->cancel), "activate", |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
602 G_CALLBACK(file_cancel_cb), data); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
603 g_signal_connect(G_OBJECT(sel->select), "activate", |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
604 G_CALLBACK(file_ok_cb), data); |
15818 | 605 g_signal_connect_swapped(G_OBJECT(window), "destroy", |
606 G_CALLBACK(file_request_destroy), data); | |
607 | |
608 gnt_widget_show(window); | |
609 | |
610 return window; | |
611 } | |
612 | |
15823 | 613 static PurpleRequestUiOps uiops = |
15818 | 614 { |
17104
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
615 finch_request_input, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
616 finch_request_choice, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
617 finch_request_action, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
618 finch_request_fields, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
619 finch_request_file, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
620 finch_close_request, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
621 NULL, /* No plans for request_folder */ |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
622 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
623 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
624 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
625 NULL |
15818 | 626 }; |
627 | |
15823 | 628 PurpleRequestUiOps *finch_request_get_ui_ops() |
15818 | 629 { |
630 return &uiops; | |
631 } | |
632 | |
633 void finch_request_init() | |
634 { | |
635 } | |
636 | |
637 void finch_request_uninit() | |
638 { | |
639 } | |
640 | |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
641 void finch_request_save_in_prefs(gpointer null, PurpleRequestFields *allfields) |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
642 { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
643 GList *list; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
644 for (list = purple_request_fields_get_groups(allfields); list; list = list->next) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
645 PurpleRequestFieldGroup *group = list->data; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
646 GList *fields = purple_request_field_group_get_fields(group); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
647 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
648 for (; fields ; fields = fields->next) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
649 PurpleRequestField *field = fields->data; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
650 PurpleRequestFieldType type = purple_request_field_get_type(field); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
651 PurplePrefType pt; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
652 gpointer val = NULL; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
653 const char *id = purple_request_field_get_id(field); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
654 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
655 switch (type) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
656 case PURPLE_REQUEST_FIELD_LIST: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
657 val = purple_request_field_list_get_selected(field)->data; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
658 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
659 case PURPLE_REQUEST_FIELD_BOOLEAN: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
660 val = GINT_TO_POINTER(purple_request_field_bool_get_value(field)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
661 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
662 case PURPLE_REQUEST_FIELD_INTEGER: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
663 val = GINT_TO_POINTER(purple_request_field_int_get_value(field)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
664 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
665 case PURPLE_REQUEST_FIELD_STRING: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
666 val = (gpointer)purple_request_field_string_get_value(field); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
667 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
668 default: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
669 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
670 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
671 |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
672 pt = purple_prefs_get_type(id); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
673 switch (pt) { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
674 case PURPLE_PREF_INT: |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
675 { |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
676 long int tmp; |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
677 if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */ |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
678 sscanf(val, "%ld", &tmp); |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
679 purple_prefs_set_int(id, (gint)tmp); |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
680 break; |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
681 } |
16310
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
682 case PURPLE_PREF_BOOLEAN: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
683 purple_prefs_set_bool(id, GPOINTER_TO_INT(val)); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
684 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
685 case PURPLE_PREF_STRING: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
686 purple_prefs_set_string(id, val); |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
687 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
688 default: |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
689 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
690 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
691 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
692 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
693 } |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
694 |