Mercurial > pidgin.yaz
annotate finch/gntrequest.c @ 30748:ea96292336f0
Save and cancel-on-exit any URL requests, instead of checking the
connection for validity when it might be gone.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sat, 31 Jul 2010 20:47:31 +0000 |
parents | b258ffa87424 |
children | a8cc50c2279f |
rev | line source |
---|---|
15818 | 1 /** |
2 * @file gntrequest.c GNT Request API | |
16194
0f0832c13fcb
Rename the Doxygen group from gntui to finch and define the finch group
Richard Laager <rlaager@wiktel.com>
parents:
16164
diff
changeset
|
3 * @ingroup finch |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19937
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19937
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19937
diff
changeset
|
6 /* finch |
15818 | 7 * |
15871
66dff3dfdea6
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@wiktel.com>
parents:
15844
diff
changeset
|
8 * Finch is the legal property of its developers, whose names are too numerous |
15818 | 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 | |
19680
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 |
15818 | 25 */ |
29220
88d889b54df4
Fix building finch & libgnt using older gcc or non-gcc compilers that do
Stu Tomlinson <stu@nosnilmot.com>
parents:
27663
diff
changeset
|
26 #include <internal.h> |
88d889b54df4
Fix building finch & libgnt using older gcc or non-gcc compilers that do
Stu Tomlinson <stu@nosnilmot.com>
parents:
27663
diff
changeset
|
27 |
15818 | 28 #include <gnt.h> |
29 #include <gntbox.h> | |
30 #include <gntbutton.h> | |
31 #include <gntcheckbox.h> | |
32 #include <gntcombobox.h> | |
33 #include <gntentry.h> | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
34 #include <gntfilesel.h> |
15818 | 35 #include <gntlabel.h> |
36 #include <gntline.h> | |
37 #include <gnttree.h> | |
38 | |
15823 | 39 #include "finch.h" |
15818 | 40 #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
|
41 #include "debug.h" |
16164
87019c619be0
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15939
diff
changeset
|
42 #include "util.h" |
15818 | 43 |
25330
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25329
diff
changeset
|
44 /* XXX: Until gobjectification ... */ |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25329
diff
changeset
|
45 #undef FINCH_GET_DATA |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25329
diff
changeset
|
46 #undef FINCH_SET_DATA |
54a1c63873b2
Do the struct hiding differently.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25329
diff
changeset
|
47 #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:
25329
diff
changeset
|
48 #define FINCH_SET_DATA(obj, data) purple_request_field_set_ui_data(obj, data) |
15818 | 49 |
50 typedef struct | |
51 { | |
52 void *user_data; | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
53 GntWidget *dialog; |
15818 | 54 GCallback *cbs; |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
55 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
|
56 } FinchFileRequest; |
15818 | 57 |
58 static GntWidget * | |
59 setup_request_window(const char *title, const char *primary, | |
15823 | 60 const char *secondary, PurpleRequestType type) |
15818 | 61 { |
62 GntWidget *window; | |
63 | |
64 window = gnt_vbox_new(FALSE); | |
65 gnt_box_set_toplevel(GNT_BOX(window), TRUE); | |
66 gnt_box_set_title(GNT_BOX(window), title); | |
67 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); | |
68 | |
69 if (primary) | |
70 gnt_box_add_widget(GNT_BOX(window), | |
71 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); | |
72 if (secondary) | |
73 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); | |
74 | |
15823 | 75 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(purple_request_close), |
15818 | 76 GINT_TO_POINTER(type)); |
77 | |
78 return window; | |
79 } | |
80 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
81 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
82 * 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
|
83 * 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
|
84 */ |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
85 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
86 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
|
87 { |
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
|
88 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
|
89 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
|
90 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
|
91 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
|
92 } |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
93 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
94 static void |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
95 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
|
96 { |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
97 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
|
98 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
|
99 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
|
100 NULL); |
18333
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 |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
103 /** |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
104 * 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
|
105 * 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
|
106 * cb: the callback |
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
107 * 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
|
108 * (text, primary-callback) pairs, ended by a NULL |
22823
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
109 * |
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
110 * 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
|
111 */ |
15818 | 112 static GntWidget * |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
113 setup_button_box(GntWidget *win, gpointer userdata, gpointer cb, gpointer data, ...) |
15818 | 114 { |
22827
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22823
diff
changeset
|
115 GntWidget *box; |
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22823
diff
changeset
|
116 GntWidget *button = NULL; |
15818 | 117 va_list list; |
118 const char *text; | |
119 gpointer callback; | |
120 | |
121 box = gnt_hbox_new(FALSE); | |
122 | |
123 va_start(list, data); | |
124 | |
125 while ((text = va_arg(list, const char *))) | |
126 { | |
127 callback = va_arg(list, gpointer); | |
128 button = gnt_button_new(text); | |
129 gnt_box_add_widget(GNT_BOX(box), button); | |
130 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
131 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
|
132 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(action_performed), win); |
15818 | 133 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
134 } | |
135 | |
22827
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22823
diff
changeset
|
136 if (button) |
5c9d9df219af
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@wiktel.com>
parents:
22823
diff
changeset
|
137 g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); |
22823
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
138 |
15818 | 139 va_end(list); |
140 return box; | |
141 } | |
142 | |
143 static void | |
144 notify_input_cb(GntWidget *button, GntWidget *entry) | |
145 { | |
15823 | 146 PurpleRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 147 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
148 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); | |
149 | |
150 if (callback) | |
151 callback(data, text); | |
152 | |
153 while (button->parent) | |
154 button = button->parent; | |
155 | |
15823 | 156 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15818 | 157 } |
158 | |
159 static void * | |
160 finch_request_input(const char *title, const char *primary, | |
161 const char *secondary, const char *default_value, | |
162 gboolean multiline, gboolean masked, gchar *hint, | |
163 const char *ok_text, GCallback ok_cb, | |
164 const char *cancel_text, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
165 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 166 void *user_data) |
167 { | |
168 GntWidget *window, *box, *entry; | |
169 | |
15823 | 170 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
15818 | 171 |
172 entry = gnt_entry_new(default_value); | |
173 if (masked) | |
174 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); | |
175 gnt_box_add_widget(GNT_BOX(window), entry); | |
176 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
177 box = setup_button_box(window, user_data, notify_input_cb, entry, |
15818 | 178 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
179 gnt_box_add_widget(GNT_BOX(window), box); | |
180 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
181 setup_default_callback(window, cancel_cb, user_data); |
15818 | 182 gnt_widget_show(window); |
183 | |
184 return window; | |
185 } | |
186 | |
187 static void | |
15823 | 188 finch_close_request(PurpleRequestType type, gpointer ui_handle) |
15818 | 189 { |
190 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
|
191 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
|
192 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
|
193 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
|
194 } |
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
|
195 |
15818 | 196 while (widget->parent) |
197 widget = widget->parent; | |
198 gnt_widget_destroy(widget); | |
199 } | |
200 | |
201 static void | |
202 request_choice_cb(GntWidget *button, GntComboBox *combo) | |
203 { | |
15823 | 204 PurpleRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 205 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
206 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; | |
207 | |
208 if (callback) | |
209 callback(data, choice); | |
210 | |
211 while (button->parent) | |
212 button = button->parent; | |
213 | |
15823 | 214 purple_request_close(PURPLE_REQUEST_INPUT, button); |
15818 | 215 } |
216 | |
217 static void * | |
218 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
|
219 const char *secondary, int default_value, |
15818 | 220 const char *ok_text, GCallback ok_cb, |
221 const char *cancel_text, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
222 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 223 void *user_data, va_list choices) |
224 { | |
225 GntWidget *window, *combo, *box; | |
226 const char *text; | |
227 int val; | |
228 | |
15823 | 229 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
15818 | 230 |
231 combo = gnt_combo_box_new(); | |
232 gnt_box_add_widget(GNT_BOX(window), combo); | |
233 while ((text = va_arg(choices, const char *))) | |
234 { | |
235 val = va_arg(choices, int); | |
236 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); | |
237 } | |
238 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); | |
239 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
240 box = setup_button_box(window, user_data, request_choice_cb, combo, |
15818 | 241 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
242 gnt_box_add_widget(GNT_BOX(window), box); | |
243 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
244 setup_default_callback(window, cancel_cb, user_data); |
15818 | 245 gnt_widget_show(window); |
246 | |
247 return window; | |
248 } | |
249 | |
250 static void | |
251 request_action_cb(GntWidget *button, GntWidget *window) | |
252 { | |
15823 | 253 PurpleRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 254 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
255 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); | |
256 | |
257 if (callback) | |
258 callback(data, id); | |
259 | |
15823 | 260 purple_request_close(PURPLE_REQUEST_ACTION, window); |
15818 | 261 } |
262 | |
263 static void* | |
264 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
|
265 const char *secondary, int default_value, |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
266 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 267 void *user_data, size_t actioncount, |
268 va_list actions) | |
269 { | |
22096
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
270 GntWidget *window, *box, *button, *focus = NULL; |
15818 | 271 int i; |
272 | |
15823 | 273 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
15818 | 274 |
275 box = gnt_hbox_new(FALSE); | |
276 gnt_box_add_widget(GNT_BOX(window), box); | |
277 for (i = 0; i < actioncount; i++) | |
278 { | |
279 const char *text = va_arg(actions, const char *); | |
15823 | 280 PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
15818 | 281 |
282 button = gnt_button_new(text); | |
283 gnt_box_add_widget(GNT_BOX(box), button); | |
284 | |
285 g_object_set_data(G_OBJECT(button), "activate-callback", callback); | |
286 g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); | |
287 g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); | |
288 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
|
289 |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
290 if (i == default_value) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
291 focus = button; |
15818 | 292 } |
293 | |
294 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
|
295 if (focus) |
6ab421173406
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22005
diff
changeset
|
296 gnt_box_give_focus_to_child(GNT_BOX(window), focus); |
15818 | 297 |
298 return window; | |
299 } | |
300 | |
301 static void | |
15823 | 302 request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
15818 | 303 { |
15823 | 304 PurpleRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
15818 | 305 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
306 GList *list; | |
307 | |
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
|
308 /* Update the data of the fields. Pidgin does this differently. Instead of |
15818 | 309 * updating the fields at the end like here, it updates the appropriate field |
310 * instantly whenever a change is made. That allows it to make sure the | |
311 * 'required' fields are entered before the user can hit OK. It's not the case | |
22765
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
312 * here, althought it can be done. */ |
15823 | 313 for (list = purple_request_fields_get_groups(fields); list; list = list->next) |
15818 | 314 { |
15823 | 315 PurpleRequestFieldGroup *group = list->data; |
316 GList *fields = purple_request_field_group_get_fields(group); | |
22823
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
317 |
15818 | 318 for (; fields ; fields = fields->next) |
319 { | |
15823 | 320 PurpleRequestField *field = fields->data; |
321 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
27626
710cbace0076
Do not show hidden request fields.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26429
diff
changeset
|
322 if (!purple_request_field_is_visible(field)) |
710cbace0076
Do not show hidden request fields.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26429
diff
changeset
|
323 continue; |
15823 | 324 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15818 | 325 { |
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
|
326 GntWidget *check = FINCH_GET_DATA(field); |
15818 | 327 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
15823 | 328 purple_request_field_bool_set_value(field, value); |
15818 | 329 } |
15823 | 330 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15818 | 331 { |
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
|
332 GntWidget *entry = FINCH_GET_DATA(field); |
15818 | 333 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
15823 | 334 purple_request_field_string_set_value(field, (text && *text) ? text : NULL); |
15818 | 335 } |
15823 | 336 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15818 | 337 { |
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
|
338 GntWidget *entry = FINCH_GET_DATA(field); |
15818 | 339 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
340 int value = (text && *text) ? atoi(text) : 0; | |
15823 | 341 purple_request_field_int_set_value(field, value); |
15818 | 342 } |
15823 | 343 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15818 | 344 { |
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
|
345 GntWidget *combo = FINCH_GET_DATA(field); |
15818 | 346 int id; |
347 id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); | |
15823 | 348 purple_request_field_choice_set_value(field, id); |
15818 | 349 } |
15823 | 350 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15818 | 351 { |
30669
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
352 GList *list = NULL, *iter; |
15823 | 353 if (purple_request_field_list_get_multi_select(field)) |
15818 | 354 { |
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
|
355 GntWidget *tree = FINCH_GET_DATA(field); |
15818 | 356 |
15823 | 357 iter = purple_request_field_list_get_items(field); |
15818 | 358 for (; iter; iter = iter->next) |
359 { | |
360 const char *text = iter->data; | |
15823 | 361 gpointer key = purple_request_field_list_get_data(field, text); |
15818 | 362 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
30669
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
363 list = g_list_prepend(list, (gpointer)text); |
15818 | 364 } |
365 } | |
366 else | |
367 { | |
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
|
368 GntWidget *combo = FINCH_GET_DATA(field); |
15818 | 369 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
30669
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
370 |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
371 iter = purple_request_field_list_get_items(field); |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
372 for (; iter; iter = iter->next) { |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
373 const char *text = iter->data; |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
374 gpointer key = purple_request_field_list_get_data(field, text); |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
375 if (key == data) { |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
376 list = g_list_prepend(list, (gpointer)text); |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
377 break; |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
378 } |
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
379 } |
15818 | 380 } |
381 | |
15823 | 382 purple_request_field_list_set_selected(field, list); |
15818 | 383 g_list_free(list); |
384 } | |
15823 | 385 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15818 | 386 { |
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
|
387 GntWidget *combo = FINCH_GET_DATA(field); |
15823 | 388 PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
389 purple_request_field_account_set_value(field, acc); | |
15818 | 390 } |
391 } | |
392 } | |
393 | |
22765
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
394 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
|
395 |
22823
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
396 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:
22765
diff
changeset
|
397 !purple_request_fields_all_required_filled(fields)) { |
22765
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
398 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
|
399 _("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
|
400 _("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
|
401 return; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
402 } |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
403 |
15818 | 404 if (callback) |
405 callback(data, fields); | |
406 | |
407 while (button->parent) | |
408 button = button->parent; | |
409 | |
15823 | 410 purple_request_close(PURPLE_REQUEST_FIELDS, button); |
15818 | 411 } |
412 | |
19937
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
413 static void |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
414 update_selected_account(GntEntry *username, const char *start, const char *end, |
19937
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
415 GntComboBox *accountlist) |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
416 { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
417 GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown)); |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
418 const char *name = gnt_entry_get_text(username); |
19937
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
419 while (accounts) { |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
420 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:
19680
diff
changeset
|
421 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:
19680
diff
changeset
|
422 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:
19680
diff
changeset
|
423 break; |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
424 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
425 accounts = accounts->next; |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
426 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
427 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
428 |
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 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
|
430 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
|
431 { |
ae08b1e3ef63
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 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
|
433 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
|
434 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
|
435 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
|
436 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
|
437 } |
ae08b1e3ef63
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 |
ae08b1e3ef63
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 static GntWidget* |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
440 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
|
441 { |
ae08b1e3ef63
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 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
|
443 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
|
444 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
|
445 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
|
446 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
|
447 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
|
448 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
|
449 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
|
450 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
|
451 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
|
452 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
|
453 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
|
454 } |
ae08b1e3ef63
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 gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
456 if (username) |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
457 *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
|
458 } 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
|
459 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
|
460 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
|
461 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
|
462 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
|
463 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
|
464 } |
ae08b1e3ef63
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 } |
ae08b1e3ef63
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 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
|
467 } |
ae08b1e3ef63
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 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
|
470 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
|
471 { |
ae08b1e3ef63
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 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
|
473 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
|
474 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
|
475 |
ae08b1e3ef63
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 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
|
477 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
|
478 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
|
479 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
|
480 } |
ae08b1e3ef63
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 |
ae08b1e3ef63
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 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
|
483 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
|
484 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
485 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
|
486 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
|
487 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
|
488 |
ae08b1e3ef63
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 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
|
490 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
|
491 { |
ae08b1e3ef63
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 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
|
493 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
|
494 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
495 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
|
496 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
|
497 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
|
498 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
499 |
ae08b1e3ef63
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 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
|
501 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
|
502 { |
ae08b1e3ef63
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 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
|
504 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
|
505 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
|
506 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
|
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 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
|
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 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
|
511 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
|
512 { |
ae08b1e3ef63
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 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
|
514 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
|
515 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
|
516 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
|
517 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
|
518 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
|
519 } |
ae08b1e3ef63
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 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
|
521 } |
ae08b1e3ef63
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 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
|
523 { |
ae08b1e3ef63
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 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
|
525 |
ae08b1e3ef63
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 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
|
527 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
|
528 { |
ae08b1e3ef63
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 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
|
530 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
|
531 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
|
532 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
|
533 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
|
534 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
535 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
|
536 } |
ae08b1e3ef63
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 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
|
538 } |
ae08b1e3ef63
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 |
ae08b1e3ef63
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 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
|
541 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
|
542 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
543 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
|
544 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
|
545 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
|
546 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
|
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 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
|
549 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
|
550 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
|
551 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
|
552 |
ae08b1e3ef63
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 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
|
554 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
|
555 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
|
556 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
|
557 |
ae08b1e3ef63
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 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
|
559 { |
ae08b1e3ef63
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 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
|
561 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
|
562 |
ae08b1e3ef63
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 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
|
564 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
|
565 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
|
566 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
|
567 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
568 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
|
569 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
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
576 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
|
577 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
|
578 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
579 |
15818 | 580 static void * |
581 finch_request_fields(const char *title, const char *primary, | |
15823 | 582 const char *secondary, PurpleRequestFields *allfields, |
15818 | 583 const char *ok, GCallback ok_cb, |
584 const char *cancel, GCallback cancel_cb, | |
16442
08db93bbd798
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evan.s@dreskin.net>
parents:
16310
diff
changeset
|
585 PurpleAccount *account, const char *who, PurpleConversation *conv, |
15818 | 586 void *userdata) |
587 { | |
588 GntWidget *window, *box; | |
589 GList *grlist; | |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
590 GntWidget *username = NULL, *accountlist = NULL; |
15818 | 591 |
15823 | 592 window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_FIELDS); |
15818 | 593 |
594 /* This is how it's going to work: the request-groups are going to be | |
595 * stacked vertically one after the other. A GntLine will be separating | |
596 * the groups. */ | |
597 box = gnt_vbox_new(FALSE); | |
598 gnt_box_set_pad(GNT_BOX(box), 0); | |
599 gnt_box_set_fill(GNT_BOX(box), TRUE); | |
15823 | 600 for (grlist = purple_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
15818 | 601 { |
15823 | 602 PurpleRequestFieldGroup *group = grlist->data; |
603 GList *fields = purple_request_field_group_get_fields(group); | |
15818 | 604 GntWidget *hbox; |
15823 | 605 const char *title = purple_request_field_group_get_title(group); |
15818 | 606 |
607 if (title) | |
608 gnt_box_add_widget(GNT_BOX(box), | |
609 gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); | |
610 | |
611 for (; fields ; fields = fields->next) | |
612 { | |
15823 | 613 PurpleRequestField *field = fields->data; |
614 PurpleRequestFieldType type = purple_request_field_get_type(field); | |
615 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
|
616 |
27626
710cbace0076
Do not show hidden request fields.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26429
diff
changeset
|
617 if (!purple_request_field_is_visible(field)) |
710cbace0076
Do not show hidden request fields.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26429
diff
changeset
|
618 continue; |
710cbace0076
Do not show hidden request fields.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
26429
diff
changeset
|
619 |
15818 | 620 hbox = gnt_hbox_new(TRUE); /* hrm */ |
621 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
|
622 |
15823 | 623 if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
15818 | 624 { |
22765
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
625 GntWidget *l; |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
626 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
|
627 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
|
628 else |
4457e6a99d13
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22220
diff
changeset
|
629 l = gnt_label_new(label); |
15818 | 630 gnt_widget_set_size(l, 0, 1); |
631 gnt_box_add_widget(GNT_BOX(hbox), l); | |
632 } | |
633 | |
15823 | 634 if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
15818 | 635 { |
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
|
636 FINCH_SET_DATA(field, create_boolean_field(field)); |
15818 | 637 } |
15823 | 638 else if (type == PURPLE_REQUEST_FIELD_STRING) |
15818 | 639 { |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
640 FINCH_SET_DATA(field, create_string_field(field, &username)); |
15818 | 641 } |
15823 | 642 else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
15818 | 643 { |
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
|
644 FINCH_SET_DATA(field, create_integer_field(field)); |
15818 | 645 } |
15823 | 646 else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
15818 | 647 { |
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
|
648 FINCH_SET_DATA(field, create_choice_field(field)); |
15818 | 649 } |
15823 | 650 else if (type == PURPLE_REQUEST_FIELD_LIST) |
15818 | 651 { |
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
|
652 FINCH_SET_DATA(field, create_list_field(field)); |
15818 | 653 } |
15823 | 654 else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
15818 | 655 { |
25328
5d681e194fb3
Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@wiktel.com>
parents:
22827
diff
changeset
|
656 accountlist = create_account_field(field); |
25329
c039a6e448d7
Revert the last 'struct-hiding' change.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
25328
diff
changeset
|
657 FINCH_SET_DATA(field, accountlist); |
15818 | 658 } |
659 else | |
660 { | |
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
|
661 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
|
662 GNT_TEXT_FLAG_BOLD)); |
15818 | 663 } |
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
|
664 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
|
665 gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(FINCH_GET_DATA(field))); |
15818 | 666 } |
667 if (grlist->next) | |
668 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); | |
669 } | |
670 gnt_box_add_widget(GNT_BOX(window), box); | |
671 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
672 box = setup_button_box(window, userdata, request_fields_cb, allfields, |
15818 | 673 ok, ok_cb, cancel, cancel_cb, NULL); |
674 gnt_box_add_widget(GNT_BOX(window), box); | |
675 | |
18333
f23a7736586f
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18222
diff
changeset
|
676 setup_default_callback(window, cancel_cb, userdata); |
15818 | 677 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
|
678 |
25416
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
679 if (username && accountlist) { |
6e1967b0f90b
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents:
25330
diff
changeset
|
680 g_signal_connect(username, "completion", G_CALLBACK(update_selected_account), accountlist); |
19937
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
681 } |
8c356223e182
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19680
diff
changeset
|
682 |
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
|
683 g_object_set_data(G_OBJECT(window), "fields", allfields); |
22823
750813c2db46
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
22765
diff
changeset
|
684 |
15818 | 685 return window; |
686 } | |
687 | |
688 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
689 file_cancel_cb(gpointer fq, GntWidget *wid) |
15818 | 690 { |
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
|
691 FinchFileRequest *data = fq; |
15818 | 692 if (data->cbs[1] != NULL) |
15823 | 693 ((PurpleRequestFileCb)data->cbs[1])(data->user_data, NULL); |
15818 | 694 |
15823 | 695 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15818 | 696 } |
697 | |
698 static void | |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
699 file_ok_cb(gpointer fq, GntWidget *widget) |
15818 | 700 { |
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 FinchFileRequest *data = fq; |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
702 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
|
703 char *dir = g_path_get_dirname(file); |
15818 | 704 if (data->cbs[0] != NULL) |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
705 ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
706 g_free(file); |
18410
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
707 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
|
708 "/finch/filelocations/last_open_folder", dir); |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
709 g_free(dir); |
15818 | 710 |
15823 | 711 purple_request_close(PURPLE_REQUEST_FILE, data->dialog); |
15818 | 712 } |
713 | |
714 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
|
715 file_request_destroy(FinchFileRequest *data) |
15818 | 716 { |
717 g_free(data->cbs); | |
718 g_free(data); | |
719 } | |
720 | |
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 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
|
722 finch_file_request_window(const char *title, const char *path, |
15818 | 723 GCallback ok_cb, GCallback cancel_cb, |
724 void *user_data) | |
725 { | |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
726 GntWidget *window = gnt_file_sel_new(); |
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
727 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
|
728 FinchFileRequest *data = g_new0(FinchFileRequest, 1); |
15818 | 729 |
730 data->user_data = user_data; | |
731 data->cbs = g_new0(GCallback, 2); | |
732 data->cbs[0] = ok_cb; | |
733 data->cbs[1] = cancel_cb; | |
734 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
|
735 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
|
736 |
719f73b9a593
Remember the open/save file locations.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18347
diff
changeset
|
737 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
|
738 |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
739 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
|
740 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
|
741 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
|
742 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
|
743 g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate", |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
744 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
|
745 g_signal_connect_swapped(G_OBJECT(sel->select), "activate", |
15930
846a00760176
use file select dialog
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
15926
diff
changeset
|
746 G_CALLBACK(file_ok_cb), data); |
15818 | 747 |
18411
3849776d0f71
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18410
diff
changeset
|
748 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
|
749 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
|
750 (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
|
751 |
ae08b1e3ef63
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 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
|
753 } |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
754 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
755 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
|
756 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
|
757 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
|
758 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
|
759 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
|
760 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
|
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 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
|
763 const char *path; |
15818 | 764 |
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
|
765 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
|
766 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
|
767 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
|
768 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
|
769 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
|
770 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
|
771 |
ae08b1e3ef63
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_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
|
773 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
|
774 } |
ae08b1e3ef63
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 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
776 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
|
777 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
|
778 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
|
779 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
|
780 { |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
781 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
|
782 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
783 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
|
784 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
|
785 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
|
786 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
|
787 |
ae08b1e3ef63
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21099
diff
changeset
|
788 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
|
789 return data->dialog; |
15818 | 790 } |
791 | |
15823 | 792 static PurpleRequestUiOps uiops = |
15818 | 793 { |
17104
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
794 finch_request_input, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
795 finch_request_choice, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
796 finch_request_action, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
797 finch_request_fields, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
798 finch_request_file, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
799 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
|
800 finch_request_folder, |
17104
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
801 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
802 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
803 NULL, |
46f2f86e08e4
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@wiktel.com>
parents:
16938
diff
changeset
|
804 NULL |
15818 | 805 }; |
806 | |
15823 | 807 PurpleRequestUiOps *finch_request_get_ui_ops() |
15818 | 808 { |
809 return &uiops; | |
810 } | |
811 | |
812 void finch_request_init() | |
813 { | |
814 } | |
815 | |
816 void finch_request_uninit() | |
817 { | |
818 } | |
819 | |
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
|
820 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
|
821 { |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
822 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
|
823 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
|
824 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
|
825 GList *fields = purple_request_field_group_get_fields(group); |
30669
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
826 |
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
|
827 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
|
828 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
|
829 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
|
830 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
|
831 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
|
832 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
|
833 |
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 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
|
835 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
|
836 val = purple_request_field_list_get_selected(field)->data; |
30669
b258ffa87424
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
29220
diff
changeset
|
837 val = purple_request_field_list_get_data(field, 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
|
838 break; |
8c89913276b3
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
16194
diff
changeset
|
839 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
|
840 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
|
841 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
|
842 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
|
843 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
|
844 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
|
845 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
|
846 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
|
847 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
|
848 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
|
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 } |
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 |
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 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
|
853 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
|
854 case PURPLE_PREF_INT: |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
855 { |
18222
ef65d43190e5
Fix a few runtime warnings.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18118
diff
changeset
|
856 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
|
857 if (type == PURPLE_REQUEST_FIELD_LIST) /* Lists always return string */ |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
858 sscanf(val, "%ld", &tmp); |
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
859 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
|
860 break; |
17472
a236c67e39b6
A change from o_sukhodolsky:
Richard Laager <rlaager@wiktel.com>
parents:
17104
diff
changeset
|
861 } |
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
|
862 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
|
863 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
|
864 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
|
865 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
|
866 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
|
867 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
|
868 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
|
869 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
|
870 } |
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
|
871 } |
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
|
872 } |
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
|
873 } |
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
|
874 |
22005
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
875 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
|
876 { |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
877 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
|
878 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
|
879 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
|
880 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
|
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 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
|
883 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
|
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 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
|
886 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
|
887 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
888 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
|
889 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
|
890 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
891 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
|
892 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
|
893 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
894 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
|
895 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
|
896 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
897 default: |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
898 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
|
899 break; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
900 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
901 return ret; |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
902 } |
829d054f4f1a
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
21893
diff
changeset
|
903 |