Wed, 30 May 2018 15:58:35 -0500
gntrequest: Drop certificate request type
glib-networking >= 2.57.1 uses system certificates by default.
Servers *should* have a proper certificate, and people with
self-signed ones *should* be able to add them to their system.
Being that exceptions to this are extreme edge cases, it *should*
be fine to just use the system certificate store and not worry
about trying to manage certificate trust ourselves. If it turns
out this is needed, we can always add support later, potentially
via a plugin. To that end, this patch drops Finch's certificate
request type.
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19934
diff
changeset
|
1 | /* finch |
|
14620
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
2 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15908
diff
changeset
|
3 | * 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
|
4 | * 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
|
5 | * source distribution. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
6 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
7 | * 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
|
8 | * 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
|
9 | * 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
|
10 | * (at your option) any later version. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
11 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
12 | * This program is distributed in the hope that it will be useful, |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
15 | * GNU General Public License for more details. |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
16 | * |
|
90d599495d65
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14413
diff
changeset
|
17 | * 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
|
18 | * 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
|
19 | * 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
|
20 | */ |
|
29049
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
27829
diff
changeset
|
21 | #include <internal.h> |
|
ea3c1e7d47f4
*** Plucked rev ea18c8ce78c0229a5b968aab268f38e9bcae0aee (8e1d807c1aadfb510e14f047d2cf00e0c06be465):
Daniel Atallah <datallah@pidgin.im>
parents:
27829
diff
changeset
|
22 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
23 | #include <gnt.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
24 | #include <gntbox.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
25 | #include <gntbutton.h> |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
26 | #include <gntcheckbox.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
27 | #include <gntcombobox.h> |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
28 | #include <gntentry.h> |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
29 | #include <gntfilesel.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
30 | #include <gntlabel.h> |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
31 | #include <gntline.h> |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
32 | #include <gnttree.h> |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
33 | |
| 15884 | 34 | #include "finch.h" |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
35 | #include "gntrequest.h" |
|
22135
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
36 | #include "debug.h" |
|
16223
411e130ef324
Include header files, not source files. Bah.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16000
diff
changeset
|
37 | #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
|
38 | |
|
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 | 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
|
40 | { |
|
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 | void *user_data; |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
42 | 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
|
43 | GCallback *cbs; |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
44 | gboolean save; |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
45 | } FinchFileRequest; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
46 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
47 | static GntWidget * |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
48 | setup_request_window(const char *title, const char *primary, |
| 15884 | 49 | const char *secondary, PurpleRequestType type) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
50 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
51 | GntWidget *window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
52 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
53 | window = gnt_vbox_new(FALSE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
54 | gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
55 | gnt_box_set_title(GNT_BOX(window), title); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
56 | gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
57 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
58 | if (primary) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
59 | gnt_box_add_widget(GNT_BOX(window), |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
60 | gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
61 | if (secondary) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
62 | gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
63 | |
| 15884 | 64 | 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
|
65 | GINT_TO_POINTER(type)); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
66 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
67 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
68 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
69 | |
|
35456
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
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 | * 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
|
72 | * 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
|
73 | */ |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
74 | static void |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
75 | 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
|
76 | { |
|
20783
b36dfff92590
Do not connect to a signal with a NULL callback. Gets rid of a runtime warning.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
77 | if (default_cb == NULL) |
|
b36dfff92590
Do not connect to a signal with a NULL callback. Gets rid of a runtime warning.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20147
diff
changeset
|
78 | return; |
|
18402
f84b9b94e0ac
Update search-api to not crash. Searching for users in xmpp/oscar works now.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18392
diff
changeset
|
79 | 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
|
80 | 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
|
81 | } |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
82 | |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
83 | static void |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
84 | 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
|
85 | { |
|
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
86 | 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
|
87 | 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
|
88 | 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
|
89 | NULL); |
|
18392
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 | |
|
35456
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
92 | /* |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
93 | * setup_button_box: |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
94 | * @win: this is the window |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
95 | * @userdata: the userdata to pass to the primary callbacks |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
96 | * @cb: the callback |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
97 | * @data: data for the callback |
|
821aa4bcb6fa
Fix a bunch of gtk-doc warnings in finch
Ankit Vani <a@nevitus.org>
parents:
35454
diff
changeset
|
98 | * @...: (text, primary-callback) pairs, ended by a NULL |
|
22995
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
99 | * |
|
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
100 | * The cancellation callback should be the last callback sent. |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
101 | */ |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
102 | static GntWidget * |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
103 | 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
|
104 | { |
|
23000
29929da38031
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@pidgin.im>
parents:
22995
diff
changeset
|
105 | GntWidget *box; |
|
29929da38031
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@pidgin.im>
parents:
22995
diff
changeset
|
106 | GntWidget *button = NULL; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
107 | va_list list; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
108 | const char *text; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
109 | gpointer callback; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
110 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
111 | box = gnt_hbox_new(FALSE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
112 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
113 | va_start(list, data); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
114 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
115 | while ((text = va_arg(list, const char *))) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
116 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
117 | callback = va_arg(list, gpointer); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
118 | button = gnt_button_new(text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
119 | gnt_box_add_widget(GNT_BOX(box), button); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
120 | g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
121 | 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
|
122 | 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
|
123 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
|
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 | |
|
23000
29929da38031
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@pidgin.im>
parents:
22995
diff
changeset
|
126 | if (button) |
|
29929da38031
Fix a compiler warning. Sadrul or someone should double-check this.
Richard Laager <rlaager@pidgin.im>
parents:
22995
diff
changeset
|
127 | g_object_set_data(G_OBJECT(button), "cancellation-function", GINT_TO_POINTER(TRUE)); |
|
22995
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
128 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
129 | va_end(list); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
130 | return box; |
|
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 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
133 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
134 | notify_input_cb(GntWidget *button, GntWidget *entry) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
135 | { |
| 15884 | 136 | 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
|
137 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
138 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
|
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 | if (callback) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
141 | callback(data, text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
142 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
143 | while (button->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
144 | button = button->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
145 | |
| 15884 | 146 | purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
147 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
148 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
149 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
150 | finch_request_input(const char *title, const char *primary, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
151 | const char *secondary, const char *default_value, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
152 | gboolean multiline, gboolean masked, gchar *hint, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
153 | const char *ok_text, GCallback ok_cb, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
154 | const char *cancel_text, GCallback cancel_cb, |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34306
diff
changeset
|
155 | PurpleRequestCommonParameters *cpar, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
156 | void *user_data) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
157 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
158 | GntWidget *window, *box, *entry; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
159 | |
| 15884 | 160 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_INPUT); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
161 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
162 | entry = gnt_entry_new(default_value); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
163 | if (masked) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
164 | gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
165 | gnt_box_add_widget(GNT_BOX(window), entry); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
166 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
167 | 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
|
168 | ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
169 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
170 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
171 | setup_default_callback(window, cancel_cb, user_data); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
172 | gnt_widget_show(window); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
173 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
174 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
175 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
176 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
177 | static void |
| 15884 | 178 | finch_close_request(PurpleRequestType type, gpointer ui_handle) |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
179 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
180 | 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
|
181 | 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
|
182 | 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
|
183 | 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
|
184 | } |
|
af8d75120347
Implement the plugin-pref ui using the request api. The preferences for the core plugins can now be modified from Finch. And no new strings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16255
diff
changeset
|
185 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
186 | while (widget->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
187 | widget = widget->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
188 | gnt_widget_destroy(widget); |
|
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 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
191 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
192 | request_choice_cb(GntWidget *button, GntComboBox *combo) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
193 | { |
| 15884 | 194 | 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
|
195 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
196 | gpointer choice = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
|
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 | if (callback) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
199 | callback(data, choice); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
200 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
201 | while (button->parent) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
202 | button = button->parent; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
203 | |
| 15884 | 204 | purple_request_close(PURPLE_REQUEST_INPUT, button); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
205 | } |
|
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 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
208 | finch_request_choice(const char *title, const char *primary, |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
209 | const char *secondary, gpointer default_value, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
210 | const char *ok_text, GCallback ok_cb, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
211 | const char *cancel_text, GCallback cancel_cb, |
|
34330
35d5e8fcc07b
Request API refactoring: switch purple_request_choice to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34329
diff
changeset
|
212 | PurpleRequestCommonParameters *cpar, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
213 | void *user_data, va_list choices) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
214 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
215 | GntWidget *window, *combo, *box; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
216 | const char *text; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
217 | int val; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
218 | |
| 15884 | 219 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_CHOICE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
220 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
221 | combo = gnt_combo_box_new(); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
222 | gnt_box_add_widget(GNT_BOX(window), combo); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
223 | while ((text = va_arg(choices, const char *))) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
224 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
225 | val = va_arg(choices, int); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
226 | 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
|
227 | } |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
228 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), default_value); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
229 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
230 | 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
|
231 | ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
232 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
233 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
234 | setup_default_callback(window, cancel_cb, user_data); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
235 | gnt_widget_show(window); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30495
diff
changeset
|
236 | |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
237 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
238 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
239 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
240 | static void |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
241 | request_action_cb(GntWidget *button, GntWidget *window) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
242 | { |
| 15884 | 243 | 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
|
244 | gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
245 | 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
|
246 | |
|
14081
8e302ced7a00
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
247 | if (callback) |
|
8e302ced7a00
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14045
diff
changeset
|
248 | callback(data, id); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
249 | |
| 15884 | 250 | purple_request_close(PURPLE_REQUEST_ACTION, window); |
|
14045
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 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
253 | static void* |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
254 | 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
|
255 | const char *secondary, int default_value, |
|
34331
c8486462bb63
Request API refactoring: switch purple_request_action to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34330
diff
changeset
|
256 | PurpleRequestCommonParameters *cpar, |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
257 | void *user_data, size_t actioncount, |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
258 | va_list actions) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
259 | { |
|
22224
5e1b8818889e
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22135
diff
changeset
|
260 | GntWidget *window, *box, *button, *focus = NULL; |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35991
diff
changeset
|
261 | gsize i; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
262 | |
| 15884 | 263 | window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
264 | |
|
14126
176d35315165
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14125
diff
changeset
|
265 | box = gnt_hbox_new(FALSE); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
266 | gnt_box_add_widget(GNT_BOX(window), box); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
267 | for (i = 0; i < actioncount; i++) |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
268 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
269 | const char *text = va_arg(actions, const char *); |
| 15884 | 270 | PurpleRequestActionCb callback = va_arg(actions, PurpleRequestActionCb); |
|
14045
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 | button = gnt_button_new(text); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
273 | gnt_box_add_widget(GNT_BOX(box), button); |
|
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 | g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
276 | g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
277 | 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
|
278 | g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); |
|
22224
5e1b8818889e
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22135
diff
changeset
|
279 | |
|
36256
a437550a9308
Remove -Wno-sign-compare and backport fixes from default.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
35991
diff
changeset
|
280 | if (default_value >= 0 && i == (gsize)default_value) |
|
22224
5e1b8818889e
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22135
diff
changeset
|
281 | focus = button; |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
282 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
283 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
284 | gnt_widget_show(window); |
|
22224
5e1b8818889e
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22135
diff
changeset
|
285 | if (focus) |
|
5e1b8818889e
Focus the button for the default action, if possible.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22135
diff
changeset
|
286 | gnt_box_give_focus_to_child(GNT_BOX(window), focus); |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
287 | |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
288 | return window; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
289 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
290 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
291 | static void |
| 15884 | 292 | request_fields_cb(GntWidget *button, PurpleRequestFields *fields) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
293 | { |
| 15884 | 294 | 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
|
295 | 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
|
296 | GList *list; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
297 | |
|
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
|
298 | /* 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
|
299 | * 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
|
300 | * 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
|
301 | * 'required' fields are entered before the user can hit OK. It's not the case |
|
22937
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
302 | * here, althought it can be done. */ |
| 15884 | 303 | 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
|
304 | { |
| 15884 | 305 | PurpleRequestFieldGroup *group = list->data; |
| 306 | GList *fields = purple_request_field_group_get_fields(group); | |
|
22995
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
307 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
308 | for (; fields ; fields = fields->next) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
309 | { |
| 15884 | 310 | PurpleRequestField *field = fields->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
311 | PurpleRequestFieldType type = purple_request_field_get_field_type(field); |
|
27803
d56c80617fc7
Do not show hidden request fields.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26477
diff
changeset
|
312 | if (!purple_request_field_is_visible(field)) |
|
d56c80617fc7
Do not show hidden request fields.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26477
diff
changeset
|
313 | continue; |
| 15884 | 314 | if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
315 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
316 | GntWidget *check = purple_request_field_get_ui_data(field); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
317 | gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
| 15884 | 318 | purple_request_field_bool_set_value(field, value); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
319 | } |
| 15884 | 320 | else if (type == PURPLE_REQUEST_FIELD_STRING) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
321 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
322 | GntWidget *entry = purple_request_field_get_ui_data(field); |
|
14125
2a14281b124b
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14124
diff
changeset
|
323 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
| 15884 | 324 | 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
|
325 | } |
| 15884 | 326 | else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
327 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
328 | GntWidget *entry = purple_request_field_get_ui_data(field); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
329 | const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
330 | int value = (text && *text) ? atoi(text) : 0; |
| 15884 | 331 | purple_request_field_int_set_value(field, value); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
332 | } |
| 15884 | 333 | else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
334 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
335 | GntWidget *combo = purple_request_field_get_ui_data(field); |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
336 | gpointer value = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
337 | purple_request_field_choice_set_value(field, value); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
338 | } |
| 15884 | 339 | else if (type == PURPLE_REQUEST_FIELD_LIST) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
340 | { |
|
30495
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
341 | GList *list = NULL, *iter; |
| 15884 | 342 | if (purple_request_field_list_get_multi_select(field)) |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
343 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
344 | GntWidget *tree = purple_request_field_get_ui_data(field); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
345 | |
| 15884 | 346 | iter = purple_request_field_list_get_items(field); |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
347 | for (; iter; iter = iter->next) |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
348 | { |
|
14752
963fd36fc2ae
[gaim-migrate @ 17442]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
14620
diff
changeset
|
349 | const char *text = iter->data; |
| 15884 | 350 | 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
|
351 | if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
|
30495
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
352 | list = g_list_prepend(list, (gpointer)text); |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
353 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
354 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
355 | else |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
356 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
357 | GntWidget *combo = purple_request_field_get_ui_data(field); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
358 | gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
|
30495
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
359 | |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
360 | iter = purple_request_field_list_get_items(field); |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
361 | for (; iter; iter = iter->next) { |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
362 | const char *text = iter->data; |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
363 | gpointer key = purple_request_field_list_get_data(field, text); |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
364 | if (key == data) { |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
365 | list = g_list_prepend(list, (gpointer)text); |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
366 | break; |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
367 | } |
|
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
368 | } |
|
14110
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
369 | } |
|
ac6690ef2df0
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14109
diff
changeset
|
370 | |
| 15884 | 371 | purple_request_field_list_set_selected(field, list); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
372 | g_list_free(list); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
373 | } |
| 15884 | 374 | else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
375 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
376 | GntWidget *combo = purple_request_field_get_ui_data(field); |
| 15884 | 377 | PurpleAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
| 378 | purple_request_field_account_set_value(field, acc); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
379 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
380 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
381 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
382 | |
|
22937
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
383 | purple_notify_close_with_handle(button); |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
384 | |
|
22995
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
385 | if (!g_object_get_data(G_OBJECT(button), "cancellation-function") && |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32887
diff
changeset
|
386 | (!purple_request_fields_all_required_filled(fields) || |
|
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32887
diff
changeset
|
387 | !purple_request_fields_all_valid(fields))) { |
|
22937
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
388 | purple_notify_error(button, _("Error"), |
|
33213
2852fbde4722
Validation for Request API; use it in 'new IM' dialog.
Tomasz Wasilczyk <tomkiewicz@cpw.pidgin.im>
parents:
32887
diff
changeset
|
389 | _("You must properly fill all the required fields."), |
|
34449
bbcb198650b7
Notify API: extend purple_notify_message with PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34448
diff
changeset
|
390 | _("The required fields are underlined."), NULL); |
|
22937
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
391 | return; |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
392 | } |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
393 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
394 | if (callback) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
395 | callback(data, fields); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
396 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
397 | while (button->parent) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
398 | button = button->parent; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
399 | |
| 15884 | 400 | purple_request_close(PURPLE_REQUEST_FIELDS, button); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
401 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
402 | |
|
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
|
403 | static void |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
404 | update_selected_account(GntEntry *username, const char *start, const char *end, |
|
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
|
405 | 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
|
406 | { |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
407 | GList *accounts = gnt_tree_get_rows(GNT_TREE(accountlist->dropdown)); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
408 | const char *name = gnt_entry_get_text(username); |
|
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
|
409 | while (accounts) { |
|
34728
8efd73063ecf
Renamed buddy list functions to more appropriate/simler names.
Ankit Vani <a@nevitus.org>
parents:
34699
diff
changeset
|
410 | if (purple_blist_find_buddy(accounts->data, name)) { |
|
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
|
411 | 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
|
412 | 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
|
413 | 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
|
414 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
415 | 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
|
416 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
417 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
418 | |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
419 | static GntWidget* |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
420 | create_boolean_field(PurpleRequestField *field) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
421 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
422 | const char *label = purple_request_field_get_label(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
423 | GntWidget *check = gnt_check_box_new(label); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
424 | gnt_check_box_set_checked(GNT_CHECK_BOX(check), |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
425 | purple_request_field_bool_get_default_value(field)); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
426 | return check; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
427 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
428 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
429 | static GntWidget* |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
430 | create_string_field(PurpleRequestField *field, GntWidget **username) |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
431 | { |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
432 | const char *hint = purple_request_field_get_field_type_hint(field); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
433 | GntWidget *entry = gnt_entry_new( |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
434 | purple_request_field_string_get_default_value(field)); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
435 | gnt_entry_set_masked(GNT_ENTRY(entry), |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
436 | purple_request_field_string_is_masked(field)); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
437 | if (hint && purple_str_has_prefix(hint, "screenname")) { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
438 | PurpleBlistNode *node = purple_blist_get_root(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
439 | gboolean offline = purple_str_has_suffix(hint, "all"); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
440 | for (; node; node = purple_blist_node_next(node, offline)) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33213
diff
changeset
|
441 | if (!PURPLE_IS_BUDDY(node)) |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
442 | continue; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
443 | gnt_entry_add_suggest(GNT_ENTRY(entry), purple_buddy_get_name((PurpleBuddy*)node)); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
444 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
445 | gnt_entry_set_always_suggest(GNT_ENTRY(entry), TRUE); |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
446 | if (username) |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
447 | *username = entry; |
| 38260 | 448 | } else if (purple_strequal(hint, "group")) { |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
449 | PurpleBlistNode *node; |
|
22334
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22224
diff
changeset
|
450 | for (node = purple_blist_get_root(); node; |
|
6eec04817c0d
Add API so Finch doesn't need to touch the internals of PurpleBlistNode.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22224
diff
changeset
|
451 | node = purple_blist_node_get_sibling_next(node)) { |
|
34696
6e0d13978666
Global replace to use GObject-style macros. See details.
Ankit Vani <a@nevitus.org>
parents:
33213
diff
changeset
|
452 | if (PURPLE_IS_GROUP(node)) |
|
22342
916c989bd2c0
Update finch to not touch the internals of PurpleGroup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22339
diff
changeset
|
453 | gnt_entry_add_suggest(GNT_ENTRY(entry), purple_group_get_name((PurpleGroup *)node)); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
454 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
455 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
456 | return entry; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
457 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
458 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
459 | static GntWidget* |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
460 | create_integer_field(PurpleRequestField *field) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
461 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
462 | char str[256]; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
463 | int val = purple_request_field_int_get_default_value(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
464 | GntWidget *entry; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
465 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
466 | snprintf(str, sizeof(str), "%d", val); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
467 | entry = gnt_entry_new(str); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
468 | gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
469 | return entry; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
470 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
471 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
472 | static GntWidget* |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
473 | create_choice_field(PurpleRequestField *field) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
474 | { |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
475 | GList *it; |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
476 | GntWidget *combo = gnt_combo_box_new(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
477 | |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
478 | it = purple_request_field_choice_get_elements(field); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
479 | while (it != NULL) |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
480 | { |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
481 | const gchar *text; |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
482 | gpointer value; |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
483 | |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
484 | text = it->data; |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
485 | it = g_list_next(it); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
486 | g_assert(it != NULL); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
487 | value = it->data; |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
488 | it = g_list_next(it); |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
489 | |
|
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
490 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), value, text); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
491 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
492 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
|
34338
c652670afac5
Request API refactoring: custom PURPLE_REQUEST_CHOICE values, instead of indexes
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34335
diff
changeset
|
493 | purple_request_field_choice_get_default_value(field)); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
494 | return combo; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
495 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
496 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
497 | static GntWidget* |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
498 | create_list_field(PurpleRequestField *field) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
499 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
500 | GntWidget *ret = NULL; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
501 | GList *list; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
502 | gboolean multi = purple_request_field_list_get_multi_select(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
503 | if (multi) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
504 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
505 | GntWidget *tree = gnt_tree_new(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
506 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
507 | list = purple_request_field_list_get_items(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
508 | for (; list; list = list->next) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
509 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
510 | const char *text = list->data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
511 | gpointer key = purple_request_field_list_get_data(field, text); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
512 | gnt_tree_add_choice(GNT_TREE(tree), key, |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
513 | gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
514 | if (purple_request_field_list_is_selected(field, text)) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
515 | gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
516 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
517 | ret = tree; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
518 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
519 | else |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
520 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
521 | GntWidget *combo = gnt_combo_box_new(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
522 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
523 | list = purple_request_field_list_get_items(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
524 | for (; list; list = list->next) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
525 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
526 | const char *text = list->data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
527 | gpointer key = purple_request_field_list_get_data(field, text); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
528 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
529 | if (purple_request_field_list_is_selected(field, text)) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
530 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
531 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
532 | ret = combo; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
533 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
534 | return ret; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
535 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
536 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
537 | static GntWidget* |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
538 | create_account_field(PurpleRequestField *field) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
539 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
540 | gboolean all; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
541 | PurpleAccount *def; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
542 | GList *list; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
543 | GntWidget *combo = gnt_combo_box_new(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
544 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
545 | all = purple_request_field_account_get_show_all(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
546 | def = purple_request_field_account_get_value(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
547 | if (!def) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
548 | def = purple_request_field_account_get_default_value(field); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
549 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
550 | if (all) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
551 | list = purple_accounts_get_all(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
552 | else |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
553 | list = purple_connections_get_all(); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
554 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
555 | for (; list; list = list->next) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
556 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
557 | PurpleAccount *account; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
558 | char *text; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
559 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
560 | if (all) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
561 | account = list->data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
562 | else |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
563 | account = purple_connection_get_account(list->data); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
564 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
565 | text = g_strdup_printf("%s (%s)", |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
566 | purple_account_get_username(account), |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
567 | purple_account_get_protocol_name(account)); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
568 | gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
569 | g_free(text); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
570 | if (account == def) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
571 | gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
572 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
573 | gnt_widget_set_size(combo, 20, 3); /* ew */ |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
574 | return combo; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
575 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
576 | |
|
35920
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
577 | static void |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
578 | multifield_extra_cb(GntWidget *button, PurpleRequestFields *allfields) |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
579 | { |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
580 | PurpleRequestFieldsCb cb; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
581 | gpointer cb_data; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
582 | gpointer handle; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
583 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
584 | handle = g_object_get_data(G_OBJECT(button), "ui-handle"); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
585 | cb = g_object_get_data(G_OBJECT(button), "extra-cb"); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
586 | cb_data = g_object_get_data(G_OBJECT(button), "extra-cb-data"); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
587 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
588 | if (cb != NULL) |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
589 | cb(cb_data, allfields); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
590 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
591 | action_performed(button, handle); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
592 | purple_request_close(PURPLE_REQUEST_FIELDS, handle); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
593 | } |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
594 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
595 | static void * |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
596 | finch_request_fields(const char *title, const char *primary, |
| 15884 | 597 | const char *secondary, PurpleRequestFields *allfields, |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
598 | const char *ok, GCallback ok_cb, |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
599 | const char *cancel, GCallback cancel_cb, |
|
34332
876483829700
Request API refactoring: switch purple_request_fields to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34331
diff
changeset
|
600 | PurpleRequestCommonParameters *cpar, |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
601 | void *userdata) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
602 | { |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
603 | GntWidget *window, *box; |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
604 | GList *grlist; |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
605 | GntWidget *username = NULL, *accountlist = NULL; |
|
35920
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
606 | PurpleRequestHelpCb help_cb; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
607 | gpointer help_data; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
608 | GSList *extra_actions, *it; |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
609 | |
| 15884 | 610 | 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
|
611 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
612 | /* 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
|
613 | * 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
|
614 | * the groups. */ |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
615 | box = gnt_vbox_new(FALSE); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
616 | gnt_box_set_pad(GNT_BOX(box), 0); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
617 | gnt_box_set_fill(GNT_BOX(box), TRUE); |
| 15884 | 618 | 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
|
619 | { |
| 15884 | 620 | PurpleRequestFieldGroup *group = grlist->data; |
| 621 | GList *fields = purple_request_field_group_get_fields(group); | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
622 | GntWidget *hbox; |
| 15884 | 623 | 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
|
624 | |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
625 | if (title) |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
626 | gnt_box_add_widget(GNT_BOX(box), |
|
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
627 | 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
|
628 | |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
629 | for (; fields ; fields = fields->next) |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
630 | { |
| 15884 | 631 | PurpleRequestField *field = fields->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
632 | PurpleRequestFieldType type = purple_request_field_get_field_type(field); |
| 15884 | 633 | const char *label = purple_request_field_get_label(field); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
634 | |
|
27803
d56c80617fc7
Do not show hidden request fields.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26477
diff
changeset
|
635 | if (!purple_request_field_is_visible(field)) |
|
d56c80617fc7
Do not show hidden request fields.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26477
diff
changeset
|
636 | continue; |
|
d56c80617fc7
Do not show hidden request fields.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26477
diff
changeset
|
637 | |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
638 | hbox = gnt_hbox_new(TRUE); /* hrm */ |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
639 | gnt_box_add_widget(GNT_BOX(box), hbox); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
640 | |
| 15884 | 641 | if (type != PURPLE_REQUEST_FIELD_BOOLEAN && label) |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
642 | { |
|
22937
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
643 | GntWidget *l; |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
644 | if (purple_request_field_is_required(field)) |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
645 | l = gnt_label_new_with_format(label, GNT_TEXT_FLAG_UNDERLINE); |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
646 | else |
|
7e0347f7e623
Make sure the required fields are all entered correctly. Underline the
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22342
diff
changeset
|
647 | l = gnt_label_new(label); |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
648 | gnt_widget_set_size(l, 0, 1); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
649 | gnt_box_add_widget(GNT_BOX(hbox), l); |
|
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
650 | } |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
651 | |
| 15884 | 652 | if (type == PURPLE_REQUEST_FIELD_BOOLEAN) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
653 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
654 | purple_request_field_set_ui_data(field, create_boolean_field(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
655 | } |
| 15884 | 656 | else if (type == PURPLE_REQUEST_FIELD_STRING) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
657 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
658 | purple_request_field_set_ui_data(field, create_string_field(field, &username)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
659 | } |
| 15884 | 660 | else if (type == PURPLE_REQUEST_FIELD_INTEGER) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
661 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
662 | purple_request_field_set_ui_data(field, create_integer_field(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
663 | } |
| 15884 | 664 | else if (type == PURPLE_REQUEST_FIELD_CHOICE) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
665 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
666 | purple_request_field_set_ui_data(field, create_choice_field(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
667 | } |
| 15884 | 668 | else if (type == PURPLE_REQUEST_FIELD_LIST) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
669 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
670 | purple_request_field_set_ui_data(field, create_list_field(field)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
671 | } |
| 15884 | 672 | else if (type == PURPLE_REQUEST_FIELD_ACCOUNT) |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
673 | { |
|
24984
64b88867fbdf
Hide the PurpleRequestField struct. I figured this one would be easy and
Richard Laager <rlaager@pidgin.im>
parents:
23000
diff
changeset
|
674 | accountlist = create_account_field(field); |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
675 | purple_request_field_set_ui_data(field, accountlist); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
676 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
677 | else |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
678 | { |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
679 | purple_request_field_set_ui_data(field, gnt_label_new_with_format(_("Not implemented yet."), |
|
22339
f68309ed6c0a
We will probably eventually use purple_object_[get|set]_ui_data. Until then, this will do.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22334
diff
changeset
|
680 | GNT_TEXT_FLAG_BOLD)); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
681 | } |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
682 | gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
|
32252
2e532b3062eb
Rather use the accessor functions directly.
Andrew Victor <andrew.victor@mxit.com>
parents:
31294
diff
changeset
|
683 | gnt_box_add_widget(GNT_BOX(hbox), GNT_WIDGET(purple_request_field_get_ui_data(field))); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
684 | } |
|
14124
181ebb961493
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14121
diff
changeset
|
685 | if (grlist->next) |
|
14121
3d8804b82150
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14110
diff
changeset
|
686 | 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
|
687 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
688 | gnt_box_add_widget(GNT_BOX(window), box); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
689 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
690 | 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
|
691 | ok, ok_cb, cancel, cancel_cb, NULL); |
|
35920
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
692 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
693 | extra_actions = purple_request_cpar_get_extra_actions(cpar); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
694 | for (it = extra_actions; it; it = it->next->next) { |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
695 | const gchar *label = it->data; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
696 | PurpleRequestFieldsCb *cb = it->next->data; |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
697 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
698 | GntWidget *button = gnt_button_new(label); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
699 | gnt_box_add_widget_in_front(GNT_BOX(box), button); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
700 | g_object_set_data(G_OBJECT(button), "ui-handle", window); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
701 | g_object_set_data(G_OBJECT(button), "extra-cb", cb); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
702 | g_object_set_data(G_OBJECT(button), "extra-cb-data", userdata); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
703 | g_signal_connect(G_OBJECT(button), "activate", |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
704 | G_CALLBACK(multifield_extra_cb), allfields); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
705 | } |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
706 | |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
707 | help_cb = purple_request_cpar_get_help_cb(cpar, &help_data); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
708 | if (help_cb) { |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
709 | GntWidget *button = gnt_button_new(_("Help")); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
710 | gnt_box_add_widget_in_front(GNT_BOX(box), button); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
711 | g_signal_connect_swapped(G_OBJECT(button), "activate", |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
712 | G_CALLBACK(help_cb), help_data); |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
713 | } |
|
78b2942f06db
Finch-OTR: implement missing PurpleRequestCommonParameters features
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35475
diff
changeset
|
714 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
715 | gnt_box_add_widget(GNT_BOX(window), box); |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
716 | |
|
18392
9dd44f9e5f9e
Consider closing a request dialog equivalent to cancelling it.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18301
diff
changeset
|
717 | setup_default_callback(window, cancel_cb, userdata); |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
718 | 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
|
719 | |
|
25889
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
720 | if (username && accountlist) { |
|
26d9ca30335c
Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <markdoliner@pidgin.im>
parents:
24986
diff
changeset
|
721 | g_signal_connect(username, "completion", G_CALLBACK(update_selected_account), accountlist); |
|
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
|
722 | } |
|
34e07fa701cf
Select the right account when a buddyname is selected from the suggest-list.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19859
diff
changeset
|
723 | |
|
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
|
724 | g_object_set_data(G_OBJECT(window), "fields", allfields); |
|
22995
816ce422324b
The required fields are not really required if the action is cancelled.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22937
diff
changeset
|
725 | |
|
14109
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
726 | return window; |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
727 | } |
|
1af2b9d5ef3f
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14081
diff
changeset
|
728 | |
|
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
|
729 | static void |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
730 | 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
|
731 | { |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
732 | FinchFileRequest *data = fq; |
|
15715
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
733 | if (data->cbs[1] != NULL) |
| 15884 | 734 | ((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
|
735 | |
| 15884 | 736 | 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
|
737 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
738 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
739 | static void |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
740 | 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
|
741 | { |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
742 | FinchFileRequest *data = fq; |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
743 | 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
|
744 | 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
|
745 | if (data->cbs[0] != NULL) |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
746 | ((PurpleRequestFileCb)data->cbs[0])(data->user_data, file); |
|
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
747 | g_free(file); |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
748 | 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
|
749 | "/finch/filelocations/last_open_folder", dir); |
|
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
750 | 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
|
751 | |
| 15884 | 752 | 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
|
753 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
754 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
755 | static void |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
756 | file_request_destroy(FinchFileRequest *data) |
|
15715
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
757 | { |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
758 | 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
|
759 | 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
|
760 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
761 | |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
762 | static FinchFileRequest * |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
763 | finch_file_request_window(const char *title, const char *path, |
|
15715
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
764 | GCallback ok_cb, GCallback cancel_cb, |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
765 | void *user_data) |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
766 | { |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
767 | GntWidget *window = gnt_file_sel_new(); |
|
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
768 | GntFileSel *sel = GNT_FILE_SEL(window); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
769 | FinchFileRequest *data = g_new0(FinchFileRequest, 1); |
|
15715
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
770 | |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
771 | 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
|
772 | 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
|
773 | 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
|
774 | 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
|
775 | data->dialog = window; |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
776 | gnt_box_set_title(GNT_BOX(window), title); |
|
18561
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
777 | |
|
e48a272d383c
Remember the open/save file locations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18402
diff
changeset
|
778 | 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
|
779 | |
|
15990
8f3cecb0bf47
use file select dialog
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
15987
diff
changeset
|
780 | 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
|
781 | 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
|
782 | 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
|
783 | 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
|
784 | 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
|
785 | 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
|
786 | 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
|
787 | 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
|
788 | |
|
18562
c629fdadd30d
Fix some crashes resulting from rejecting file-transfer requests.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18561
diff
changeset
|
789 | 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
|
790 | 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
|
791 | (GDestroyNotify)file_request_destroy); |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
792 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
793 | return data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
794 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
795 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
796 | static void * |
|
34333
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
797 | finch_request_file(const char *title, const char *filename, gboolean savedialog, |
|
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
798 | GCallback ok_cb, GCallback cancel_cb, |
|
b92698241603
Request API refactoring: switch purple_request_file to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34332
diff
changeset
|
799 | PurpleRequestCommonParameters *cpar, void *user_data) |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
800 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
801 | FinchFileRequest *data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
802 | 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
|
803 | |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
804 | path = purple_prefs_get_path(savedialog ? "/finch/filelocations/last_save_folder" : "/finch/filelocations/last_open_folder"); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
805 | data = finch_file_request_window(title ? title : (savedialog ? _("Save File...") : _("Open File...")), path, |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
806 | ok_cb, cancel_cb, user_data); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
807 | data->save = savedialog; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
808 | if (savedialog) |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
809 | gnt_file_sel_set_suggested_filename(GNT_FILE_SEL(data->dialog), filename); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
810 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
811 | gnt_widget_show(data->dialog); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
812 | return data->dialog; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
813 | } |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
814 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
815 | static void * |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
816 | finch_request_folder(const char *title, const char *dirname, GCallback ok_cb, |
|
34334
f5f3a9945a6d
Request API refactoring: switch purple_request_folder to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
817 | GCallback cancel_cb, PurpleRequestCommonParameters *cpar, |
|
f5f3a9945a6d
Request API refactoring: switch purple_request_folder to PurpleRequestCommonParameters
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34333
diff
changeset
|
818 | void *user_data) |
|
22012
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
819 | { |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
820 | FinchFileRequest *data; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
821 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
822 | data = finch_file_request_window(title ? title : _("Choose Location..."), dirname, |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
823 | ok_cb, cancel_cb, user_data); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
824 | data->save = TRUE; |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
825 | gnt_file_sel_set_dirs_only(GNT_FILE_SEL(data->dialog), TRUE); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
826 | |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
827 | gnt_widget_show(data->dialog); |
|
2b0a29b31ef5
Implement 'request_folder'. (so now the 'autoaccept' plugin cannot just be a Gtk plugin)
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
21175
diff
changeset
|
828 | return data->dialog; |
|
15715
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
829 | } |
|
8c0cd13f4af3
The rest of Richard 'wabz' Nelson's patch for adding file-transfer ui.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
14752
diff
changeset
|
830 | |
| 15884 | 831 | static PurpleRequestUiOps uiops = |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
832 | { |
|
34335
2496c53cd401
Request API: HTML feature
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34334
diff
changeset
|
833 | 0, |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
834 | finch_request_input, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
835 | finch_request_choice, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
836 | finch_request_action, |
|
34443
b7926ff76ed6
Request API: implement purple_request_wait
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
837 | NULL, |
|
34448
e15d91a77cb3
Request API: PURPLE_REQUEST_WAIT with progress bar
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34443
diff
changeset
|
838 | NULL, |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
839 | finch_request_fields, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
840 | finch_request_file, |
|
34443
b7926ff76ed6
Request API: implement purple_request_wait
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
34338
diff
changeset
|
841 | finch_request_folder, |
|
17164
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
842 | finch_close_request, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
843 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
844 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
845 | NULL, |
|
3a005b9e8f28
Death to more futuristic struct initialization. This should be the last.
Richard Laager <rlaager@pidgin.im>
parents:
16983
diff
changeset
|
846 | NULL |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
847 | }; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
848 | |
| 15884 | 849 | PurpleRequestUiOps *finch_request_get_ui_ops() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
850 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
851 | return &uiops; |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
852 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
853 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
854 | void finch_request_init() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
855 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
856 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
857 | |
|
15878
f52832b611fe
renamed gaim-text to finch
Sean Egan <seanegan@pidgin.im>
parents:
15715
diff
changeset
|
858 | void finch_request_uninit() |
|
14045
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
859 | { |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
860 | } |
|
12b8c2bfd3fb
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff
changeset
|
861 | |
|
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
|
862 | 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
|
863 | { |
|
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
|
864 | 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
|
865 | 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
|
866 | 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
|
867 | GList *fields = purple_request_field_group_get_fields(group); |
|
30495
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
868 | |
|
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
|
869 | 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
|
870 | PurpleRequestField *field = fields->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
871 | PurpleRequestFieldType type = purple_request_field_get_field_type(field); |
|
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
|
872 | 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
|
873 | 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
|
874 | 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
|
875 | |
|
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
|
876 | 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
|
877 | 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
|
878 | val = purple_request_field_list_get_selected(field)->data; |
|
30495
cc00c5e8b499
Fix data selection in a list-type request-field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
29049
diff
changeset
|
879 | val = purple_request_field_list_get_data(field, 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
|
880 | 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
|
881 | 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
|
882 | 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
|
883 | 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
|
884 | 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
|
885 | 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
|
886 | 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
|
887 | 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
|
888 | 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
|
889 | 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
|
890 | 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
|
891 | 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
|
892 | } |
|
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
|
893 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
894 | pt = purple_prefs_get_pref_type(id); |
|
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
|
895 | 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
|
896 | case PURPLE_PREF_INT: |
|
17470
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
897 | { |
|
18301
1988607deed3
Fix a few runtime warnings.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
18190
diff
changeset
|
898 | long int tmp = GPOINTER_TO_INT(val); |
|
35991
e6937e52930b
Fix some CWE-252 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
899 | if (type == PURPLE_REQUEST_FIELD_LIST) { |
|
e6937e52930b
Fix some CWE-252 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
900 | /* Lists always return string */ |
|
e6937e52930b
Fix some CWE-252 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
901 | if (sscanf(val, "%ld", &tmp) != 1) |
|
e6937e52930b
Fix some CWE-252 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
902 | tmp = 0; |
|
e6937e52930b
Fix some CWE-252 coverity warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
31294
diff
changeset
|
903 | } |
|
17470
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
904 | 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
|
905 | break; |
|
17470
8cba93978730
A change from o_sukhodolsky:
Richard Laager <rlaager@pidgin.im>
parents:
17164
diff
changeset
|
906 | } |
|
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
|
907 | 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
|
908 | 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
|
909 | 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
|
910 | 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
|
911 | 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
|
912 | 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
|
913 | 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
|
914 | 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
|
915 | } |
|
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
|
916 | } |
|
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
|
917 | } |
|
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
|
918 | } |
|
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
|
919 | |
|
22135
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
920 | GntWidget *finch_request_field_get_widget(PurpleRequestField *field) |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
921 | { |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
922 | GntWidget *ret = NULL; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
923 | switch (purple_request_field_get_field_type(field)) { |
|
22135
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
924 | case PURPLE_REQUEST_FIELD_BOOLEAN: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
925 | ret = create_boolean_field(field); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
926 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
927 | case PURPLE_REQUEST_FIELD_STRING: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
928 | ret = create_string_field(field, NULL); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
929 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
930 | case PURPLE_REQUEST_FIELD_INTEGER: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
931 | ret = create_integer_field(field); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
932 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
933 | case PURPLE_REQUEST_FIELD_CHOICE: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
934 | ret = create_choice_field(field); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
935 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
936 | case PURPLE_REQUEST_FIELD_LIST: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
937 | ret = create_list_field(field); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
938 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
939 | case PURPLE_REQUEST_FIELD_ACCOUNT: |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
940 | ret = create_account_field(field); |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
941 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
942 | default: |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
943 | purple_debug_error("GntRequest", "Unimplemented request-field %d\n", |
|
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34955
diff
changeset
|
944 | purple_request_field_get_field_type(field)); |
|
22135
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
945 | break; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
946 | } |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
947 | return ret; |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
948 | } |
|
f593e34a0e8e
Add a function to get a widget for a request field.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22012
diff
changeset
|
949 |