Mercurial > pidgin
annotate console/gntrequest.c @ 15218:ec96d6d2fa6d
[gaim-migrate @ 18008]
Patch from Graham Booker to slowly scale up the size of our read or write
buffer when transfer files over fast networks. This should hopefully
reduce CPU load a tiny bit when transfer large files over fast connections.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 15 Dec 2006 08:39:53 +0000 |
parents | 97df6766c945 |
children | 836d7c247d22 |
rev | line source |
---|---|
14558
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
1 /** |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
2 * @file gntrequest.c GNT Request API |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
3 * @ingroup gntui |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
4 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
5 * gaim |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
6 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
7 * Gaim is the legal property of its developers, whose names are too numerous |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
8 * to list here. Please refer to the COPYRIGHT file distributed with this |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
9 * source distribution. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
10 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
13 * the Free Software Foundation; either version 2 of the License, or |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
14 * (at your option) any later version. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
15 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
19 * GNU General Public License for more details. |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
20 * |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
22 * along with this program; if not, write to the Free Software |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
81650a27f253
[gaim-migrate @ 17281]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14351
diff
changeset
|
24 */ |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 #include <gnt.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 #include <gntbox.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 #include <gntbutton.h> |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
28 #include <gntcheckbox.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 #include <gntcombobox.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 #include <gntentry.h> |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 #include <gntlabel.h> |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
32 #include <gntline.h> |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
33 #include <gnttree.h> |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
35 #include "gntgaim.h" |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 #include "gntrequest.h" |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 static GntWidget * |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 setup_request_window(const char *title, const char *primary, |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
40 const char *secondary, GaimRequestType type) |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GntWidget *window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 window = gnt_vbox_new(FALSE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 gnt_box_set_toplevel(GNT_BOX(window), TRUE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 gnt_box_set_title(GNT_BOX(window), title); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 if (primary) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 gnt_box_add_widget(GNT_BOX(window), |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 gnt_label_new_with_format(primary, GNT_TEXT_FLAG_BOLD)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
52 if (secondary) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 gnt_box_add_widget(GNT_BOX(window), gnt_label_new(secondary)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
55 g_signal_connect_swapped(G_OBJECT(window), "destroy", G_CALLBACK(gaim_request_close), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
56 GINT_TO_POINTER(type)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
57 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 return window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 static GntWidget * |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 setup_button_box(gpointer userdata, gpointer cb, gpointer data, ...) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 GntWidget *box, *button; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
65 va_list list; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 const char *text; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 gpointer callback; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
69 box = gnt_hbox_new(FALSE); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 va_start(list, data); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
72 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 while ((text = va_arg(list, const char *))) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 callback = va_arg(list, gpointer); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 button = gnt_button_new(text); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 gnt_box_add_widget(GNT_BOX(box), button); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 g_object_set_data(G_OBJECT(button), "activate-userdata", userdata); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(cb), data); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 va_end(list); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 return box; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 notify_input_cb(GntWidget *button, GntWidget *entry) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 GaimRequestInputCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
92 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
93 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
94 if (callback) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
95 callback(data, text); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
96 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
97 while (button->parent) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
98 button = button->parent; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
99 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
100 gaim_request_close(GAIM_REQUEST_INPUT, button); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
103 static void * |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
104 gg_request_input(const char *title, const char *primary, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
105 const char *secondary, const char *default_value, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
106 gboolean multiline, gboolean masked, gchar *hint, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
107 const char *ok_text, GCallback ok_cb, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
108 const char *cancel_text, GCallback cancel_cb, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
109 void *user_data) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 GntWidget *window, *box, *entry; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
113 window = setup_request_window(title, primary, secondary, GAIM_REQUEST_INPUT); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
115 entry = gnt_entry_new(default_value); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
116 if (masked) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
117 gnt_entry_set_masked(GNT_ENTRY(entry), TRUE); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
118 gnt_box_add_widget(GNT_BOX(window), entry); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
119 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
120 box = setup_button_box(user_data, notify_input_cb, entry, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
121 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
122 gnt_box_add_widget(GNT_BOX(window), box); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
123 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
124 gnt_widget_show(window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
125 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
126 return window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
127 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
128 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
129 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
130 gg_close_request(GaimRequestType type, gpointer ui_handle) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
131 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
132 GntWidget *widget = GNT_WIDGET(ui_handle); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
133 while (widget->parent) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
134 widget = widget->parent; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 gnt_widget_destroy(widget); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
136 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
137 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
138 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
139 request_choice_cb(GntWidget *button, GntComboBox *combo) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
140 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
141 GaimRequestChoiceCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
142 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
143 int choice = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))) - 1; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
144 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
145 if (callback) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
146 callback(data, choice); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
147 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
148 while (button->parent) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
149 button = button->parent; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
150 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
151 gaim_request_close(GAIM_REQUEST_INPUT, button); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
152 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
153 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
154 static void * |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
155 gg_request_choice(const char *title, const char *primary, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
156 const char *secondary, unsigned int default_value, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
157 const char *ok_text, GCallback ok_cb, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
158 const char *cancel_text, GCallback cancel_cb, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
159 void *user_data, va_list choices) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
160 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
161 GntWidget *window, *combo, *box; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
162 const char *text; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
163 int val; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
164 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
165 window = setup_request_window(title, primary, secondary, GAIM_REQUEST_CHOICE); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
166 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
167 combo = gnt_combo_box_new(); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
168 gnt_box_add_widget(GNT_BOX(window), combo); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
169 while ((text = va_arg(choices, const char *))) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
170 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
171 val = va_arg(choices, int); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
172 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), GINT_TO_POINTER(val + 1), text); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
173 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
174 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), GINT_TO_POINTER(default_value + 1)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
175 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
176 box = setup_button_box(user_data, request_choice_cb, combo, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
177 ok_text, ok_cb, cancel_text, cancel_cb, NULL); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
178 gnt_box_add_widget(GNT_BOX(window), box); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
179 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
180 gnt_widget_show(window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
181 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
182 return window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
183 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
184 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
185 static void |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
186 request_action_cb(GntWidget *button, GntWidget *window) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
187 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
188 GaimRequestActionCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
189 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
190 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button), "activate-id")); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
191 |
14019
19a1812e6c46
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
192 if (callback) |
19a1812e6c46
[gaim-migrate @ 16615]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
13983
diff
changeset
|
193 callback(data, id); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
194 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
195 gaim_request_close(GAIM_REQUEST_ACTION, window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
196 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
197 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
198 static void* |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
199 gg_request_action(const char *title, const char *primary, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
200 const char *secondary, unsigned int default_value, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
201 void *user_data, size_t actioncount, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
202 va_list actions) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
203 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
204 GntWidget *window, *box, *button; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
205 int i; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
206 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
207 window = setup_request_window(title, primary, secondary, GAIM_REQUEST_ACTION); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
208 |
14064
fec4fadf30c9
[gaim-migrate @ 16683]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14063
diff
changeset
|
209 box = gnt_hbox_new(FALSE); |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
210 gnt_box_add_widget(GNT_BOX(window), box); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
211 for (i = 0; i < actioncount; i++) |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
212 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
213 const char *text = va_arg(actions, const char *); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
214 GaimRequestActionCb callback = va_arg(actions, GaimRequestActionCb); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
215 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
216 button = gnt_button_new(text); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
217 gnt_box_add_widget(GNT_BOX(box), button); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
218 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
219 g_object_set_data(G_OBJECT(button), "activate-callback", callback); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
220 g_object_set_data(G_OBJECT(button), "activate-userdata", user_data); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
221 g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i)); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
222 g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
223 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
224 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
225 gnt_widget_show(window); |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
226 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
227 return window; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
228 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
229 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
230 static void |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
231 request_fields_cb(GntWidget *button, GaimRequestFields *fields) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
232 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
233 GaimRequestFieldsCb callback = g_object_get_data(G_OBJECT(button), "activate-callback"); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
234 gpointer data = g_object_get_data(G_OBJECT(button), "activate-userdata"); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
235 GList *list; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
236 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
237 /* Update the data of the fields. GtkGaim does this differently. Instead of |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
238 * updating the fields at the end like here, it updates the appropriate field |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
239 * instantly whenever a change is made. That allows it to make sure the |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
240 * 'required' fields are entered before the user can hit OK. It's not the case |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
241 * here, althought it can be done. I am not honouring the 'required' fields |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
242 * for the moment. */ |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
243 for (list = gaim_request_fields_get_groups(fields); list; list = list->next) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
244 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
245 GaimRequestFieldGroup *group = list->data; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
246 GList *fields = gaim_request_field_group_get_fields(group); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
247 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
248 for (; fields ; fields = fields->next) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
249 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
250 GaimRequestField *field = fields->data; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
251 GaimRequestFieldType type = gaim_request_field_get_type(field); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
252 if (type == GAIM_REQUEST_FIELD_BOOLEAN) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
253 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
254 GntWidget *check = field->ui_data; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
255 gboolean value = gnt_check_box_get_checked(GNT_CHECK_BOX(check)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
256 gaim_request_field_bool_set_value(field, value); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
257 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
258 else if (type == GAIM_REQUEST_FIELD_STRING) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
259 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
260 GntWidget *entry = field->ui_data; |
14063
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
261 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
ccbd43daa1a3
[gaim-migrate @ 16682]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14062
diff
changeset
|
262 gaim_request_field_string_set_value(field, (text && *text) ? text : NULL); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
263 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
264 else if (type == GAIM_REQUEST_FIELD_INTEGER) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
265 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
266 GntWidget *entry = field->ui_data; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
267 const char *text = gnt_entry_get_text(GNT_ENTRY(entry)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
268 int value = (text && *text) ? atoi(text) : 0; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
269 gaim_request_field_int_set_value(field, value); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
270 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
271 else if (type == GAIM_REQUEST_FIELD_CHOICE) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
272 { |
14226 | 273 GntWidget *combo = field->ui_data; |
14198
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
274 int id; |
c65ed4f6eea8
[gaim-migrate @ 16870]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14064
diff
changeset
|
275 id = GPOINTER_TO_INT(gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo))); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
276 gaim_request_field_choice_set_value(field, id); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
277 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
278 else if (type == GAIM_REQUEST_FIELD_LIST) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
279 { |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
280 GList *list = NULL; |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
281 if (gaim_request_field_list_get_multi_select(field)) |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
282 { |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
283 const GList *iter; |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
284 GntWidget *tree = field->ui_data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
285 |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
286 iter = gaim_request_field_list_get_items(field); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
287 for (; iter; iter = iter->next) |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
288 { |
14690 | 289 const char *text = iter->data; |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
290 gpointer key = gaim_request_field_list_get_data(field, text); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
291 if (gnt_tree_get_choice(GNT_TREE(tree), key)) |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
292 list = g_list_prepend(list, key); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
293 } |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
294 } |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
295 else |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
296 { |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
297 GntWidget *combo = field->ui_data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
298 gpointer data = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
299 list = g_list_append(list, data); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
300 } |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
301 |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
302 gaim_request_field_list_set_selected(field, list); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
303 g_list_free(list); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
304 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
305 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
306 { |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
307 GntWidget *combo = field->ui_data; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
308 GaimAccount *acc = gnt_combo_box_get_selected_data(GNT_COMBO_BOX(combo)); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
309 gaim_request_field_account_set_value(field, acc); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
310 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
311 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
312 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
313 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
314 if (callback) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
315 callback(data, fields); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
316 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
317 while (button->parent) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
318 button = button->parent; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
319 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
320 gaim_request_close(GAIM_REQUEST_FIELDS, button); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
321 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
322 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
323 static void * |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
324 gg_request_fields(const char *title, const char *primary, |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
325 const char *secondary, GaimRequestFields *allfields, |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
326 const char *ok, GCallback ok_cb, |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
327 const char *cancel, GCallback cancel_cb, |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
328 void *userdata) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
329 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
330 GntWidget *window, *box; |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
331 GList *grlist; |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
332 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
333 window = setup_request_window(title, primary, secondary, GAIM_REQUEST_FIELDS); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
334 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
335 /* This is how it's going to work: the request-groups are going to be |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
336 * stacked vertically one after the other. A GntLine will be separating |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
337 * the groups. */ |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
338 box = gnt_vbox_new(FALSE); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
339 gnt_box_set_pad(GNT_BOX(box), 0); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
340 gnt_box_set_fill(GNT_BOX(box), TRUE); |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
341 for (grlist = gaim_request_fields_get_groups(allfields); grlist; grlist = grlist->next) |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
342 { |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
343 GaimRequestFieldGroup *group = grlist->data; |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
344 GList *fields = gaim_request_field_group_get_fields(group); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
345 GntWidget *hbox; |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
346 const char *title = gaim_request_field_group_get_title(group); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
347 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
348 if (title) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
349 gnt_box_add_widget(GNT_BOX(box), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
350 gnt_label_new_with_format(title, GNT_TEXT_FLAG_BOLD)); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
351 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
352 for (; fields ; fields = fields->next) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
353 { |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
354 /* XXX: Break each of the fields into a separate function? */ |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
355 GaimRequestField *field = fields->data; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
356 GaimRequestFieldType type = gaim_request_field_get_type(field); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
357 const char *label = gaim_request_field_get_label(field); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
358 |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
359 hbox = gnt_hbox_new(TRUE); /* hrm */ |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
360 gnt_box_add_widget(GNT_BOX(box), hbox); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
361 |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
362 if (type != GAIM_REQUEST_FIELD_BOOLEAN && label) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
363 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
364 GntWidget *l = gnt_label_new(label); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
365 gnt_widget_set_size(l, 0, 1); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
366 gnt_box_add_widget(GNT_BOX(hbox), l); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
367 } |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
368 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
369 if (type == GAIM_REQUEST_FIELD_BOOLEAN) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
370 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
371 GntWidget *check = gnt_check_box_new(label); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
372 gnt_check_box_set_checked(GNT_CHECK_BOX(check), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
373 gaim_request_field_bool_get_default_value(field)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
374 gnt_box_add_widget(GNT_BOX(hbox), check); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
375 field->ui_data = check; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
376 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
377 else if (type == GAIM_REQUEST_FIELD_STRING) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
378 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
379 GntWidget *entry = gnt_entry_new( |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
380 gaim_request_field_string_get_default_value(field)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
381 gnt_entry_set_masked(GNT_ENTRY(entry), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
382 gaim_request_field_string_is_masked(field)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
383 gnt_box_add_widget(GNT_BOX(hbox), entry); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
384 field->ui_data = entry; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
385 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
386 else if (type == GAIM_REQUEST_FIELD_INTEGER) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
387 { |
14351
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
388 char str[256]; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
389 int val = gaim_request_field_int_get_default_value(field); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
390 GntWidget *entry; |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
391 |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
392 snprintf(str, sizeof(str), "%d", val); |
1bd09d355f9e
[gaim-migrate @ 17054]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14226
diff
changeset
|
393 entry = gnt_entry_new(str); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
394 gnt_entry_set_flag(GNT_ENTRY(entry), GNT_ENTRY_FLAG_INT); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
395 gnt_box_add_widget(GNT_BOX(hbox), entry); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
396 field->ui_data = entry; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
397 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
398 else if (type == GAIM_REQUEST_FIELD_CHOICE) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
399 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
400 int id; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
401 const GList *list; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
402 GntWidget *combo = gnt_combo_box_new(); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
403 gnt_box_add_widget(GNT_BOX(hbox), combo); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
404 field->ui_data = combo; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
405 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
406 list = gaim_request_field_choice_get_labels(field); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
407 for (id = 1; list; list = list->next, id++) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
408 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
409 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
410 GINT_TO_POINTER(id), list->data); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
411 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
412 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
413 GINT_TO_POINTER(gaim_request_field_choice_get_default_value(field))); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
414 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
415 else if (type == GAIM_REQUEST_FIELD_LIST) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
416 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
417 const GList *list; |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
418 gboolean multi = gaim_request_field_list_get_multi_select(field); |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
419 if (multi) |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
420 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
421 GntWidget *tree = gnt_tree_new(); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
422 gnt_box_add_widget(GNT_BOX(hbox), tree); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
423 field->ui_data = tree; |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
424 |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
425 list = gaim_request_field_list_get_items(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
426 for (; list; list = list->next) |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
427 { |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
428 const char *text = list->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
429 gpointer key = gaim_request_field_list_get_data(field, text); |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
430 gnt_tree_add_choice(GNT_TREE(tree), key, |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
431 gnt_tree_create_row(GNT_TREE(tree), text), NULL, NULL); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
432 if (gaim_request_field_list_is_selected(field, text)) |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
433 gnt_tree_set_choice(GNT_TREE(tree), key, TRUE); |
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
434 } |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
435 } |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
436 else |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
437 { |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
438 GntWidget *combo = gnt_combo_box_new(); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
439 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
440 gnt_box_add_widget(GNT_BOX(hbox), combo); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
441 field->ui_data = combo; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
442 |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
443 list = gaim_request_field_list_get_items(field); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
444 for (; list; list = list->next) |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
445 { |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
446 const char *text = list->data; |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
447 gpointer key = gaim_request_field_list_get_data(field, text); |
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
448 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), key, text); |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
449 if (gaim_request_field_list_is_selected(field, text)) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
450 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), key); |
14048
9c4bec886220
[gaim-migrate @ 16661]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14047
diff
changeset
|
451 } |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
452 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
453 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
454 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
455 { |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
456 gboolean all; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
457 GaimAccount *def; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
458 GList *list; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
459 GntWidget *combo = gnt_combo_box_new(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
460 gnt_box_set_alignment(GNT_BOX(hbox), GNT_ALIGN_MID); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
461 gnt_box_add_widget(GNT_BOX(hbox), combo); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
462 field->ui_data = combo; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
463 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
464 all = gaim_request_field_account_get_show_all(field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
465 def = gaim_request_field_account_get_default_value(field); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
466 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
467 if (all) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
468 list = gaim_accounts_get_all(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
469 else |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
470 list = gaim_connections_get_all(); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
471 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
472 for (; list; list = list->next) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
473 { |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
474 GaimAccount *account; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
475 char *text; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
476 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
477 if (all) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
478 account = list->data; |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
479 else |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
480 account = gaim_connection_get_account(list->data); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
481 |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
482 text = g_strdup_printf("%s (%s)", |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
483 gaim_account_get_username(account), |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
484 gaim_account_get_protocol_name(account)); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
485 gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
486 g_free(text); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
487 if (account == def) |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
488 gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account); |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
489 } |
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
490 gnt_widget_set_size(combo, 20, 3); /* ew */ |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
491 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
492 else |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
493 { |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
494 gnt_box_add_widget(GNT_BOX(hbox), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
495 gnt_label_new_with_format(_("Not implemented yet."), |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
496 GNT_TEXT_FLAG_BOLD)); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
497 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
498 } |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
499 if (grlist->next) |
14059
2d1b41e3cf0d
[gaim-migrate @ 16674]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14048
diff
changeset
|
500 gnt_box_add_widget(GNT_BOX(box), gnt_hline_new()); |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
501 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
502 gnt_box_add_widget(GNT_BOX(window), box); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
503 |
14062
fa8f65cd912c
[gaim-migrate @ 16681]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14059
diff
changeset
|
504 box = setup_button_box(userdata, request_fields_cb, allfields, |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
505 ok, ok_cb, cancel, cancel_cb, NULL); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
506 gnt_box_add_widget(GNT_BOX(window), box); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
507 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
508 gnt_widget_show(window); |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
509 |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
510 return window; |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
511 } |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
512 |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
513 static GaimRequestUiOps uiops = |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
514 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
515 .request_input = gg_request_input, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
516 .close_request = gg_close_request, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
517 .request_choice = gg_request_choice, |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
518 .request_action = gg_request_action, |
14047
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
519 .request_fields = gg_request_fields, |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
520 .request_file = NULL, /* No plans for these */ |
c5bfede33622
[gaim-migrate @ 16660]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
14019
diff
changeset
|
521 .request_folder = NULL |
13983
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
522 }; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
523 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
524 GaimRequestUiOps *gg_request_get_ui_ops() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
525 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
526 return &uiops; |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
527 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
528 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
529 void gg_request_init() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
530 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
531 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
532 |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
533 void gg_request_uninit() |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
534 { |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
535 } |
b7a99d54a5a9
[gaim-migrate @ 16552]
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
536 |