annotate finch/gntrequest.c @ 32676:a34fc59e5ee8

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