Mercurial > pidgin
annotate finch/gntrequest.c @ 18067:098a1d6896be
merge of '34fbe2d8a258b1b4700cb7c8d8fcd02d07bc4d14'
and 'd6951b577ca382935275d65ba6c87792a3ca80d5'
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 07 Jun 2007 12:33:23 +0000 |
parents | 4ca97b26a8fb |
children | 926ccb104da0 fc6d1088cb27 eb49b371cf9a |
rev | line source |
---|---|
15817 | 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 |
15817 | 4 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15843
diff
changeset
|
5 * finch |
15817 | 6 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15843
diff
changeset
|
7 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 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> | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
31 #include <gntfilesel.h> |
15817 | 32 #include <gntlabel.h> |
33 #include <gntline.h> | |
34 #include <gnttree.h> | |
35 | |
15822 | 36 #include "finch.h" |
15817 | 37 #include "gntrequest.h" |
16164
87019c619be0
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15936
diff
changeset
|
38 #include "util.h" |
15817 | 39 |
40 typedef struct | |
41 { | |
42 void *user_data; | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
43 GntWidget *dialog; |
15817 | 44 GCallback *cbs; |
15822 | 45 } PurpleGntFileRequest; |
15817 | 46 |
47 static GntWidget * | |
48 setup_request_window(const char *title, const char *primary, | |
15822 | 49 const char *secondary, PurpleRequestType type) |
15817 | 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 | |
15822 | 64 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(purple_request_close), |
15817 | 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 { | |
15822 | 99 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 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 | |
15822 | 109 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 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, | |
16439
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, |
15817 | 119 void *user_data) |
120 { | |
121 GntWidget *window, *box, *entry; | |
122 | |
15822 | 123 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
15817 | 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 | |
15822 | 140 finch_close_request(PurpleRequestType type, gpointer ui_handle) |
15817 | 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 |
15817 | 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 { | |
15822 | 156 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 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 | |
15822 | 166 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 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, | |
16439
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, |
15817 | 175 void *user_data, va_list choices) |
176 { | |
177 GntWidget *window, *combo, *box; | |
178 const char *text; | |
179 int val; | |
180 | |
15822 | 181 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
15817 | 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 { | |
15822 | 204 PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 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 | |
15822 | 211 purple_request_close(PURPLE_REQUEST_ACTION, window); |
15817 | 212 } |
213 | |
214 static void* | |
215 finch_request_action(const char *title, const char *primary, | |
216 const char *secondary, unsigned int default_value, | |
16439
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, |
15817 | 218 void *user_data, size_t actioncount, |
219 va_list actions) | |
220 { | |
221 GntWidget *window, *box, *button; | |
222 int i; | |
223 | |
15822 | 224 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
15817 | 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 *); | |
15822 | 231 PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
15817 | 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 | |
15822 | 248 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
15817 | 249 { |
15822 | 250 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 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 |
15817 | 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. */ | |
15822 | 260 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
15817 | 261 { |
15822 | 262 PurpleRequestFieldGroup *group = list->data; |
263 GList *fields = purple_request_field_group_get_fields(group); | |
15817 | 264 |
265 for (; fields ; fields = fields->next) | |
266 { | |
15822 | 267 PurpleRequestField *field = fields->data; |
268 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
269 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | |
15817 | 270 { |
271 GntWidget *check = field->ui_data; | |
272 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); | |
15822 | 273 purple_request_field_bool_set_value(field, value); |
15817 | 274 } |
15822 | 275 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 276 { |
277 GntWidget *entry = field->ui_data; | |
278 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
15822 | 279 purple_request_field_string_set_value(field, (text && *text) ? text : NULL); |
15817 | 280 } |
15822 | 281 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 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; | |
15822 | 286 purple_request_field_int_set_value(field, value); |
15817 | 287 } |
15822 | 288 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 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))); | |
15822 | 293 purple_request_field_choice_set_value(field, id); |
15817 | 294 } |
15822 | 295 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 296 { |
297 GList *list = NULL; | |
15822 | 298 if (purple_request_field_list_get_multi_select(field)) |
15817 | 299 { |
300 const GList *iter; | |
301 GntWidget *tree = field->ui_data; | |
302 | |
15822 | 303 iter = purple_request_field_list_get_items(field); |
15817 | 304 for (; iter; iter = iter->next) |
305 { | |
306 const char *text = iter->data; | |
15822 | 307 gpointer key = purple_request_field_list_get_data(field, text); |
15817 | 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 | |
15822 | 319 purple_request_field_list_set_selected(field, list); |
15817 | 320 g_list_free(list); |
321 } | |
15822 | 322 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 323 { |
324 GntWidget *combo = field->ui_data; | |
15822 | 325 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
326 purple_request_field_account_set_value(field, acc); | |
15817 | 327 } |
328 } | |
329 } | |
330 | |
331 if (callback) | |
332 callback(data, fields); | |
333 | |
334 while (button->parent) | |
335 button = button->parent; | |
336 | |
15822 | 337 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
15817 | 338 } |
339 | |
340 static void * | |
341 finch_request_fields(const char *title, const char *primary, | |
15822 | 342 const char *secondary, PurpleRequestFields *allfields, |
15817 | 343 const char *ok, GCallback ok_cb, |
344 const char *cancel, GCallback cancel_cb, | |
16439
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, |
15817 | 346 void *userdata) |
347 { | |
348 GntWidget *window, *box; | |
349 GList *grlist; | |
350 | |
15822 | 351 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
15817 | 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); | |
15822 | 359 for (grlist = purple_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
15817 | 360 { |
15822 | 361 PurpleRequestFieldGroup *group = grlist->data; |
362 GList *fields = purple_request_field_group_get_fields(group); | |
15817 | 363 GntWidget *hbox; |
15822 | 364 const char *title = purple_request_field_group_get_title(group); |
15817 | 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? */ | |
15822 | 373 PurpleRequestField *field = fields->data; |
374 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
375 const char *label = purple_request_field_get_label(field); | |
15817 | 376 |
377 hbox = gnt_hbox_new(TRUE); /* hrm */ | |
378 gnt_box_add_widget(GNT_BOX(box), hbox); | |
379 | |
15822 | 380 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
15817 | 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 | |
15822 | 387 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15817 | 388 { |
389 GntWidget *check = gnt_check_box_new(label); | |
390 gnt_check_box_set_checked(GNT_CHECK_BOX(check), | |
15822 | 391 purple_request_field_bool_get_default_value(field)); |
15817 | 392 gnt_box_add_widget(GNT_BOX(hbox), check); |
393 field->ui_data = check; | |
394 } | |
15822 | 395 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 396 { |
15829 | 397 const char *hint = purple_request_field_get_type_hint(field); |
15817 | 398 GntWidget *entry = gnt_entry_new( |
15822 | 399 purple_request_field_string_get_default_value(field)); |
15817 | 400 gnt_entry_set_masked(GNT_ENTRY(entry), |
15822 | 401 purple_request_field_string_is_masked(field)); |
15829 | 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)) | |
15826
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:
15817
diff
changeset
|
407 continue; |
15829 | 408 gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node)); |
15826
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:
15817
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:
15817
diff
changeset
|
410 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
15843
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15829
diff
changeset
|
411 } else if (hint && !strcmp(hint, "group")) { |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15829
diff
changeset
|
412 PurpleBlistNode *node; |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15829
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:
15829
diff
changeset
|
414 if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
e74c2488448b
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15829
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:
15829
diff
changeset
|
416 } |
15826
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:
15817
diff
changeset
|
417 } |
15817 | 418 gnt_box_add_widget(GNT_BOX(hbox), entry); |
419 field->ui_data = entry; | |
420 } | |
15822 | 421 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 422 { |
423 char str[256]; | |
15822 | 424 int val = purple_request_field_int_get_default_value(field); |
15817 | 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 } | |
15822 | 433 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 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 | |
15822 | 441 list = purple_request_field_choice_get_labels(field); |
15817 | 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), | |
15822 | 448 GINT_TO_POINTER(purple_request_field_choice_get_default_value(field))); |
15817 | 449 } |
15822 | 450 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 451 { |
452 const GList *list; | |
15822 | 453 gboolean multi = purple_request_field_list_get_multi_select(field); |
15817 | 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 | |
15822 | 460 list = purple_request_field_list_get_items(field); |
15817 | 461 for (; list; list = list->next) |
462 { | |
463 const char *text = list->data; | |
15822 | 464 gpointer key = purple_request_field_list_get_data(field, text); |
15817 | 465 gnt_tree_add_choice(GNT_TREE(tree), key, |
466 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); | |
15822 | 467 if (purple_request_field_list_is_selected(field, text)) |
15817 | 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 | |
15822 | 478 list = purple_request_field_list_get_items(field); |
15817 | 479 for (; list; list = list->next) |
480 { | |
481 const char *text = list->data; | |
15822 | 482 gpointer key = purple_request_field_list_get_data(field, text); |
15817 | 483 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
15822 | 484 if (purple_request_field_list_is_selected(field, text)) |
15817 | 485 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
486 } | |
487 } | |
488 } | |
15822 | 489 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 490 { |
491 gboolean all; | |
15822 | 492 PurpleAccount *def; |
18058
4ca97b26a8fb
Mark the return type const for the following functions. I noticed this
Richard Laager <rlaager@wiktel.com>
parents:
17392
diff
changeset
|
493 const GList *list; |
15817 | 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 | |
15822 | 499 all = purple_request_field_account_get_show_all(field); |
16927
43abb4942a6d
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
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:
16439
diff
changeset
|
501 if (!def) |
43abb4942a6d
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16439
diff
changeset
|
502 def = purple_request_field_account_get_default_value(field); |
15817 | 503 |
504 if (all) | |
15822 | 505 list = purple_accounts_get_all(); |
15817 | 506 else |
15822 | 507 list = purple_connections_get_all(); |
15817 | 508 |
509 for (; list; list = list->next) | |
510 { | |
15822 | 511 PurpleAccount *account; |
15817 | 512 char *text; |
513 | |
514 if (all) | |
515 account = list->data; | |
516 else | |
15822 | 517 account = purple_connection_get_account(list->data); |
15817 | 518 |
519 text = g_strdup_printf("%s (%s)", | |
15822 | 520 purple_account_get_username(account), |
521 purple_account_get_protocol_name(account)); | |
15817 | 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); |
15817 | 548 |
549 return window; | |
550 } | |
551 | |
552 static void | |
553 file_cancel_cb(GntWidget *wid, gpointer fq) | |
554 { | |
15822 | 555 PurpleGntFileRequest *data = fq; |
15817 | 556 if (data->cbs[1] != NULL) |
15822 | 557 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL); |
15817 | 558 |
15822 | 559 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 560 } |
561 | |
562 static void | |
563 file_ok_cb(GntWidget *wid, gpointer fq) | |
564 { | |
15822 | 565 PurpleGntFileRequest *data = fq; |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
566 char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog)); |
15817 | 567 if (data->cbs[0] != NULL) |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
568 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
569 g_free(file); |
15817 | 570 |
15822 | 571 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 572 } |
573 | |
574 static void | |
15822 | 575 file_request_destroy(PurpleGntFileRequest *data) |
15817 | 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, | |
16439
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, |
15817 | 586 void *user_data) |
587 { | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
588 GntWidget *window = gnt_file_sel_new(); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
589 GntFileSel *sel = GNT_FILE_SEL(window); |
15822 | 590 PurpleGntFileRequest *data = g_new0(PurpleGntFileRequest, 1); |
15817 | 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..."))); | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
598 gnt_file_sel_set_current_location(sel, purple_home_dir()); /* XXX: */ |
15936 | 599 if (savedialog) |
600 gnt_file_sel_set_suggested_filename(sel, filename); | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
601 g_signal_connect(G_OBJECT(sel->cancel), "activate", |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
602 G_CALLBACK(file_cancel_cb), data); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
603 g_signal_connect(G_OBJECT(sel->select), "activate", |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
604 G_CALLBACK(file_ok_cb), data); |
15817 | 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 | |
15822 | 613 static PurpleRequestUiOps uiops = |
15817 | 614 { |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
615 finch_request_input, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
616 finch_request_choice, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
617 finch_request_action, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
618 finch_request_fields, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
619 finch_request_file, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
620 finch_close_request, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
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:
16927
diff
changeset
|
622 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
623 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
624 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
625 NULL |
15817 | 626 }; |
627 | |
15822 | 628 PurpleRequestUiOps *finch_request_get_ui_ops() |
15817 | 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: |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
675 { |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
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 */ |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
678 sscanf(val, "%ld", &tmp); |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
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; |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
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 |