Wed, 12 Sep 2007 19:11:38 +0000
propagate from branch 'im.pidgin.pidgin' (head 447ebf410d618d48003894dc348f9f0e1616e1e7)
to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head 3f641641f3d6a62f9e576bca75c065e619a97a29)
|
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 |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
4 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15908
diff
changeset
|
5 | * finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
6 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15908
diff
changeset
|
7 | * 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
|
8 | * 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
|
9 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
10 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
11 | * 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
|
12 | * 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
|
13 | * 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
|
14 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
15 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
16 | * 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
|
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
19 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
20 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
21 | * 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
|
22 | * 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
|
23 | * 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
|
24 | */ |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | #include <gnt.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
26 | #include <gntbox.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | #include <gntbutton.h> |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
28 | #include <gntcheckbox.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
29 | #include <gntcombobox.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | #include <gntentry.h> |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
31 | #include <gntfilesel.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
32 | #include <gntlabel.h> |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
33 | #include <gntline.h> |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
34 | #include <gnttree.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | |
| 15884 | 36 | #include "finch.h" |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
37 | #include "gntrequest.h" |
|
16223
411e130ef324
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16000
diff
changeset
|
38 | #include "util.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
|
39 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
40 | 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
|
41 | { |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
42 | void *user_data; |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
43 | 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
|
44 | GCallback *cbs; |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
45 | gboolean save; |
| 15884 | 46 | } PurpleGntFileRequest; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
48 | static GntWidget * |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
49 | setup_request_window(const char *title, const char *primary, |
| 15884 | 50 | const char *secondary, PurpleRequestType type) |
|
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 | GntWidget *window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
53 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
54 | window = gnt_vbox_new(FALSE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
55 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | gnt_box_set_title(GNT_BOX(window), title); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
57 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
58 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
59 | if (primary) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | gnt_box_add_widget(GNT_BOX(window), |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | if (secondary) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
64 | |
| 15884 | 65 | 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
|
66 | GINT_TO_POINTER(type)); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
67 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
70 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
71 | /** |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
72 | * 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
|
73 | * 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
|
74 | */ |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
75 | static void |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
76 | 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
|
77 | { |
|
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
|
78 | 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
|
79 | 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
|
80 | } |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
81 | |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
82 | static void |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
83 | 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
|
84 | { |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
85 | 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
|
86 | 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
|
87 | 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
|
88 | NULL); |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
89 | } |
|
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 | /** |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
92 | * 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
|
93 | * 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
|
94 | * cb: the callback |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
95 | * 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
|
96 | * (text, primary-callback) pairs, ended by a NULL |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
97 | */ |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
98 | static GntWidget * |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
99 | 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
|
100 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
101 | GntWidget *box, *button; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
102 | va_list list; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
103 | const char *text; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
104 | gpointer callback; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
105 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
106 | box = gnt_hbox_new(FALSE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
107 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
108 | va_start(list, data); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
109 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
110 | while ((text = va_arg(list, const char *))) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
111 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
112 | callback = va_arg(list, gpointer); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
113 | button = gnt_button_new(text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
114 | gnt_box_add_widget(GNT_BOX(box), button); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
115 | g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
116 | 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
|
117 | 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
|
118 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
119 | } |
|
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 | va_end(list); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
122 | return box; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
123 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
124 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
125 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
126 | notify_input_cb(GntWidget *button, GntWidget *entry) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
127 | { |
| 15884 | 128 | 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
|
129 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
130 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
131 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
132 | if (callback) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
133 | callback(data, text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
134 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
135 | while (button->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
136 | button = button->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
137 | |
| 15884 | 138 | purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
139 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
140 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
141 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
142 | finch_request_input(const char *title, const char *primary, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
143 | const char *secondary, const char *default_value, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
144 | gboolean multiline, gboolean masked, gchar *hint, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | const char *ok_text, GCallback ok_cb, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
146 | 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
|
147 | PurpleAccount *account, const char *who, PurpleConversation *conv, |
|
19473
396080fb6f06
Updated signatures in gntrequest.c - dunno how to implement transience
Gabriel Schulhof <nix@go-nix.ca>
parents:
18562
diff
changeset
|
148 | const char *ui_hint, void *user_data) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
150 | GntWidget *window, *box, *entry; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
151 | |
| 15884 | 152 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | entry = gnt_entry_new(default_value); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
155 | if (masked) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
157 | gnt_box_add_widget(GNT_BOX(window), entry); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
158 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
159 | 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
|
160 | ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
161 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
163 | setup_default_callback(window, cancel_cb, user_data); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | gnt_widget_show(window); |
|
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 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
167 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
168 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | static void |
| 15884 | 170 | finch_close_request(PurpleRequestType type, gpointer ui_handle) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
171 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | 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
|
173 | 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
|
174 | 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
|
175 | 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
|
176 | } |
|
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
|
177 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
178 | while (widget->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
179 | widget = widget->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
180 | gnt_widget_destroy(widget); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
181 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
182 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
183 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
184 | request_choice_cb(GntWidget *button, GntComboBox *combo) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
185 | { |
| 15884 | 186 | 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
|
187 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
188 | 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
|
189 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
190 | if (callback) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
191 | callback(data, choice); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
193 | while (button->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
194 | button = button->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
195 | |
| 15884 | 196 | purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
197 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
198 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
199 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
200 | 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
|
201 | const char *secondary, int default_value, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
202 | const char *ok_text, GCallback ok_cb, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | 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
|
204 | PurpleAccount *account, const char *who, PurpleConversation *conv, |
|
19473
396080fb6f06
Updated signatures in gntrequest.c - dunno how to implement transience
Gabriel Schulhof <nix@go-nix.ca>
parents:
18562
diff
changeset
|
205 | const char *ui_hint, void *user_data, va_list choices) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
206 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
207 | GntWidget *window, *combo, *box; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
208 | const char *text; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
209 | int val; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
210 | |
| 15884 | 211 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
212 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | combo = gnt_combo_box_new(); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | gnt_box_add_widget(GNT_BOX(window), combo); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | while ((text = va_arg(choices, const char *))) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
216 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | val = va_arg(choices, int); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
218 | 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
|
219 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | 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
|
221 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
222 | 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
|
223 | ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
224 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
225 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
226 | setup_default_callback(window, cancel_cb, user_data); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
227 | gnt_widget_show(window); |
|
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 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
230 | } |
|
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 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
233 | request_action_cb(GntWidget *button, GntWidget *window) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
234 | { |
| 15884 | 235 | 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
|
236 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
237 | 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
|
238 | |
|
14081
8e302ced7a00
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
239 | if (callback) |
|
8e302ced7a00
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
240 | callback(data, id); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
241 | |
| 15884 | 242 | purple_request_close(PURPLE_REQUEST_ACTION, window); |
|
14045
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 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
245 | static void* |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
246 | 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
|
247 | 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
|
248 | PurpleAccount *account, const char *who, PurpleConversation *conv, |
|
19473
396080fb6f06
Updated signatures in gntrequest.c - dunno how to implement transience
Gabriel Schulhof <nix@go-nix.ca>
parents:
18562
diff
changeset
|
249 | const char *ui_hint, void *user_data, size_t actioncount, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
250 | va_list actions) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
251 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
252 | GntWidget *window, *box, *button; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
253 | int i; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
254 | |
| 15884 | 255 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
256 | |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
257 | box = gnt_hbox_new(FALSE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
258 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
259 | for (i = 0; i < actioncount; i++) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
260 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
261 | const char *text = va_arg(actions, const char *); |
| 15884 | 262 | PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
263 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
264 | button = gnt_button_new(text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
265 | gnt_box_add_widget(GNT_BOX(box), button); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
266 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
267 | g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
268 | g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
269 | 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
|
270 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
271 | } |
|
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 | gnt_widget_show(window); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
274 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
275 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
276 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
277 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
278 | static void |
| 15884 | 279 | request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
280 | { |
| 15884 | 281 | 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
|
282 | 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
|
283 | GList *list; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
284 | |
|
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
|
285 | /* 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
|
286 | * 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
|
287 | * 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
|
288 | * 'required' fields are entered before the user can hit OK. It's not the case |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
289 | * here, althought it can be done. I am not honouring the 'required' fields |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
290 | * for the moment. */ |
| 15884 | 291 | 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
|
292 | { |
| 15884 | 293 | PurpleRequestFieldGroup *group = list->data; |
| 294 | GList *fields = purple_request_field_group_get_fields(group); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
295 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
296 | for (; fields ; fields = fields->next) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
297 | { |
| 15884 | 298 | PurpleRequestField *field = fields->data; |
| 299 | PurpleRequestFieldType type = purple_request_field_get_type(field); | |
| 300 | if (type == PURPLE_REQUEST_FIELD_BOOLEAN) | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
301 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
302 | GntWidget *check = field->ui_data; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
303 | gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
| 15884 | 304 | purple_request_field_bool_set_value(field, value); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
305 | } |
| 15884 | 306 | else if (type == PURPLE_REQUEST_FIELD_STRING) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
307 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
308 | GntWidget *entry = field->ui_data; |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
309 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
| 15884 | 310 | 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
|
311 | } |
| 15884 | 312 | else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
313 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
314 | GntWidget *entry = field->ui_data; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
315 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
316 | int value = (text && *text) ? atoi(text) : 0; |
| 15884 | 317 | purple_request_field_int_set_value(field, value); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
318 | } |
| 15884 | 319 | else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
320 | { |
|
14288
2dda820d3d96
[gaim-migrate @ 16907]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14260
diff
changeset
|
321 | GntWidget *combo = field->ui_data; |
|
14260
a21577fbb4d2
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14126
diff
changeset
|
322 | int id; |
|
a21577fbb4d2
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14126
diff
changeset
|
323 | id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); |
| 15884 | 324 | purple_request_field_choice_set_value(field, id); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
325 | } |
| 15884 | 326 | else if (type == PURPLE_REQUEST_FIELD_LIST) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
327 | { |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
328 | GList *list = NULL; |
| 15884 | 329 | if (purple_request_field_list_get_multi_select(field)) |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
330 | { |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
331 | GList *iter; |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
332 | GntWidget *tree = field->ui_data; |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
333 | |
| 15884 | 334 | iter = purple_request_field_list_get_items(field); |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
335 | for (; iter; iter = iter->next) |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
336 | { |
|
14752
963fd36fc2ae
[gaim-migrate @ 17442]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14620
diff
changeset
|
337 | const char *text = iter->data; |
| 15884 | 338 | 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
|
339 | if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
340 | list = g_list_prepend(list, key); |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
341 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
342 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
343 | else |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
344 | { |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
345 | GntWidget *combo = field->ui_data; |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
346 | 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
|
347 | list = g_list_append(list, data); |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
348 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
349 | |
| 15884 | 350 | purple_request_field_list_set_selected(field, list); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
351 | g_list_free(list); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
352 | } |
| 15884 | 353 | else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
354 | { |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
355 | GntWidget *combo = field->ui_data; |
| 15884 | 356 | PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
| 357 | purple_request_field_account_set_value(field, acc); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
358 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
359 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
360 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
361 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
362 | if (callback) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
363 | callback(data, fields); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
364 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
365 | while (button->parent) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
366 | button = button->parent; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
367 | |
| 15884 | 368 | purple_request_close(PURPLE_REQUEST_FIELDS, button); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
369 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
370 | |
|
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
|
371 | 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
|
372 | 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
|
373 | 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
|
374 | { |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
375 | 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
|
376 | 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
|
377 | 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
|
378 | 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
|
379 | 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
|
380 | 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
|
381 | 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
|
382 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
383 | 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
|
384 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
385 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
386 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
387 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
388 | finch_request_fields(const char *title, const char *primary, |
| 15884 | 389 | const char *secondary, PurpleRequestFields *allfields, |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
390 | const char *ok, GCallback ok_cb, |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
391 | 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
|
392 | PurpleAccount *account, const char *who, PurpleConversation *conv, |
|
19473
396080fb6f06
Updated signatures in gntrequest.c - dunno how to implement transience
Gabriel Schulhof <nix@go-nix.ca>
parents:
18562
diff
changeset
|
393 | const char *ui_hint, void *userdata) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
394 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
395 | GntWidget *window, *box; |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
396 | 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
|
397 | GntWidget *screenname = NULL, *accountlist = NULL; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
398 | |
| 15884 | 399 | 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
|
400 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
401 | /* 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
|
402 | * 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
|
403 | * the groups. */ |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
404 | box = gnt_vbox_new(FALSE); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
405 | gnt_box_set_pad(GNT_BOX(box), 0); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
406 | gnt_box_set_fill(GNT_BOX(box), TRUE); |
| 15884 | 407 | 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
|
408 | { |
| 15884 | 409 | PurpleRequestFieldGroup *group = grlist->data; |
| 410 | GList *fields = purple_request_field_group_get_fields(group); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
411 | GntWidget *hbox; |
| 15884 | 412 | 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
|
413 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
414 | if (title) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
415 | gnt_box_add_widget(GNT_BOX(box), |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
416 | 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
|
417 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
418 | for (; fields ; fields = fields->next) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
419 | { |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
420 | /* XXX: Break each of the fields into a separate function? */ |
| 15884 | 421 | PurpleRequestField *field = fields->data; |
| 422 | PurpleRequestFieldType type = purple_request_field_get_type(field); | |
| 423 | const char *label = purple_request_field_get_label(field); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
424 | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
425 | hbox = gnt_hbox_new(TRUE); /* hrm */ |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
426 | gnt_box_add_widget(GNT_BOX(box), hbox); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
427 | |
| 15884 | 428 | if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
429 | { |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
430 | GntWidget *l = gnt_label_new(label); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
431 | gnt_widget_set_size(l, 0, 1); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
432 | gnt_box_add_widget(GNT_BOX(hbox), l); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
433 | } |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
434 | |
| 15884 | 435 | if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
436 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
437 | GntWidget *check = gnt_check_box_new(label); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
438 | gnt_check_box_set_checked(GNT_CHECK_BOX(check), |
| 15884 | 439 | purple_request_field_bool_get_default_value(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
440 | gnt_box_add_widget(GNT_BOX(hbox), check); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
441 | field->ui_data = check; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
442 | } |
| 15884 | 443 | else if (type == PURPLE_REQUEST_FIELD_STRING) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
444 | { |
| 15895 | 445 | const char *hint = purple_request_field_get_type_hint(field); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
446 | GntWidget *entry = gnt_entry_new( |
| 15884 | 447 | purple_request_field_string_get_default_value(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
448 | gnt_entry_set_masked(GNT_ENTRY(entry), |
| 15884 | 449 | purple_request_field_string_is_masked(field)); |
|
18301
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18190
diff
changeset
|
450 | if (hint && purple_str_has_prefix(hint, "screenname")) { |
| 15895 | 451 | PurpleBlistNode *node = purple_blist_get_root(); |
| 452 | gboolean offline = purple_str_has_suffix(hint, "all"); | |
| 453 | for (; node; node = purple_blist_node_next(node, offline)) { | |
| 454 | if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) | |
|
15888
960ca2f84bb5
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15878
diff
changeset
|
455 | continue; |
| 15895 | 456 | gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node)); |
|
15888
960ca2f84bb5
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15878
diff
changeset
|
457 | } |
|
960ca2f84bb5
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15878
diff
changeset
|
458 | gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
|
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
|
459 | screenname = entry; |
|
15908
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
460 | } else if (hint && !strcmp(hint, "group")) { |
|
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
461 | PurpleBlistNode *node; |
|
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
462 | for (node = purple_blist_get_root(); node; node = node->next) { |
|
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
463 | if (PURPLE_BLIST_NODE_IS_GROUP(node)) |
|
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
464 | gnt_entry_add_suggest(GNT_ENTRY(entry), ((PurpleGroup *)node)->name); |
|
d5b3f76ff418
Group autocomplete for buddy adding
Richard Nelson <wabz@pidgin.im>
parents:
15906
diff
changeset
|
465 | } |
|
15888
960ca2f84bb5
Add auto-complete support in request-entries that have 'screenname' hint set. This can be useful in, for example, 'send im' dialog etc.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15878
diff
changeset
|
466 | } |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
467 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
468 | field->ui_data = entry; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
469 | } |
| 15884 | 470 | else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
471 | { |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14288
diff
changeset
|
472 | char str[256]; |
| 15884 | 473 | int val = purple_request_field_int_get_default_value(field); |
|
14413
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14288
diff
changeset
|
474 | GntWidget *entry; |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14288
diff
changeset
|
475 | |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14288
diff
changeset
|
476 | snprintf(str, sizeof(str), "%d", val); |
|
bd998fe17d82
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14288
diff
changeset
|
477 | entry = gnt_entry_new(str); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
478 | gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
479 | gnt_box_add_widget(GNT_BOX(hbox), entry); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
480 | field->ui_data = entry; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
481 | } |
| 15884 | 482 | else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
483 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
484 | int id; |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
485 | GList *list; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
486 | GntWidget *combo = gnt_combo_box_new(); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
487 | gnt_box_add_widget(GNT_BOX(hbox), combo); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
488 | field->ui_data = combo; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
489 | |
| 15884 | 490 | list = purple_request_field_choice_get_labels(field); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
491 | for (id = 1; list; list = list->next, id++) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
492 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
493 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
494 | GINT_TO_POINTER(id), list->data); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
495 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
496 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
| 15884 | 497 | GINT_TO_POINTER(purple_request_field_choice_get_default_value(field))); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
498 | } |
| 15884 | 499 | else if (type == PURPLE_REQUEST_FIELD_LIST) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
500 | { |
|
18190
bcf28ef7e8ff
Re-fix the DBus list handling code by killing const GList* / const GSList*
Richard Laager <rlaager@pidgin.im>
parents:
18122
diff
changeset
|
501 | GList *list; |
| 15884 | 502 | gboolean multi = purple_request_field_list_get_multi_select(field); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
503 | if (multi) |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
504 | { |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
505 | GntWidget *tree = gnt_tree_new(); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
506 | gnt_box_add_widget(GNT_BOX(hbox), tree); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
507 | field->ui_data = tree; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
508 | |
| 15884 | 509 | list = purple_request_field_list_get_items(field); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
510 | for (; list; list = list->next) |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
511 | { |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
512 | const char *text = list->data; |
| 15884 | 513 | 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
|
514 | gnt_tree_add_choice(GNT_TREE(tree), key, |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
515 | gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
| 15884 | 516 | if (purple_request_field_list_is_selected(field, text)) |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
517 | gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
518 | } |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
519 | } |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
520 | else |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
521 | { |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
522 | GntWidget *combo = gnt_combo_box_new(); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
523 | gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
524 | gnt_box_add_widget(GNT_BOX(hbox), combo); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
525 | field->ui_data = combo; |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
526 | |
| 15884 | 527 | list = purple_request_field_list_get_items(field); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
528 | for (; list; list = list->next) |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
529 | { |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
530 | const char *text = list->data; |
| 15884 | 531 | gpointer key = purple_request_field_list_get_data(field, text); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
532 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
| 15884 | 533 | if (purple_request_field_list_is_selected(field, text)) |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
534 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
535 | } |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
536 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
537 | } |
| 15884 | 538 | else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
539 | { |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
540 | gboolean all; |
| 15884 | 541 | PurpleAccount *def; |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
542 | GList *list; |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
543 | GntWidget *combo = gnt_combo_box_new(); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
544 | gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
545 | gnt_box_add_widget(GNT_BOX(hbox), combo); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
546 | field->ui_data = combo; |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
547 | |
| 15884 | 548 | all = purple_request_field_account_get_show_all(field); |
|
16983
3fd7f8752e5a
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
549 | def = purple_request_field_account_get_value(field); |
|
3fd7f8752e5a
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
550 | if (!def) |
|
3fd7f8752e5a
Select the right account when adding a buddy after authorizing her.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16490
diff
changeset
|
551 | def = purple_request_field_account_get_default_value(field); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
552 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
553 | if (all) |
| 15884 | 554 | list = purple_accounts_get_all(); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
555 | else |
| 15884 | 556 | list = purple_connections_get_all(); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
557 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
558 | for (; list; list = list->next) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
559 | { |
| 15884 | 560 | PurpleAccount *account; |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
561 | char *text; |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
562 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
563 | if (all) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
564 | account = list->data; |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
565 | else |
| 15884 | 566 | account = purple_connection_get_account(list->data); |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
567 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
568 | text = g_strdup_printf("%s (%s)", |
| 15884 | 569 | purple_account_get_username(account), |
| 570 | purple_account_get_protocol_name(account)); | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
571 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
572 | g_free(text); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
573 | if (account == def) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
574 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
575 | } |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
576 | gnt_widget_set_size(combo, 20, 3); /* ew */ |
|
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
|
577 | accountlist = combo; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
578 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
579 | else |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
580 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
581 | gnt_box_add_widget(GNT_BOX(hbox), |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
582 | gnt_label_new_with_format(_("Not implemented yet."), |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
583 | GNT_TEXT_FLAG_BOLD)); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
584 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
585 | } |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
586 | if (grlist->next) |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
587 | 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
|
588 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
589 | gnt_box_add_widget(GNT_BOX(window), box); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
590 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
591 | 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
|
592 | ok, ok_cb, cancel, cancel_cb, NULL); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
593 | gnt_box_add_widget(GNT_BOX(window), box); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
594 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
595 | setup_default_callback(window, cancel_cb, userdata); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
596 | 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
|
597 | |
|
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
|
598 | 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
|
599 | 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
|
600 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
601 | |
|
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
|
602 | g_object_set_data(G_OBJECT(window), "fields", allfields); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
603 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
604 | return window; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
605 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
606 | |
|
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
|
607 | static void |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
608 | 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
|
609 | { |
| 15884 | 610 | PurpleGntFileRequest *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
|
611 | if (data->cbs[1] != NULL) |
| 15884 | 612 | ((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
|
613 | |
| 15884 | 614 | 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
|
615 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
616 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
617 | static void |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
618 | 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
|
619 | { |
| 15884 | 620 | PurpleGntFileRequest *data = fq; |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
621 | 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
|
622 | 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
|
623 | if (data->cbs[0] != NULL) |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
624 | ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
|
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
625 | g_free(file); |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
626 | 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
|
627 | "/finch/filelocations/last_open_folder", dir); |
|
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
628 | 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
|
629 | |
| 15884 | 630 | 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
|
631 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
632 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
633 | static void |
| 15884 | 634 | file_request_destroy(PurpleGntFileRequest *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
|
635 | { |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
636 | 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
|
637 | 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
|
638 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
639 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
640 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
641 | finch_request_file(const char *title, const char *filename, |
|
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
|
642 | gboolean savedialog, |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
643 | GCallback ok_cb, 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
|
644 | PurpleAccount *account, const char *who, PurpleConversation *conv, |
|
19473
396080fb6f06
Updated signatures in gntrequest.c - dunno how to implement transience
Gabriel Schulhof <nix@go-nix.ca>
parents:
18562
diff
changeset
|
645 | const char *ui_hint, void *user_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
|
646 | { |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
647 | GntWidget *window = gnt_file_sel_new(); |
|
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
648 | GntFileSel *sel = GNT_FILE_SEL(window); |
| 15884 | 649 | PurpleGntFileRequest *data = g_new0(PurpleGntFileRequest, 1); |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
650 | 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
|
651 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
652 | 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
|
653 | 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
|
654 | 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
|
655 | 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
|
656 | data->dialog = window; |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
657 | data->save = savedialog; |
|
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
|
658 | gnt_box_set_title(GNT_BOX(window), title ? title : (savedialog ? _("Save File...") : _("Open File..."))); |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
659 | |
|
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
660 | path = purple_prefs_get_path(savedialog ? "/finch/filelocations/last_save_folder" : "/finch/filelocations/last_open_folder"); |
|
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
661 | 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
|
662 | |
| 16000 | 663 | if (savedialog) |
| 664 | gnt_file_sel_set_suggested_filename(sel, filename); | |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
665 | |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
666 | 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
|
667 | 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
|
668 | 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
|
669 | 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
|
670 | 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
|
671 | 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
|
672 | 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
|
673 | 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
|
674 | |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
675 | 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
|
676 | 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
|
677 | (GDestroyNotify)file_request_destroy); |
|
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
|
678 | gnt_widget_show(window); |
|
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 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
680 | return window; |
|
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 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
682 | |
| 15884 | 683 | static PurpleRequestUiOps uiops = |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
684 | { |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
685 | finch_request_input, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
686 | finch_request_choice, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
687 | finch_request_action, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
688 | finch_request_fields, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
689 | finch_request_file, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
690 | finch_close_request, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
691 | NULL, /* No plans for request_folder */ |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
692 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
693 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
694 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
695 | NULL |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
696 | }; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
697 | |
| 15884 | 698 | PurpleRequestUiOps *finch_request_get_ui_ops() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
699 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
700 | return &uiops; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
701 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
702 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
703 | void finch_request_init() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
704 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
705 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
706 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
707 | void finch_request_uninit() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
708 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
709 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
710 | |
|
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
|
711 | 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
|
712 | { |
|
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
|
713 | 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
|
714 | 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
|
715 | 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
|
716 | 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
|
717 | |
|
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
|
718 | 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
|
719 | 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
|
720 | 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
|
721 | 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
|
722 | 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
|
723 | 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
|
724 | |
|
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
|
725 | 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
|
726 | 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
|
727 | 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
|
728 | 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
|
729 | 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
|
730 | 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
|
731 | 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
|
732 | 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
|
733 | 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
|
734 | 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
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | } |
|
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
|
741 | |
|
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
|
742 | 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
|
743 | 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
|
744 | case PURPLE_PREF_INT: |
|
17470
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
745 | { |
|
18301
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18190
diff
changeset
|
746 | 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
|
747 | 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
|
748 | sscanf(val, "%ld", &tmp); |
|
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
749 | 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
|
750 | break; |
|
17470
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
751 | } |
|
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
|
752 | 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
|
753 | 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
|
754 | 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
|
755 | 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
|
756 | 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
|
757 | 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
|
758 | 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
|
759 | 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
|
760 | } |
|
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
|
761 | } |
|
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
|
762 | } |
|
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
|
763 | } |
|
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
|
764 |