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