Mercurial > pidgin
annotate finch/gntrequest.c @ 26808:8cb3403430bb
merge of '2481b51dce05a40973c023cb3c62c66b082e11bf'
and '747f7586a776a69a1fba475128617b8bfe6a649b'
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 03 May 2009 23:09:57 +0000 |
parents | 1c73d2ef9ddc |
children | 710cbace0076 |
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 |
25839
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25838
diff
changeset
|
42 /* XXX: Until gobjectification ... */ |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25838
diff
changeset
|
43 #undef FINCH_GET_DATA |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25838
diff
changeset
|
44 #undef FINCH_SET_DATA |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25838
diff
changeset
|
45 #define FINCH_GET_DATA(obj) purple_request_field_get_ui_data(obj) |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25838
diff
changeset
|
46 #define FINCH_SET_DATA(obj, data) purple_request_field_set_ui_data(obj, data) |
15817 | 47 |
48 typedef struct | |
49 { | |
50 void *user_data; | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
51 GntWidget *dialog; |
15817 | 52 GCallback *cbs; |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
53 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
|
54 } FinchFileRequest; |
15817 | 55 |
56 static GntWidget * | |
57 setup_request_window(const char *title, const char *primary, | |
15822 | 58 const char *secondary, PurpleRequestType type) |
15817 | 59 { |
60 GntWidget *window; | |
61 | |
62 window = gnt_vbox_new(FALSE); | |
63 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
64 gnt_box_set_title(GNT_BOX(window), title); | |
65 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
66 | |
67 if (primary) | |
68 gnt_box_add_widget(GNT_BOX(window), | |
69 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); | |
70 if (secondary) | |
71 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); | |
72 | |
15822 | 73 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(purple_request_close), |
15817 | 74 GINT_TO_POINTER(type)); |
75 | |
76 return window; | |
77 } | |
78 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
79 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
80 * 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
|
81 * 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
|
82 */ |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
83 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
84 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
|
85 { |
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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 } |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
91 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
92 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
93 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
|
94 { |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
95 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
|
96 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
|
97 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
|
98 NULL); |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
99 } |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
100 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
101 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
102 * 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
|
103 * 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
|
104 * cb: the callback |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
105 * 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
|
106 * (text, primary-callback) pairs, ended by a NULL |
22847
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
107 * |
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
108 * The cancellation callback should be the last callback sent. |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
109 */ |
15817 | 110 static GntWidget * |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
111 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) |
15817 | 112 { |
22852
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22847
diff
changeset
|
113 GntWidget *box; |
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22847
diff
changeset
|
114 GntWidget *button = NULL; |
15817 | 115 va_list list; |
116 const char *text; | |
117 gpointer callback; | |
118 | |
119 box = gnt_hbox_new(FALSE); | |
120 | |
121 va_start(list, data); | |
122 | |
123 while ((text = va_arg(list, const char *))) | |
124 { | |
125 callback = va_arg(list, gpointer); | |
126 button = gnt_button_new(text); | |
127 gnt_box_add_widget(GNT_BOX(box), button); | |
128 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
129 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
|
130 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
15817 | 131 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
132 } | |
133 | |
22852
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22847
diff
changeset
|
134 if (button) |
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22847
diff
changeset
|
135 g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); |
22847
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
136 |
15817 | 137 va_end(list); |
138 return box; | |
139 } | |
140 | |
141 static void | |
142 notify_input_cb(GntWidget *button, GntWidget *entry) | |
143 { | |
15822 | 144 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 145 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
146 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
147 | |
148 if (callback) | |
149 callback(data, text); | |
150 | |
151 while (button->parent) | |
152 button = button->parent; | |
153 | |
15822 | 154 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 155 } |
156 | |
157 static void * | |
158 finch_request_input(const char *title, const char *primary, | |
159 const char *secondary, const char *default_value, | |
160 gboolean multiline, gboolean masked, gchar *hint, | |
161 const char *ok_text, GCallback ok_cb, | |
162 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
|
163 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15817 | 164 void *user_data) |
165 { | |
166 GntWidget *window, *box, *entry; | |
167 | |
15822 | 168 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
15817 | 169 |
170 entry = gnt_entry_new(default_value); | |
171 if (masked) | |
172 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
173 gnt_box_add_widget(GNT_BOX(window), entry); | |
174 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
175 box = setup_button_box(window, user_data, notify_input_cb, entry, |
15817 | 176 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
177 gnt_box_add_widget(GNT_BOX(window), box); | |
178 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
179 setup_default_callback(window, cancel_cb, user_data); |
15817 | 180 gnt_widget_show(window); |
181 | |
182 return window; | |
183 } | |
184 | |
185 static void | |
15822 | 186 finch_close_request(PurpleRequestType type, gpointer ui_handle) |
15817 | 187 { |
188 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
|
189 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
|
190 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
|
191 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
|
192 } |
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
|
193 |
15817 | 194 while (widget->parent) |
195 widget = widget->parent; | |
196 gnt_widget_destroy(widget); | |
197 } | |
198 | |
199 static void | |
200 request_choice_cb(GntWidget *button, GntComboBox *combo) | |
201 { | |
15822 | 202 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 203 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
204 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; | |
205 | |
206 if (callback) | |
207 callback(data, choice); | |
208 | |
209 while (button->parent) | |
210 button = button->parent; | |
211 | |
15822 | 212 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15817 | 213 } |
214 | |
215 static void * | |
216 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
|
217 const char *secondary, int default_value, |
15817 | 218 const char *ok_text, GCallback ok_cb, |
219 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
|
220 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15817 | 221 void *user_data, va_list choices) |
222 { | |
223 GntWidget *window, *combo, *box; | |
224 const char *text; | |
225 int val; | |
226 | |
15822 | 227 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
15817 | 228 |
229 combo = gnt_combo_box_new(); | |
230 gnt_box_add_widget(GNT_BOX(window), combo); | |
231 while ((text = va_arg(choices, const char *))) | |
232 { | |
233 val = va_arg(choices, int); | |
234 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); | |
235 } | |
236 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); | |
237 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
238 box = setup_button_box(window, user_data, request_choice_cb, combo, |
15817 | 239 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
240 gnt_box_add_widget(GNT_BOX(window), box); | |
241 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
242 setup_default_callback(window, cancel_cb, user_data); |
15817 | 243 gnt_widget_show(window); |
244 | |
245 return window; | |
246 } | |
247 | |
248 static void | |
249 request_action_cb(GntWidget *button, GntWidget *window) | |
250 { | |
15822 | 251 PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 252 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
253 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); | |
254 | |
255 if (callback) | |
256 callback(data, id); | |
257 | |
15822 | 258 purple_request_close(PURPLE_REQUEST_ACTION, window); |
15817 | 259 } |
260 | |
261 static void* | |
262 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
|
263 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
|
264 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15817 | 265 void *user_data, size_t actioncount, |
266 va_list actions) | |
267 { | |
22096
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
268 GntWidget *window, *box, *button, *focus = NULL; |
15817 | 269 int i; |
270 | |
15822 | 271 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
15817 | 272 |
273 box = gnt_hbox_new(FALSE); | |
274 gnt_box_add_widget(GNT_BOX(window), box); | |
275 for (i = 0; i < actioncount; i++) | |
276 { | |
277 const char *text = va_arg(actions, const char *); | |
15822 | 278 PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
15817 | 279 |
280 button = gnt_button_new(text); | |
281 gnt_box_add_widget(GNT_BOX(box), button); | |
282 | |
283 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
284 g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); | |
285 g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); | |
286 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
|
287 |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
288 if (i == default_value) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
289 focus = button; |
15817 | 290 } |
291 | |
292 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
|
293 if (focus) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
294 gnt_box_give_focus_to_child(GNT_BOX(window), focus); |
15817 | 295 |
296 return window; | |
297 } | |
298 | |
299 static void | |
15822 | 300 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
15817 | 301 { |
15822 | 302 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15817 | 303 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
304 GList *list; | |
305 | |
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
|
306 /* Update the data of the fields. Pidgin does this differently. Instead of |
15817 | 307 * updating the fields at the end like here, it updates the appropriate field |
308 * instantly whenever a change is made. That allows it to make sure the | |
309 * '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
|
310 * here, althought it can be done. */ |
15822 | 311 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
15817 | 312 { |
15822 | 313 PurpleRequestFieldGroup *group = list->data; |
314 GList *fields = purple_request_field_group_get_fields(group); | |
22847
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
315 |
15817 | 316 for (; fields ; fields = fields->next) |
317 { | |
15822 | 318 PurpleRequestField *field = fields->data; |
319 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
320 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | |
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 *check = FINCH_GET_DATA(field); |
15817 | 323 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
15822 | 324 purple_request_field_bool_set_value(field, value); |
15817 | 325 } |
15822 | 326 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 327 { |
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
|
328 GntWidget *entry = FINCH_GET_DATA(field); |
15817 | 329 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
15822 | 330 purple_request_field_string_set_value(field, (text && *text) ? text : NULL); |
15817 | 331 } |
15822 | 332 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 333 { |
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
|
334 GntWidget *entry = FINCH_GET_DATA(field); |
15817 | 335 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
336 int value = (text && *text) ? atoi(text) : 0; | |
15822 | 337 purple_request_field_int_set_value(field, value); |
15817 | 338 } |
15822 | 339 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 340 { |
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
|
341 GntWidget *combo = FINCH_GET_DATA(field); |
15817 | 342 int id; |
343 id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); | |
15822 | 344 purple_request_field_choice_set_value(field, id); |
15817 | 345 } |
15822 | 346 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 347 { |
348 GList *list = NULL; | |
15822 | 349 if (purple_request_field_list_get_multi_select(field)) |
15817 | 350 { |
18118
ab6d2763b8d8
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@wiktel.com>
parents:
18063
diff
changeset
|
351 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
|
352 GntWidget *tree = FINCH_GET_DATA(field); |
15817 | 353 |
15822 | 354 iter = purple_request_field_list_get_items(field); |
15817 | 355 for (; iter; iter = iter->next) |
356 { | |
357 const char *text = iter->data; | |
15822 | 358 gpointer key = purple_request_field_list_get_data(field, text); |
15817 | 359 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
360 list = g_list_prepend(list, key); | |
361 } | |
362 } | |
363 else | |
364 { | |
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
|
365 GntWidget *combo = FINCH_GET_DATA(field); |
15817 | 366 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
367 list = g_list_append(list, data); | |
368 } | |
369 | |
15822 | 370 purple_request_field_list_set_selected(field, list); |
15817 | 371 g_list_free(list); |
372 } | |
15822 | 373 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 374 { |
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
|
375 GntWidget *combo = FINCH_GET_DATA(field); |
15822 | 376 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
377 purple_request_field_account_set_value(field, acc); | |
15817 | 378 } |
379 } | |
380 } | |
381 | |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
382 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
|
383 |
22847
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
384 if (!g_object_get_data(G_OBJECT(button), "cancellation-function") && |
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
385 !purple_request_fields_all_required_filled(fields)) { |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
386 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
|
387 _("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
|
388 _("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
|
389 return; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
390 } |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
391 |
15817 | 392 if (callback) |
393 callback(data, fields); | |
394 | |
395 while (button->parent) | |
396 button = button->parent; | |
397 | |
15822 | 398 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
15817 | 399 } |
400 | |
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
|
401 static void |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
402 update_selected_account(GntEntry *username, const char *start, const char *end, |
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
|
403 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
|
404 { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
405 GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown)); |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
406 const char *name = gnt_entry_get_text(username); |
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
|
407 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
|
408 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
|
409 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
|
410 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
|
411 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
|
412 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
413 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
|
414 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
415 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
416 |
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
|
417 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
|
418 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
|
419 { |
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 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
|
421 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
|
422 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
|
423 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
|
424 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
|
425 } |
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 |
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 static GntWidget* |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
428 create_string_field(PurpleRequestField *field, GntWidget **username) |
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
|
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 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
|
431 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
|
432 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 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
|
438 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
|
439 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
|
440 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
|
441 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
|
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 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
444 if (username) |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
445 *username = entry; |
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
|
446 } 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 } |
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 } |
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_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
|
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 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
|
461 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
|
462 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
|
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 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
|
465 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
|
466 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
|
467 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
|
468 } |
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 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
|
471 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
|
472 { |
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 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
|
474 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
|
475 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
|
476 |
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 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
|
478 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
|
479 { |
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 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
|
481 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
|
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 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
|
484 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
|
485 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
|
486 } |
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 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
|
489 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
|
490 { |
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 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
|
492 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
|
493 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
|
494 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
|
495 { |
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 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
|
497 |
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 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
|
499 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
|
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 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
|
502 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
|
503 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
|
504 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
|
505 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
|
506 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
|
507 } |
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 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
|
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 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
|
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 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
|
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 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
|
515 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
|
516 { |
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 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
|
518 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
|
519 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
|
520 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
|
521 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
|
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 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
|
524 } |
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 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
|
526 } |
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 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
|
529 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
|
530 { |
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 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
|
532 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
|
533 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
|
534 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
|
535 |
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 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
|
537 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
|
538 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
|
539 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
|
540 |
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 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
|
542 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
|
543 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
|
544 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
|
545 |
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 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
|
547 { |
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 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
|
549 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
|
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 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
|
552 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
|
553 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
|
554 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
|
555 |
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
|
556 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
|
557 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
|
558 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
|
559 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
|
560 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
|
561 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
|
562 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
|
563 } |
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
|
564 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
|
565 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
|
566 } |
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
|
567 |
15817 | 568 static void * |
569 finch_request_fields(const char *title, const char *primary, | |
15822 | 570 const char *secondary, PurpleRequestFields *allfields, |
15817 | 571 const char *ok, GCallback ok_cb, |
572 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
|
573 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15817 | 574 void *userdata) |
575 { | |
576 GntWidget *window, *box; | |
577 GList *grlist; | |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
578 GntWidget *username = NULL, *accountlist = NULL; |
15817 | 579 |
15822 | 580 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
15817 | 581 |
582 /* This is how it's going to work: the request-groups are going to be | |
583 * stacked vertically one after the other. A GntLine will be separating | |
584 * the groups. */ | |
585 box = gnt_vbox_new(FALSE); | |
586 gnt_box_set_pad(GNT_BOX(box), 0); | |
587 gnt_box_set_fill(GNT_BOX(box), TRUE); | |
15822 | 588 for (grlist = purple_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
15817 | 589 { |
15822 | 590 PurpleRequestFieldGroup *group = grlist->data; |
591 GList *fields = purple_request_field_group_get_fields(group); | |
15817 | 592 GntWidget *hbox; |
15822 | 593 const char *title = purple_request_field_group_get_title(group); |
15817 | 594 |
595 if (title) | |
596 gnt_box_add_widget(GNT_BOX(box), | |
597 gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); | |
598 | |
599 for (; fields ; fields = fields->next) | |
600 { | |
601 /* XXX: Break each of the fields into a separate function? */ | |
15822 | 602 PurpleRequestField *field = fields->data; |
603 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
604 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
|
605 |
15817 | 606 hbox = gnt_hbox_new(TRUE); /* hrm */ |
607 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
|
608 |
15822 | 609 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
15817 | 610 { |
22789
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
611 GntWidget *l; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
612 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
|
613 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
|
614 else |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
615 l = gnt_label_new(label); |
15817 | 616 gnt_widget_set_size(l, 0, 1); |
617 gnt_box_add_widget(GNT_BOX(hbox), l); | |
618 } | |
619 | |
15822 | 620 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15817 | 621 { |
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
|
622 FINCH_SET_DATA(field, create_boolean_field(field)); |
15817 | 623 } |
15822 | 624 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15817 | 625 { |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
626 FINCH_SET_DATA(field, create_string_field(field, &username)); |
15817 | 627 } |
15822 | 628 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15817 | 629 { |
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
|
630 FINCH_SET_DATA(field, create_integer_field(field)); |
15817 | 631 } |
15822 | 632 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15817 | 633 { |
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
|
634 FINCH_SET_DATA(field, create_choice_field(field)); |
15817 | 635 } |
15822 | 636 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15817 | 637 { |
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
|
638 FINCH_SET_DATA(field, create_list_field(field)); |
15817 | 639 } |
15822 | 640 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15817 | 641 { |
25837
5d681e194fb3
Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents:
22852
diff
changeset
|
642 accountlist = create_account_field(field); |
25838
c039a6e448d7
Revert the last 'struct-hiding' change.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25837
diff
changeset
|
643 FINCH_SET_DATA(field, accountlist); |
15817 | 644 } |
645 else | |
646 { | |
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
|
647 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
|
648 GNT_TEXT_FLAG_BOLD)); |
15817 | 649 } |
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
|
650 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
|
651 gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); |
15817 | 652 } |
653 if (grlist->next) | |
654 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
655 } | |
656 gnt_box_add_widget(GNT_BOX(window), box); | |
657 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
658 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
15817 | 659 ok, ok_cb, cancel, cancel_cb, NULL); |
660 gnt_box_add_widget(GNT_BOX(window), box); | |
661 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
662 setup_default_callback(window, cancel_cb, userdata); |
15817 | 663 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
|
664 |
25925
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
665 if (username && accountlist) { |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25839
diff
changeset
|
666 g_signal_connect(username, "completion", G_CALLBACK(update_selected_account), accountlist); |
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
|
667 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
668 |
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
|
669 g_object_set_data(G_OBJECT(window), "fields", allfields); |
22847
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22789
diff
changeset
|
670 |
15817 | 671 return window; |
672 } | |
673 | |
674 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
675 file_cancel_cb(gpointer fq, GntWidget *wid) |
15817 | 676 { |
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
|
677 FinchFileRequest *data = fq; |
15817 | 678 if (data->cbs[1] != NULL) |
15822 | 679 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL); |
15817 | 680 |
15822 | 681 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 682 } |
683 | |
684 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
685 file_ok_cb(gpointer fq, GntWidget *widget) |
15817 | 686 { |
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 FinchFileRequest *data = fq; |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
688 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
|
689 char *dir = g_path_get_dirname(file); |
15817 | 690 if (data->cbs[0] != NULL) |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
691 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
692 g_free(file); |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
693 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
|
694 "/finch/filelocations/last_open_folder", dir); |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
695 g_free(dir); |
15817 | 696 |
15822 | 697 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15817 | 698 } |
699 | |
700 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
|
701 file_request_destroy(FinchFileRequest *data) |
15817 | 702 { |
703 g_free(data->cbs); | |
704 g_free(data); | |
705 } | |
706 | |
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 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
|
708 finch_file_request_window(const char *title, const char *path, |
15817 | 709 GCallback ok_cb, GCallback cancel_cb, |
710 void *user_data) | |
711 { | |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
712 GntWidget *window = gnt_file_sel_new(); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
713 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
|
714 FinchFileRequest *data = g_new0(FinchFileRequest, 1); |
15817 | 715 |
716 data->user_data = user_data; | |
717 data->cbs = g_new0(GCallback, 2); | |
718 data->cbs[0] = ok_cb; | |
719 data->cbs[1] = cancel_cb; | |
720 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
|
721 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
|
722 |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
723 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
|
724 |
15927
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15924
diff
changeset
|
725 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
|
726 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
|
727 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
|
728 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
|
729 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
|
730 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
|
731 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
|
732 G_CALLBACK(file_ok_cb), data); |
15817 | 733 |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
734 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
|
735 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
|
736 (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
|
737 |
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 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
|
739 } |
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 |
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 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
|
742 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
|
743 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
|
744 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
|
745 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
|
746 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
|
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 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
|
749 const char *path; |
15817 | 750 |
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
|
751 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
|
752 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
|
753 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
|
754 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
|
755 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
|
756 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
|
757 |
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_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
|
759 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
|
760 } |
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 |
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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 { |
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
|
767 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
|
768 |
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
|
769 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
|
770 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
|
771 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
|
772 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
|
773 |
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
|
774 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
|
775 return data->dialog; |
15817 | 776 } |
777 | |
15822 | 778 static PurpleRequestUiOps uiops = |
15817 | 779 { |
17091
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
780 finch_request_input, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
781 finch_request_choice, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
782 finch_request_action, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
783 finch_request_fields, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
784 finch_request_file, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
785 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
|
786 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
|
787 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
788 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
789 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16927
diff
changeset
|
790 NULL |
15817 | 791 }; |
792 | |
15822 | 793 PurpleRequestUiOps *finch_request_get_ui_ops() |
15817 | 794 { |
795 return &uiops; | |
796 } | |
797 | |
798 void finch_request_init() | |
799 { | |
800 } | |
801 | |
802 void finch_request_uninit() | |
803 { | |
804 } | |
805 | |
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
|
806 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
|
807 { |
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 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
|
809 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
|
810 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
|
811 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
|
812 |
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 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
|
814 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
|
815 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
|
816 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
|
817 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
|
818 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
|
819 |
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 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
|
821 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
|
822 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
|
823 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
|
824 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
|
825 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
|
826 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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 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
|
833 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
|
834 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
|
835 } |
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 |
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 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
|
838 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
|
839 case PURPLE_PREF_INT: |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
840 { |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
841 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
|
842 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
|
843 sscanf(val, "%ld", &tmp); |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
844 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
|
845 break; |
17392
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17091
diff
changeset
|
846 } |
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
|
847 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
|
848 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
|
849 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
|
850 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
|
851 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
|
852 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
|
853 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
|
854 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
|
855 } |
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
|
856 } |
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
|
857 } |
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
|
858 } |
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
|
859 |
22005
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
860 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
|
861 { |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
862 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
|
863 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
|
864 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
|
865 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
|
866 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
867 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
|
868 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
|
869 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
870 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
|
871 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
|
872 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
873 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
|
874 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
|
875 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
876 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
|
877 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
|
878 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
879 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
|
880 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
|
881 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
882 default: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
883 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
|
884 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
885 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
886 return ret; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
887 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
888 |