Mercurial > pidgin
annotate finch/gntrequest.c @ 22833:7492fdcdbcea
Fix the breakage with account aliases that I introduced when I moved the
field. Aliases shouldn't be lost when modifying the account now.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 04 May 2008 00:51:46 +0000 |
parents | 4457e6a99d13 |
children | 750813c2db46 |
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 |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19761
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19761
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19761
diff
changeset
|
6 /* finch |
15817 | 7 * |
15870
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15843
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15817 | 9 * to list here. Please refer to the COPYRIGHT file distributed with this |
10 * source distribution. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License as published by | |
14 * the Free Software Foundation; either version 2 of the License, or | |
15 * (at your option) any later version. | |
16 * | |
17 * This program is distributed in the hope that it will be useful, | |
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 * GNU General Public License for more details. | |
21 * | |
22 * You should have received a copy of the GNU General Public License | |
23 * along with this program; if not, write to the Free Software | |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19528
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15817 | 25 */ |
26 #include <gnt.h> | |
27 #include <gntbox.h> | |
28 #include <gntbutton.h> | |
29 #include <gntcheckbox.h> | |
30 #include <gntcombobox.h> | |
31 #include <gntentry.h> | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
32 #include <gntfilesel.h> |
15817 | 33 #include <gntlabel.h> |
34 #include <gntline.h> | |
35 #include <gnttree.h> | |
36 | |
15822 | 37 #include "finch.h" |
15817 | 38 #include "gntrequest.h" |
22005
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
39 #include "debug.h" |
16164
87019c619be0
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15936
diff
changeset
|
40 #include "util.h" |
15817 | 41 |
42 typedef struct | |
43 { | |
44 void *user_data; | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
45 GntWidget *dialog; |
15817 | 46 GCallback *cbs; |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
47 gboolean save; |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
48 } FinchFileRequest; |
15817 | 49 |
50 static GntWidget * | |
51 setup_request_window(const char *title, const char *primary, | |
15822 | 52 const char *secondary, PurpleRequestType type) |
15817 | 53 { |
54 GntWidget *window; | |
55 | |
56 window = gnt_vbox_new(FALSE); | |
57 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
58 gnt_box_set_title(GNT_BOX(window), title); | |
59 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
60 | |
61 if (primary) | |
62 gnt_box_add_widget(GNT_BOX(window), | |
63 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); | |
64 if (secondary) | |
65 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); | |
66 | |
15822 | 67 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(purple_request_close), |
15817 | 68 GINT_TO_POINTER(type)); |
69 | |
70 return window; | |
71 } | |
72 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
73 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
74 * If the window is closed by the wm (ie, without triggering any of |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
75 * the buttons, then do some default callback. |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
76 */ |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
77 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
78 setup_default_callback(GntWidget *window, gpointer default_cb, gpointer data) |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
79 { |
20719
2354c9748a66
Do not connect to a signal with a NULL callback. Gets rid of a runtime warning.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
80 if (default_cb == NULL) |
2354c9748a66
Do not connect to a signal with a NULL callback. Gets rid of a runtime warning.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20074
diff
changeset
|
81 return; |
18347
a90f9a0b90c8
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18333
diff
changeset
|
82 g_object_set_data(G_OBJECT(window), "default-callback", default_cb); |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
83 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(default_cb), data); |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
84 } |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
85 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
86 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
87 action_performed(GntWidget *button, gpointer data) |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
88 { |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
89 g_signal_handlers_disconnect_matched(data, G_SIGNAL_MATCH_FUNC, |
18347
a90f9a0b90c8
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18333
diff
changeset
|
90 0, 0, NULL, |
a90f9a0b90c8
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18333
diff
changeset
|
91 g_object_get_data(data, "default-callback"), |
a90f9a0b90c8
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18333
diff
changeset
|
92 NULL); |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
93 } |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
94 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
95 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
96 * window: this is the window |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
97 * userdata: the userdata to pass to the primary callbacks |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
98 * cb: the callback |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
99 * data: data for the callback |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
100 * (text, primary-callback) pairs, ended by a NULL |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
101 */ |
15817 | 102 static GntWidget * |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
103 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) |
15817 | 104 { |
105 GntWidget *box, *button; | |
106 va_list list; | |
107 const char *text; | |
108 gpointer callback; | |
109 | |
110 box = gnt_hbox_new(FALSE); | |
111 | |
112 va_start(list, data); | |
113 | |
114 while ((text = va_arg(list, const char *))) | |
115 { | |
116 callback = va_arg(list, gpointer); | |
117 button = gnt_button_new(text); | |
118 gnt_box_add_widget(GNT_BOX(box), button); | |
119 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
120 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); | |
18347
a90f9a0b90c8
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18333
diff
changeset
|
121 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
15817 | 122 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
123 } | |
124 | |
125 va_end(list); | |
126 return box; | |
127 } | |
128 | |
129 static void | |
130 notify_input_cb(GntWidget *button, GntWidget *entry) | |
131 { | |
15822 | 132 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 133 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
134 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
135 | |
136 if (callback) | |
137 callback(data, text); | |
138 | |
139 while (button->parent) | |
140 button = button->parent; | |
141 | |
15822 | 142 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 143 } |
144 | |
145 static void * | |
146 finch_request_input(const char *title, const char *primary, | |
147 const char *secondary, const char *default_value, | |
148 gboolean multiline, gboolean masked, gchar *hint, | |
149 const char *ok_text, GCallback ok_cb, | |
150 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
|
151 PurpleAccount *account, const char *who, PurpleConversation *conv, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
152 void *user_data) |
15817 | 153 { |
154 GntWidget *window, *box, *entry; | |
155 | |
15822 | 156 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
15817 | 157 |
158 entry = gnt_entry_new(default_value); | |
159 if (masked) | |
160 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
161 gnt_box_add_widget(GNT_BOX(window), entry); | |
162 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
163 box = setup_button_box(window, user_data, notify_input_cb, entry, |
15817 | 164 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
165 gnt_box_add_widget(GNT_BOX(window), box); | |
166 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
167 setup_default_callback(window, cancel_cb, user_data); |
15817 | 168 gnt_widget_show(window); |
169 | |
170 return window; | |
171 } | |
172 | |
173 static void | |
15822 | 174 finch_close_request(PurpleRequestType type, gpointer ui_handle) |
15817 | 175 { |
176 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
|
177 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
|
178 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
|
179 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
|
180 } |
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
|
181 |
15817 | 182 while (widget->parent) |
183 widget = widget->parent; | |
184 gnt_widget_destroy(widget); | |
185 } | |
186 | |
187 static void | |
188 request_choice_cb(GntWidget *button, GntComboBox *combo) | |
189 { | |
15822 | 190 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 191 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
192 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; | |
193 | |
194 if (callback) | |
195 callback(data, choice); | |
196 | |
197 while (button->parent) | |
198 button = button->parent; | |
199 | |
15822 | 200 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 201 } |
202 | |
203 static void * | |
204 finch_request_choice(const char *title, const char *primary, | |
19528
b7fa8fa4de5b
Fix building on older glib versions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18411
diff
changeset
|
205 const char *secondary, int default_value, |
15817 | 206 const char *ok_text, GCallback ok_cb, |
207 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
|
208 PurpleAccount *account, const char *who, PurpleConversation *conv, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
209 void *user_data, va_list choices) |
15817 | 210 { |
211 GntWidget *window, *combo, *box; | |
212 const char *text; | |
213 int val; | |
214 | |
15822 | 215 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
15817 | 216 |
217 combo = gnt_combo_box_new(); | |
218 gnt_box_add_widget(GNT_BOX(window), combo); | |
219 while ((text = va_arg(choices, const char *))) | |
220 { | |
221 val = va_arg(choices, int); | |
222 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); | |
223 } | |
224 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); | |
225 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
226 box = setup_button_box(window, user_data, request_choice_cb, combo, |
15817 | 227 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
228 gnt_box_add_widget(GNT_BOX(window), box); | |
229 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
230 setup_default_callback(window, cancel_cb, user_data); |
15817 | 231 gnt_widget_show(window); |
232 | |
233 return window; | |
234 } | |
235 | |
236 static void | |
237 request_action_cb(GntWidget *button, GntWidget *window) | |
238 { | |
15822 | 239 PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 240 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
241 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); | |
242 | |
243 if (callback) | |
244 callback(data, id); | |
245 | |
15822 | 246 purple_request_close(PURPLE_REQUEST_ACTION, window); |
15817 | 247 } |
248 | |
249 static void* | |
250 finch_request_action(const char *title, const char *primary, | |
19528
b7fa8fa4de5b
Fix building on older glib versions.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18411
diff
changeset
|
251 const char *secondary, 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
|
252 PurpleAccount *account, const char *who, PurpleConversation *conv, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
253 void *user_data, size_t actioncount, |
15817 | 254 va_list actions) |
255 { | |
22096
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
256 GntWidget *window, *box, *button, *focus = NULL; |
15817 | 257 int i; |
258 | |
15822 | 259 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
15817 | 260 |
261 box = gnt_hbox_new(FALSE); | |
262 gnt_box_add_widget(GNT_BOX(window), box); | |
263 for (i = 0; i < actioncount; i++) | |
264 { | |
265 const char *text = va_arg(actions, const char *); | |
15822 | 266 PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
15817 | 267 |
268 button = gnt_button_new(text); | |
269 gnt_box_add_widget(GNT_BOX(box), button); | |
270 | |
271 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
272 g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); | |
273 g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); | |
274 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); | |
22096
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
275 |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
276 if (i == default_value) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
277 focus = button; |
15817 | 278 } |
279 | |
280 gnt_widget_show(window); | |
22096
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
281 if (focus) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
282 gnt_box_give_focus_to_child(GNT_BOX(window), focus); |
15817 | 283 |
284 return window; | |
285 } | |
286 | |
287 static void | |
15822 | 288 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
15817 | 289 { |
15822 | 290 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 291 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
292 GList *list; | |
293 | |
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
|
294 /* Update the data of the fields. Pidgin does this differently. Instead of |
15817 | 295 * updating the fields at the end like here, it updates the appropriate field |
296 * instantly whenever a change is made. That allows it to make sure the | |
297 * 'required' fields are entered before the user can hit OK. It's not the case | |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
298 * here, althought it can be done. */ |
15822 | 299 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
15817 | 300 { |
15822 | 301 PurpleRequestFieldGroup *group = list->data; |
302 GList *fields = purple_request_field_group_get_fields(group); | |
15817 | 303 |
304 for (; fields ; fields = fields->next) | |
305 { | |
15822 | 306 PurpleRequestField *field = fields->data; |
307 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
308 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | |
15817 | 309 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
310 GntWidget *check = FINCH_GET_DATA(field); |
15817 | 311 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
15822 | 312 purple_request_field_bool_set_value(field, value); |
15817 | 313 } |
15822 | 314 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 315 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
316 GntWidget *entry = FINCH_GET_DATA(field); |
15817 | 317 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
15822 | 318 purple_request_field_string_set_value(field, (text && *text) ? text : NULL); |
15817 | 319 } |
15822 | 320 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 321 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
322 GntWidget *entry = FINCH_GET_DATA(field); |
15817 | 323 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
324 int value = (text && *text) ? atoi(text) : 0; | |
15822 | 325 purple_request_field_int_set_value(field, value); |
15817 | 326 } |
15822 | 327 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 328 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
329 GntWidget *combo = FINCH_GET_DATA(field); |
15817 | 330 int id; |
331 id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); | |
15822 | 332 purple_request_field_choice_set_value(field, id); |
15817 | 333 } |
15822 | 334 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 335 { |
336 GList *list = NULL; | |
15822 | 337 if (purple_request_field_list_get_multi_select(field)) |
15817 | 338 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
339 GList *iter; |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
340 GntWidget *tree = FINCH_GET_DATA(field); |
15817 | 341 |
15822 | 342 iter = purple_request_field_list_get_items(field); |
15817 | 343 for (; iter; iter = iter->next) |
344 { | |
345 const char *text = iter->data; | |
15822 | 346 gpointer key = purple_request_field_list_get_data(field, text); |
15817 | 347 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
348 list = g_list_prepend(list, key); | |
349 } | |
350 } | |
351 else | |
352 { | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
353 GntWidget *combo = FINCH_GET_DATA(field); |
15817 | 354 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
355 list = g_list_append(list, data); | |
356 } | |
357 | |
15822 | 358 purple_request_field_list_set_selected(field, list); |
15817 | 359 g_list_free(list); |
360 } | |
15822 | 361 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 362 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
363 GntWidget *combo = FINCH_GET_DATA(field); |
15822 | 364 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
365 purple_request_field_account_set_value(field, acc); | |
15817 | 366 } |
367 } | |
368 } | |
369 | |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
370 purple_notify_close_with_handle(button); |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
371 |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
372 if (!purple_request_fields_all_required_filled(fields)) { |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
373 purple_notify_error(button, _("Error"), |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
374 _("You must fill all the required fields."), |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
375 _("The required fields are underlined.")); |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
376 return; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
377 } |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
378 |
15817 | 379 if (callback) |
380 callback(data, fields); | |
381 | |
382 while (button->parent) | |
383 button = button->parent; | |
384 | |
15822 | 385 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
15817 | 386 } |
387 | |
19761
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
388 static void |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
389 update_selected_account(GntEntry *screenname, const char *start, const char *end, |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
390 GntComboBox *accountlist) |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
391 { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
392 GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown)); |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
393 const char *name = gnt_entry_get_text(screenname); |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
394 while (accounts) { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
395 if (purple_find_buddy(accounts->data, name)) { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
396 gnt_combo_box_set_selected(accountlist, accounts->data); |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
397 gnt_widget_draw(GNT_WIDGET(accountlist)); |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
398 break; |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
399 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
400 accounts = accounts->next; |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
401 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
402 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
403 |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
404 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
405 create_boolean_field(PurpleRequestField *field) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
406 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
407 const char *label = purple_request_field_get_label(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
408 GntWidget *check = gnt_check_box_new(label); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
409 gnt_check_box_set_checked(GNT_CHECK_BOX(check), |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
410 purple_request_field_bool_get_default_value(field)); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
411 return check; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
412 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
413 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
414 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
415 create_string_field(PurpleRequestField *field, GntWidget **screenname) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
416 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
417 const char *hint = purple_request_field_get_type_hint(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
418 GntWidget *entry = gnt_entry_new( |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
419 purple_request_field_string_get_default_value(field)); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
420 gnt_entry_set_masked(GNT_ENTRY(entry), |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
421 purple_request_field_string_is_masked(field)); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
422 if (hint && purple_str_has_prefix(hint, "screenname")) { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
423 PurpleBlistNode *node = purple_blist_get_root(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
424 gboolean offline = purple_str_has_suffix(hint, "all"); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
425 for (; node; node = purple_blist_node_next(node, offline)) { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
426 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
427 continue; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
428 gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node)); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
429 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
430 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
431 if (screenname) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
432 *screenname = entry; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
433 } else if (hint && !strcmp(hint, "group")) { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
434 PurpleBlistNode *node; |
22212
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22096
diff
changeset
|
435 for (node = purple_blist_get_root(); node; |
6bb29f94862c
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22096
diff
changeset
|
436 node = purple_blist_node_get_sibling_next(node)) { |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
437 if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
22220
1f256f63c52c
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22217
diff
changeset
|
438 gnt_entry_add_suggest(GNT_ENTRY(entry), purple_group_get_name((PurpleGroup *)node)); |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
439 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
440 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
441 return entry; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
442 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
443 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
444 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
445 create_integer_field(PurpleRequestField *field) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
446 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
447 char str[256]; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
448 int val = purple_request_field_int_get_default_value(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
449 GntWidget *entry; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
450 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
451 snprintf(str, sizeof(str), "%d", val); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
452 entry = gnt_entry_new(str); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
453 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
454 return entry; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
455 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
456 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
457 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
458 create_choice_field(PurpleRequestField *field) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
459 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
460 int id; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
461 GList *list; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
462 GntWidget *combo = gnt_combo_box_new(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
463 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
464 list = purple_request_field_choice_get_labels(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
465 for (id = 1; list; list = list->next, id++) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
466 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
467 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
468 GINT_TO_POINTER(id), list->data); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
469 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
470 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
471 GINT_TO_POINTER(purple_request_field_choice_get_default_value(field))); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
472 return combo; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
473 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
474 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
475 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
476 create_list_field(PurpleRequestField *field) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
477 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
478 GntWidget *ret = NULL; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
479 GList *list; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
480 gboolean multi = purple_request_field_list_get_multi_select(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
481 if (multi) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
482 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
483 GntWidget *tree = gnt_tree_new(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
484 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
485 list = purple_request_field_list_get_items(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
486 for (; list; list = list->next) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
487 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
488 const char *text = list->data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
489 gpointer key = purple_request_field_list_get_data(field, text); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
490 gnt_tree_add_choice(GNT_TREE(tree), key, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
491 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
492 if (purple_request_field_list_is_selected(field, text)) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
493 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
494 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
495 ret = tree; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
496 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
497 else |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
498 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
499 GntWidget *combo = gnt_combo_box_new(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
500 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
501 list = purple_request_field_list_get_items(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
502 for (; list; list = list->next) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
503 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
504 const char *text = list->data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
505 gpointer key = purple_request_field_list_get_data(field, text); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
506 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
507 if (purple_request_field_list_is_selected(field, text)) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
508 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
509 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
510 ret = combo; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
511 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
512 return ret; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
513 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
514 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
515 static GntWidget* |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
516 create_account_field(PurpleRequestField *field) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
517 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
518 gboolean all; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
519 PurpleAccount *def; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
520 GList *list; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
521 GntWidget *combo = gnt_combo_box_new(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
522 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
523 all = purple_request_field_account_get_show_all(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
524 def = purple_request_field_account_get_value(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
525 if (!def) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
526 def = purple_request_field_account_get_default_value(field); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
527 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
528 if (all) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
529 list = purple_accounts_get_all(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
530 else |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
531 list = purple_connections_get_all(); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
532 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
533 for (; list; list = list->next) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
534 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
535 PurpleAccount *account; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
536 char *text; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
537 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
538 if (all) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
539 account = list->data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
540 else |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
541 account = purple_connection_get_account(list->data); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
542 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
543 text = g_strdup_printf("%s (%s)", |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
544 purple_account_get_username(account), |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
545 purple_account_get_protocol_name(account)); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
546 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
547 g_free(text); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
548 if (account == def) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
549 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
550 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
551 gnt_widget_set_size(combo, 20, 3); /* ew */ |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
552 return combo; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
553 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
554 |
15817 | 555 static void * |
556 finch_request_fields(const char *title, const char *primary, | |
15822 | 557 const char *secondary, PurpleRequestFields *allfields, |
15817 | 558 const char *ok, GCallback ok_cb, |
559 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
|
560 PurpleAccount *account, const char *who, PurpleConversation *conv, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
561 void *userdata) |
15817 | 562 { |
563 GntWidget *window, *box; | |
564 GList *grlist; | |
19761
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
565 GntWidget *screenname = NULL, *accountlist = NULL; |
15817 | 566 |
15822 | 567 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
15817 | 568 |
569 /* This is how it's going to work: the request-groups are going to be | |
570 * stacked vertically one after the other. A GntLine will be separating | |
571 * the groups. */ | |
572 box = gnt_vbox_new(FALSE); | |
573 gnt_box_set_pad(GNT_BOX(box), 0); | |
574 gnt_box_set_fill(GNT_BOX(box), TRUE); | |
15822 | 575 for (grlist = purple_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
15817 | 576 { |
15822 | 577 PurpleRequestFieldGroup *group = grlist->data; |
578 GList *fields = purple_request_field_group_get_fields(group); | |
15817 | 579 GntWidget *hbox; |
15822 | 580 const char *title = purple_request_field_group_get_title(group); |
15817 | 581 |
582 if (title) | |
583 gnt_box_add_widget(GNT_BOX(box), | |
584 gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); | |
585 | |
586 for (; fields ; fields = fields->next) | |
587 { | |
588 /* XXX: Break each of the fields into a separate function? */ | |
15822 | 589 PurpleRequestField *field = fields->data; |
590 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
591 const char *label = purple_request_field_get_label(field); | |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
592 |
15817 | 593 hbox = gnt_hbox_new(TRUE); /* hrm */ |
594 gnt_box_add_widget(GNT_BOX(box), hbox); | |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
595 |
15822 | 596 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
15817 | 597 { |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
598 GntWidget *l; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
599 if (purple_request_field_is_required(field)) |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
600 l = gnt_label_new_with_format(label, GNT_TEXT_FLAG_UNDERLINE); |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
601 else |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
602 l = gnt_label_new(label); |
15817 | 603 gnt_widget_set_size(l, 0, 1); |
604 gnt_box_add_widget(GNT_BOX(hbox), l); | |
605 } | |
606 | |
15822 | 607 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15817 | 608 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
609 FINCH_SET_DATA(field, create_boolean_field(field)); |
15817 | 610 } |
15822 | 611 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 612 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
613 FINCH_SET_DATA(field, create_string_field(field, &screenname)); |
15817 | 614 } |
15822 | 615 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 616 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
617 FINCH_SET_DATA(field, create_integer_field(field)); |
15817 | 618 } |
15822 | 619 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 620 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
621 FINCH_SET_DATA(field, create_choice_field(field)); |
15817 | 622 } |
15822 | 623 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 624 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
625 FINCH_SET_DATA(field, create_list_field(field)); |
15817 | 626 } |
15822 | 627 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 628 { |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
629 accountlist = FINCH_SET_DATA(field, create_account_field(field)); |
15817 | 630 } |
631 else | |
632 { | |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
633 FINCH_SET_DATA(field, gnt_label_new_with_format(_("Not implemented yet."), |
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
634 GNT_TEXT_FLAG_BOLD)); |
15817 | 635 } |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
636 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
22217
ad357ca94de9
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22212
diff
changeset
|
637 gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); |
15817 | 638 } |
639 if (grlist->next) | |
640 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
641 } | |
642 gnt_box_add_widget(GNT_BOX(window), box); | |
643 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
644 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
15817 | 645 ok, ok_cb, cancel, cancel_cb, NULL); |
646 gnt_box_add_widget(GNT_BOX(window), box); | |
647 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
648 setup_default_callback(window, cancel_cb, userdata); |
15817 | 649 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
|
650 |
19761
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
651 if (screenname && accountlist) { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
652 g_signal_connect(screenname, "completion", G_CALLBACK(update_selected_account), accountlist); |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
653 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
654 |
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
|
655 g_object_set_data(G_OBJECT(window), "fields", allfields); |
15817 | 656 |
657 return window; | |
658 } | |
659 | |
660 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
661 file_cancel_cb(gpointer fq, GntWidget *wid) |
15817 | 662 { |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
663 FinchFileRequest *data = fq; |
15817 | 664 if (data->cbs[1] != NULL) |
15822 | 665 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL); |
15817 | 666 |
15822 | 667 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 668 } |
669 | |
670 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
671 file_ok_cb(gpointer fq, GntWidget *widget) |
15817 | 672 { |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
673 FinchFileRequest *data = fq; |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
674 char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog)); |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
675 char *dir = g_path_get_dirname(file); |
15817 | 676 if (data->cbs[0] != NULL) |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
677 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
678 g_free(file); |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
679 purple_prefs_set_path(data->save ? "/finch/filelocations/last_save_folder" : |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
680 "/finch/filelocations/last_open_folder", dir); |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
681 g_free(dir); |
15817 | 682 |
15822 | 683 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 684 } |
685 | |
686 static void | |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
687 file_request_destroy(FinchFileRequest *data) |
15817 | 688 { |
689 g_free(data->cbs); | |
690 g_free(data); | |
691 } | |
692 | |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
693 static FinchFileRequest * |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
694 finch_file_request_window(const char *title, const char *path, |
15817 | 695 GCallback ok_cb, GCallback cancel_cb, |
21099
51cf02dbdb0e
disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents:
21095
diff
changeset
|
696 void *user_data) |
15817 | 697 { |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
698 GntWidget *window = gnt_file_sel_new(); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
699 GntFileSel *sel = GNT_FILE_SEL(window); |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
700 FinchFileRequest *data = g_new0(FinchFileRequest, 1); |
15817 | 701 |
702 data->user_data = user_data; | |
703 data->cbs = g_new0(GCallback, 2); | |
704 data->cbs[0] = ok_cb; | |
705 data->cbs[1] = cancel_cb; | |
706 data->dialog = window; | |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
707 gnt_box_set_title(GNT_BOX(window), title); |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
708 |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
709 gnt_file_sel_set_current_location(sel, (path && *path) ? path : purple_home_dir()); |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
710 |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
711 g_signal_connect(G_OBJECT(sel->cancel), "activate", |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
712 G_CALLBACK(action_performed), window); |
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
713 g_signal_connect(G_OBJECT(sel->select), "activate", |
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
714 G_CALLBACK(action_performed), window); |
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
715 g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate", |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
716 G_CALLBACK(file_cancel_cb), data); |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
717 g_signal_connect_swapped(G_OBJECT(sel->select), "activate", |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
718 G_CALLBACK(file_ok_cb), data); |
15817 | 719 |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
720 setup_default_callback(window, file_cancel_cb, data); |
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
721 g_object_set_data_full(G_OBJECT(window), "filerequestdata", data, |
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
722 (GDestroyNotify)file_request_destroy); |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
723 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
724 return data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
725 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
726 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
727 static void * |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
728 finch_request_file(const char *title, const char *filename, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
729 gboolean savedialog, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
730 GCallback ok_cb, GCallback cancel_cb, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
731 PurpleAccount *account, const char *who, PurpleConversation *conv, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
732 void *user_data) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
733 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
734 FinchFileRequest *data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
735 const char *path; |
15817 | 736 |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
737 path = purple_prefs_get_path(savedialog ? "/finch/filelocations/last_save_folder" : "/finch/filelocations/last_open_folder"); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
738 data = finch_file_request_window(title ? title : (savedialog ? _("Save File...") : _("Open File...")), path, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
739 ok_cb, cancel_cb, user_data); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
740 data->save = savedialog; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
741 if (savedialog) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
742 gnt_file_sel_set_suggested_filename(GNT_FILE_SEL(data->dialog), filename); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
743 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
744 gnt_widget_show(data->dialog); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
745 return data->dialog; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
746 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
747 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
748 static void * |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
749 finch_request_folder(const char *title, const char *dirname, GCallback ok_cb, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
750 GCallback cancel_cb, PurpleAccount *account, const char *who, PurpleConversation *conv, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
751 void *user_data) |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
752 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
753 FinchFileRequest *data; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
754 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
755 data = finch_file_request_window(title ? title : _("Choose Location..."), dirname, |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
756 ok_cb, cancel_cb, user_data); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
757 data->save = TRUE; |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
758 gnt_file_sel_set_dirs_only(GNT_FILE_SEL(data->dialog), TRUE); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
759 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
760 gnt_widget_show(data->dialog); |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
761 return data->dialog; |
15817 | 762 } |
763 | |
15822 | 764 static PurpleRequestUiOps uiops = |
15817 | 765 { |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
766 finch_request_input, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
767 finch_request_choice, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
768 finch_request_action, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
769 finch_request_fields, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
770 finch_request_file, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
771 finch_close_request, |
21893
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
772 finch_request_folder, |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
773 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
774 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
775 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
776 NULL |
15817 | 777 }; |
778 | |
15822 | 779 PurpleRequestUiOps *finch_request_get_ui_ops() |
15817 | 780 { |
781 return &uiops; | |
782 } | |
783 | |
784 void finch_request_init() | |
785 { | |
786 } | |
787 | |
788 void finch_request_uninit() | |
789 { | |
790 } | |
791 | |
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
|
792 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
|
793 { |
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
|
794 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
|
795 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
|
796 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
|
797 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
|
798 |
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
|
799 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
|
800 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
|
801 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
|
802 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
|
803 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
|
804 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
|
805 |
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
|
806 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
|
807 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
|
808 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
|
809 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
|
810 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
|
811 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
|
812 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
|
813 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
|
814 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
|
815 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
|
816 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
|
817 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
|
818 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
|
819 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
|
820 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
|
821 } |
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
|
822 |
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
|
823 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
|
824 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
|
825 case PURPLE_PREF_INT: |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
826 { |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
827 long int tmp = GPOINTER_TO_INT(val); |
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
|
828 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
|
829 sscanf(val, "%ld", &tmp); |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
830 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
|
831 break; |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
832 } |
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
|
833 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
|
834 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
|
835 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
|
836 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
|
837 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
|
838 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
|
839 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
|
840 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
|
841 } |
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
|
842 } |
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
|
843 } |
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
|
844 } |
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
|
845 |
22005
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
846 GntWidget *finch_request_field_get_widget(PurpleRequestField *field) |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
847 { |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
848 GntWidget *ret = NULL; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
849 switch (purple_request_field_get_type(field)) { |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
850 case PURPLE_REQUEST_FIELD_BOOLEAN: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
851 ret = create_boolean_field(field); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
852 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
853 case PURPLE_REQUEST_FIELD_STRING: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
854 ret = create_string_field(field, NULL); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
855 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
856 case PURPLE_REQUEST_FIELD_INTEGER: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
857 ret = create_integer_field(field); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
858 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
859 case PURPLE_REQUEST_FIELD_CHOICE: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
860 ret = create_choice_field(field); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
861 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
862 case PURPLE_REQUEST_FIELD_LIST: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
863 ret = create_list_field(field); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
864 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
865 case PURPLE_REQUEST_FIELD_ACCOUNT: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
866 ret = create_account_field(field); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
867 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
868 default: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
869 purple_debug_error("GntRequest", "Unimplemented request-field %d\n", purple_request_field_get_type(field)); |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
870 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
871 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
872 return ret; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
873 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
874 |