annotate src/gtkrequest.c @ 8470:9949b752d1ab

[gaim-migrate @ 9203] Whitespace cleanup, and fix a compiler warning. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 19 Mar 2004 01:51:48 +0000
parents f4a878d48254
children 4cfb32f78d71
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file gtkrequest.c GTK+ Request API
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7964
diff changeset
7 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7964
diff changeset
8 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 7964
diff changeset
9 * source distribution.
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
10 *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * This program is free software; you can redistribute it and/or modify
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * it under the terms of the GNU General Public License as published by
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * the Free Software Foundation; either version 2 of the License, or
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * (at your option) any later version.
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * This program is distributed in the hope that it will be useful,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * GNU General Public License for more details.
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * You should have received a copy of the GNU General Public License
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 * along with this program; if not, write to the Free Software
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6363
diff changeset
25 #include "gtkinternal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
26
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
27 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
28
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "gtkrequest.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
30 #include "gtkutils.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31 #include "stock.h"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
32 #include "ui.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
8294
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
34 #include <gdk/gdkkeysyms.h>
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
35
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
36 #if GTK_CHECK_VERSION(2,3,0)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
37 # define NEW_STYLE_COMPLETION
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
38 #endif
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
39
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 typedef struct
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 GaimRequestType type;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 void *user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
47 GtkWidget *ok_button;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
48
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 size_t cb_count;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 GCallback *cbs;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
52 union
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
53 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
54 struct
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
55 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
56 GtkWidget *entry;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
57
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
58 gboolean multiline;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
59
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
60 } input;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
61
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
62 struct
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
63 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
64 GaimRequestFields *fields;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
65
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
66 } multifield;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
67
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
68 } u;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
69
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
70 } GaimGtkRequestData;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
8294
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
72 #ifndef NEW_STYLE_COMPLETION
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
73 typedef struct
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
74 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
75 GCompletion *completion;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
76
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
77 gboolean completion_started;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
78
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
79 } GaimGtkCompletionData;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
80 #endif
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
81
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
83 input_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 {
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
85 const char *value;
7174
5d0db846c42d [gaim-migrate @ 7742]
Nathan Walp <nwalp@pidgin.im>
parents: 7172
diff changeset
86 char *multiline_value = NULL;
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
87
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
88 if (data->u.input.multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
89 GtkTextIter start_iter, end_iter;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
90 GtkTextBuffer *buffer =
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
91 gtk_text_view_get_buffer(GTK_TEXT_VIEW(data->u.input.entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
92
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
93 gtk_text_buffer_get_start_iter(buffer, &start_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
94 gtk_text_buffer_get_end_iter(buffer, &end_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
95
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
96 multiline_value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter,
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
97 FALSE);
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
98 value = multiline_value;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 }
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
100 else
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
101 value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
102
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
103 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
104 ((GaimRequestInputCb)data->cbs[id])(data->user_data, value);
6110
d1d8e70cf33d [gaim-migrate @ 6572]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
105 else if (data->cbs[1] != NULL)
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
106 ((GaimRequestInputCb)data->cbs[1])(data->user_data, value);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
108 if (data->u.input.multiline)
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
109 g_free(multiline_value);
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
110
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111 gaim_request_close(GAIM_REQUEST_INPUT, data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
114 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
115 action_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
116 {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
117 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
118 ((GaimRequestActionCb)data->cbs[id])(data->user_data, id);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
119
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
120 gaim_request_close(GAIM_REQUEST_INPUT, data);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
121 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
122
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
123 static gboolean
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
124 field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event,
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
125 GaimRequestField *field)
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
126 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
127 const char *value;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
128
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
129 if (gaim_request_field_string_is_multiline(field))
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
130 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
131 GtkTextBuffer *buffer;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
132 GtkTextIter start_iter, end_iter;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
133
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
134 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
135
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
136 gtk_text_buffer_get_start_iter(buffer, &start_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
137 gtk_text_buffer_get_end_iter(buffer, &end_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
138
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
139 value = gtk_text_buffer_get_text(buffer, &start_iter, &end_iter, FALSE);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
140 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
141 else
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
142 value = gtk_entry_get_text(GTK_ENTRY(entry));
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
143
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
144 gaim_request_field_string_set_value(field,
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
145 (*value == '\0' ? NULL : value));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
146
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
147 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
148 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
149
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
150 static gboolean
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
151 field_int_focus_out_cb(GtkEntry *entry, GdkEventFocus *event,
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
152 GaimRequestField *field)
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
153 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
154 gaim_request_field_int_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
155 atoi(gtk_entry_get_text(entry)));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
156
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
157 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
158 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
159
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
160 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
161 field_bool_cb(GtkToggleButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
162 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
163 gaim_request_field_bool_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
164 gtk_toggle_button_get_active(button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
165 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
166
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
167 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
168 field_choice_menu_cb(GtkOptionMenu *menu, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
169 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
170 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
171 gtk_option_menu_get_history(menu));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
172 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
173
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
174 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
175 field_choice_option_cb(GtkRadioButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
176 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
177 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
178 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
179 g_slist_index(gtk_radio_button_get_group(button), button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
180 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
181
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
182 static void
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
183 field_account_cb(GObject *w, GaimAccount *account, GaimRequestField *field)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
184 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
185 gaim_request_field_account_set_value(field, account);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
186 }
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
187
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
188 static void
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
189 multifield_ok_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
190 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
191 if (data->cbs[0] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
192 ((GaimRequestFieldsCb)data->cbs[0])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
193 data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
194
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
195 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
196 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
197
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
198 static void
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
199 multifield_cancel_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
200 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
201 if (data->cbs[1] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
202 ((GaimRequestFieldsCb)data->cbs[1])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
203 data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
204
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
205 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
206 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
207
8323
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
208 static void
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
209 destroy_multifield_cb(GtkWidget *dialog, GdkEvent *event,
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
210 GaimGtkRequestData *data)
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
211 {
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
212 multifield_cancel_cb(NULL, data);
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
213 }
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
214
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
215
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 #define STOCK_ITEMIZE(r, l) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 if (!strcmp((r), text)) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 return (l);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 static const char *
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
221 text_to_stock(const char *text)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222 {
6334
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
223 STOCK_ITEMIZE(_("Yes"), GTK_STOCK_YES);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
224 STOCK_ITEMIZE(_("No"), GTK_STOCK_NO);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
225 STOCK_ITEMIZE(_("OK"), GTK_STOCK_OK);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
226 STOCK_ITEMIZE(_("Cancel"), GTK_STOCK_CANCEL);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
227 STOCK_ITEMIZE(_("Apply"), GTK_STOCK_APPLY);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
228 STOCK_ITEMIZE(_("Close"), GTK_STOCK_CLOSE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
229 STOCK_ITEMIZE(_("Delete"), GTK_STOCK_DELETE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
230 STOCK_ITEMIZE(_("Add"), GTK_STOCK_ADD);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
231 STOCK_ITEMIZE(_("Remove"), GTK_STOCK_REMOVE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
232 STOCK_ITEMIZE(_("Save"), GTK_STOCK_SAVE);
8302
462ead6fc1a0 [gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents: 8294
diff changeset
233 STOCK_ITEMIZE(_("Alias"), GAIM_STOCK_ALIAS);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
235 return text;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
238 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 gaim_gtk_request_input(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 const char *secondary, const char *default_value,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
241 gboolean multiline, gboolean masked,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 const char *cancel_text, GCallback cancel_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 void *user_data)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
246 GaimGtkRequestData *data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 GtkWidget *vbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 GtkWidget *hbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 GtkWidget *label;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 GtkWidget *entry;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 GtkWidget *img;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 char *label_text;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
255 data = g_new0(GaimGtkRequestData, 1);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 data->type = GAIM_REQUEST_INPUT;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 data->user_data = user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 data->cb_count = 2;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 data->cbs = g_new0(GCallback, 2);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 data->cbs[0] = ok_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 data->cbs[1] = cancel_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 /* Create the dialog. */
7678
cf6a7939af78 [gaim-migrate @ 8322]
Sean Egan <seanegan@gmail.com>
parents: 7538
diff changeset
266 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE,
cf6a7939af78 [gaim-migrate @ 8322]
Sean Egan <seanegan@gmail.com>
parents: 7538
diff changeset
267 NULL, 0,
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
268 text_to_stock(cancel_text), 1,
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
269 text_to_stock(ok_text), 0,
5485
c103ba09c62a [gaim-migrate @ 5881]
Sean Egan <seanegan@gmail.com>
parents: 5480
diff changeset
270 NULL);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 data->dialog = dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
274 G_CALLBACK(input_response_cb), data);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276 /* Setup the dialog */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
278 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
281 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 /* Setup the main horizontal box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 hbox = gtk_hbox_new(FALSE, 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 /* Dialog icon. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 GTK_ICON_SIZE_DIALOG);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 /* Vertical box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 vbox = gtk_vbox_new(FALSE, 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 /* Descriptive label */
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
300 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
301 "%s</span>%s%s" : "%s%s%s"),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
302 (primary ? primary : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
303 ((primary && secondary) ? "\n\n" : ""),
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
304 (secondary ? secondary : ""));
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
305
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
306 label = gtk_label_new(NULL);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
307
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 gtk_label_set_markup(GTK_LABEL(label), label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
313 g_free(label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
314
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
315 /* Entry field. */
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
316 data->u.input.multiline = multiline;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
317
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
318 if (multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
319 GtkWidget *sw;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
320
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
321 sw = gtk_scrolled_window_new(NULL, NULL);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
322 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
323 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
324 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
325 GTK_SHADOW_IN);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
326
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
327 gtk_widget_set_size_request(sw, 320, 130);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
328
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
329 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
330
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
331 entry = gtk_text_view_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
332 gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE);
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
333 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
335 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
7538
357eb1c39b72 [gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents: 7458
diff changeset
336 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(entry));
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
337
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
338 gtk_container_add(GTK_CONTAINER(sw), entry);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
339
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
340 if (default_value != NULL) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
341 GtkTextBuffer *buffer;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
342
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
343 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
344 gtk_text_buffer_set_text(buffer, default_value, -1);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
345 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
346 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
347 else {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
348 entry = gtk_entry_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
349
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
350 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
351
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
352 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
353
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
354 if (default_value != NULL)
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
355 gtk_entry_set_text(GTK_ENTRY(entry), default_value);
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
356
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
357 if (masked)
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
358 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
359 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
360
8137
4971193f761d [gaim-migrate @ 8842]
Mark Doliner <mark@kingant.net>
parents: 8046
diff changeset
361 gaim_set_accessible_label (entry, label);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
362 data->u.input.entry = entry;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
363
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
364 /* Show everything. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
365 gtk_widget_show_all(dialog);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
366
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
367 return data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
368 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
369
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
370 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
371 gaim_gtk_request_choice(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
372 const char *secondary, unsigned int default_value,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
373 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
374 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
375 void *user_data, size_t choice_count, va_list args)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
376 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
377 return NULL;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
378 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
379
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
380 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
381 gaim_gtk_request_action(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
382 const char *secondary, unsigned int default_action,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
383 void *user_data, size_t action_count, va_list actions)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
384 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
385 GaimGtkRequestData *data;
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
386 GtkWidget *dialog;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
387 GtkWidget *vbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
388 GtkWidget *hbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
389 GtkWidget *label;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
390 GtkWidget *img;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
391 void **buttons;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
392 char *label_text;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
393 int i;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
394
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
395 data = g_new0(GaimGtkRequestData, 1);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
396 data->type = GAIM_REQUEST_ACTION;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
397 data->user_data = user_data;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
398
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
399 data->cb_count = action_count;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
400 data->cbs = g_new0(GCallback, action_count);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
401
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
402 /* Reverse the buttons */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
403 buttons = g_new0(void *, action_count * 2);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
404
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
405 for (i = 0; i < action_count * 2; i += 2) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
406 buttons[(action_count * 2) - i - 2] = va_arg(actions, char *);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
407 buttons[(action_count * 2) - i - 1] = va_arg(actions, GCallback);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
408 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
409
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
410 /* Create the dialog. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
411 data->dialog = dialog = gtk_dialog_new();
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6363
diff changeset
412
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
413 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
414 gtk_window_set_title(GTK_WINDOW(dialog), title);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
415
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
416 for (i = 0; i < action_count; i++) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
417 gtk_dialog_add_button(GTK_DIALOG(dialog),
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
418 text_to_stock(buttons[2 * i]), i);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
419
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
420 data->cbs[i] = buttons[2 * i + 1];
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
421 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
422
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
423 g_free(buttons);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
424
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
425 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
426 G_CALLBACK(action_response_cb), data);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
427
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
428 /* Setup the dialog */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
429 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
430 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
431 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
432 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
433 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
434
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
435 /* Setup the main horizontal box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
436 hbox = gtk_hbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
437 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
438
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
439 /* Dialog icon. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
440 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
441 GTK_ICON_SIZE_DIALOG);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
442 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
443 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
444
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
445 /* Vertical box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
446 vbox = gtk_vbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
447 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
448
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
449 /* Descriptive label */
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
450 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
451 "%s</span>%s%s" : "%s%s%s"),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
452 (primary ? primary : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
453 ((primary && secondary) ? "\n\n" : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
454 (secondary ? secondary : ""));
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
455
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
456 label = gtk_label_new(NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
457
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
458 gtk_label_set_markup(GTK_LABEL(label), label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
459 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
460 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
461 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
462
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
463 g_free(label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
464
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
465 if (default_action != -1)
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
466 gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
467
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
468 /* Show everything. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
469 gtk_widget_show_all(dialog);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
470
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
471 return data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
472 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
473
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
474 static void
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
475 req_entry_field_changed_cb(GtkWidget *entry, GaimRequestField *field)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
476 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
477 GaimGtkRequestData *req_data;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
478 const char *text = gtk_entry_get_text(GTK_ENTRY(entry));
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
479
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
480 gaim_request_field_string_set_value(field, (*text == '\0' ? NULL : text));
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
481
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
482 req_data = (GaimGtkRequestData *)field->group->fields_list->ui_data;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
483
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
484 gtk_widget_set_sensitive(req_data->ok_button,
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
485 gaim_request_fields_all_required_filled(field->group->fields_list));
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
486 }
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
487
8294
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
488 GList *
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
489 get_online_screennames(void)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
490 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
491 GList *screennames = NULL;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
492 GaimBlistNode *gnode, *cnode, *bnode;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
493
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
494 for (gnode = gaim_get_blist()->root; gnode != NULL; gnode = gnode->next)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
495 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
496 if (!GAIM_BLIST_NODE_IS_GROUP(gnode))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
497 continue;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
498
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
499 for (cnode = gnode->child; cnode != NULL; cnode = cnode->next)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
500 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
501 if (!GAIM_BLIST_NODE_IS_CONTACT(cnode))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
502 continue;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
503
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
504 for (bnode = cnode->child; bnode != NULL; bnode = bnode->next)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
505 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
506 GaimBuddy *buddy = (GaimBuddy *)bnode;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
507
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
508 if (!gaim_account_is_connected(buddy->account))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
509 continue;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
510
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
511 screennames = g_list_append(screennames, g_strdup(buddy->name));
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
512 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
513 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
514 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
515
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
516 return screennames;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
517 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
518
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
519 #ifndef NEW_STYLE_COMPLETION
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
520 static gboolean
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
521 completion_entry_event(GtkEditable *entry, GdkEventKey *event,
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
522 GaimGtkCompletionData *data)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
523 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
524 int pos, end_pos;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
525
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
526 if (event->type == GDK_KEY_PRESS && event->keyval == GDK_Tab)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
527 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
528 gtk_editable_get_selection_bounds(entry, &pos, &end_pos);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
529
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
530 if (data->completion_started &&
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
531 pos != end_pos && pos > 1 &&
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
532 end_pos == strlen(gtk_entry_get_text(GTK_ENTRY(entry))))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
533 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
534 gtk_editable_select_region(entry, 0, 0);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
535 gtk_editable_set_position(entry, -1);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
536
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
537 return TRUE;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
538 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
539 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
540 else if (event->type == GDK_KEY_PRESS && event->length > 0)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
541 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
542 char *prefix, *nprefix;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
543
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
544 gtk_editable_get_selection_bounds(entry, &pos, &end_pos);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
545
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
546 if (data->completion_started &&
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
547 pos != end_pos && pos > 1 &&
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
548 end_pos == strlen(gtk_entry_get_text(GTK_ENTRY(entry))))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
549 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
550 char *temp;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
551
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
552 temp = gtk_editable_get_chars(entry, 0, pos);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
553 prefix = g_strconcat(temp, event->string, NULL);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
554 g_free(temp);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
555 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
556 else if (pos == end_pos && pos > 1 &&
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
557 end_pos == strlen(gtk_entry_get_text(GTK_ENTRY(entry))))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
558 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
559 prefix = g_strconcat(gtk_entry_get_text(GTK_ENTRY(entry)),
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
560 event->string, NULL);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
561 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
562 else
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
563 return FALSE;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
564
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
565 pos = strlen(prefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
566 nprefix = NULL;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
567
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
568 g_completion_complete(data->completion, prefix, &nprefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
569
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
570 if (nprefix != NULL)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
571 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
572 gtk_entry_set_text(GTK_ENTRY(entry), nprefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
573 gtk_editable_set_position(entry, pos);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
574 gtk_editable_select_region(entry, pos, -1);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
575
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
576 data->completion_started = TRUE;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
577
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
578 g_free(nprefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
579 g_free(prefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
580
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
581 return TRUE;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
582 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
583
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
584 g_free(prefix);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
585 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
586
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
587 return FALSE;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
588 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
589
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
590 static void
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
591 destroy_completion_data(GtkWidget *w, GaimGtkCompletionData *data)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
592 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
593 g_list_foreach(data->completion->items, (GFunc)g_free, NULL);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
594 g_completion_free(data->completion);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
595
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
596 g_free(data);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
597 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
598 #endif /* !NEW_STYLE_COMPLETION */
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
599
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
600 static void
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
601 setup_screenname_autocomplete(GtkWidget *entry, GaimRequestField *field)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
602 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
603 #ifdef NEW_STYLE_COMPLETION
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
604 GtkListStore *store;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
605 GtkTreeIter iter;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
606 GtkEntryCompletion *completion;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
607 GList *screennames, *l;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
608
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
609 store = gtk_list_store_new(1, G_TYPE_STRING);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
610
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
611 screennames = get_online_screennames();
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
612
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
613 for (l = screennames; l != NULL; l = l->next)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
614 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
615 gtk_list_store_append(store, &iter);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
616 gtk_list_store_set(store, &iter, 0, l->data, -1);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
617 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
618
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
619 g_list_foreach(screennames, (GFunc)g_free, NULL);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
620 g_list_free(screennames);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
621
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
622 completion = gtk_entry_completion_new();
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
623 gtk_entry_set_completion(GTK_ENTRY(entry), completion);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
624 g_object_unref(completion);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
625
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
626 gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
627 g_object_unref(store);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
628
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
629 gtk_entry_completion_set_text_column(completion, 0);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
630
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
631 #else /* !NEW_STYLE_COMPLETION */
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
632 GaimGtkCompletionData *data;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
633 GList *screennames;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
634
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
635 data = g_new0(GaimGtkCompletionData, 1);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
636
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
637 data->completion = g_completion_new(NULL);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
638
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
639 g_completion_set_compare(data->completion, g_ascii_strncasecmp);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
640
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
641 screennames = get_online_screennames();
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
642
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
643 g_completion_add_items(data->completion, screennames);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
644
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
645 g_list_free(screennames);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
646
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
647 g_signal_connect(G_OBJECT(entry), "event",
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
648 G_CALLBACK(completion_entry_event), data);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
649 g_signal_connect(G_OBJECT(entry), "destroy",
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
650 G_CALLBACK(destroy_completion_data), data);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
651
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
652 #endif /* !NEW_STYLE_COMPLETION */
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
653 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
654
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
655 static void
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
656 setup_entry_field(GtkWidget *entry, GaimRequestField *field)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
657 {
8294
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
658 const char *type_hint;
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
659
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
660 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
661
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
662 if (gaim_request_field_is_required(field))
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
663 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
664 g_signal_connect(G_OBJECT(entry), "changed",
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
665 G_CALLBACK(req_entry_field_changed_cb), field);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
666 }
8294
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
667
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
668 if ((type_hint = gaim_request_field_get_type_hint(field)) != NULL)
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
669 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
670 if (!strcmp(type_hint, "screenname"))
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
671 {
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
672 setup_screenname_autocomplete(entry, field);
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
673 }
d5e59ea083be [gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents: 8289
diff changeset
674 }
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
675 }
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
676
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
677 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
678 create_string_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
679 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
680 const char *value;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
681 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
682
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
683 value = gaim_request_field_string_get_default_value(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
684
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
685 if (gaim_request_field_string_is_multiline(field))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
686 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
687 GtkWidget *textview;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
688
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
689 widget = gtk_scrolled_window_new(NULL, NULL);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
690 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
691 GTK_SHADOW_IN);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
692 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
693 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
694
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
695 textview = gtk_text_view_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
696 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
697 TRUE);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
698 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
699 GTK_WRAP_WORD_CHAR);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
700
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
701 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
702 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(textview));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
703
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
704 gtk_container_add(GTK_CONTAINER(widget), textview);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
705 gtk_widget_show(textview);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
706
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
707 gtk_widget_set_size_request(widget, -1, 75);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
708
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
709 if (value != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
710 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
711 GtkTextBuffer *buffer;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
712
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
713 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
714
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
715 gtk_text_buffer_set_text(buffer, value, -1);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
716 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
717
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
718 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
719 gaim_request_field_string_is_editable(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
720
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
721 g_signal_connect(G_OBJECT(textview), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
722 G_CALLBACK(field_string_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
723 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
724 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
725 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
726 widget = gtk_entry_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
727
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
728 setup_entry_field(widget, field);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
729
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
730 if (value != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
731 gtk_entry_set_text(GTK_ENTRY(widget), value);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
732
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
733 gtk_entry_set_visibility(GTK_ENTRY(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
734 !gaim_request_field_string_is_masked(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
735
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
736 gtk_editable_set_editable(GTK_EDITABLE(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
737 gaim_request_field_string_is_editable(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
738
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
739 g_signal_connect(G_OBJECT(widget), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
740 G_CALLBACK(field_string_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
741 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
742
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
743 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
744 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
745
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
746 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
747 create_int_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
748 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
749 int value;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
750 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
751
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
752 widget = gtk_entry_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
753
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
754 setup_entry_field(widget, field);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
755
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
756 value = gaim_request_field_int_get_default_value(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
757
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
758 if (value != 0)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
759 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
760 char buf[32];
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
761
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
762 g_snprintf(buf, sizeof(buf), "%d", value);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
763
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
764 gtk_entry_set_text(GTK_ENTRY(widget), buf);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
765 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
766
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
767 g_signal_connect(G_OBJECT(widget), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
768 G_CALLBACK(field_int_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
769
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
770 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
771 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
772
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
773 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
774 create_bool_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
775 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
776 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
777
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
778 widget = gtk_check_button_new_with_label(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
779 gaim_request_field_get_label(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
780
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
781 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
782 gaim_request_field_bool_get_default_value(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
783
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
784 g_signal_connect(G_OBJECT(widget), "toggled",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
785 G_CALLBACK(field_bool_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
786
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
787 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
788 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
789
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
790 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
791 create_choice_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
792 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
793 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
794 GList *labels;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
795 GList *l;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
796
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
797 labels = gaim_request_field_choice_get_labels(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
798
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
799 if (g_list_length(labels) > 5)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
800 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
801 GtkWidget *menu;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
802 GtkWidget *item;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
803
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
804 widget = gtk_option_menu_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
805
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
806 menu = gtk_menu_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
807
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
808 gtk_option_menu_set_menu(GTK_OPTION_MENU(widget), menu);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
809
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
810 for (l = labels; l != NULL; l = l->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
811 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
812 const char *text = l->data;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
813
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
814 item = gtk_menu_item_new_with_label(text);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
815
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
816 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
817 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
818
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
819 g_signal_connect(G_OBJECT(widget), "changed",
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
820 G_CALLBACK(field_choice_menu_cb), field);
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
821 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
822 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
823 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
824 GtkWidget *box;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
825 GtkWidget *first_radio = NULL;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
826 GtkWidget *radio;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
827
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
828 if (g_list_length(labels) == 2)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
829 box = gtk_hbox_new(FALSE, 6);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
830 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
831 box = gtk_vbox_new(FALSE, 0);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
832
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
833 widget = box;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
834
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
835 for (l = labels; l != NULL; l = l->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
836 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
837 const char *text = l->data;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
838
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
839 radio = gtk_radio_button_new_with_label_from_widget(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
840 GTK_RADIO_BUTTON(first_radio), text);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
841
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
842 if (first_radio == NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
843 first_radio = radio;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
844
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
845 gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
846 gtk_widget_show(radio);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
847
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
848 g_signal_connect(G_OBJECT(radio), "toggled",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
849 G_CALLBACK(field_choice_option_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
850 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
851 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
852
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
853 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
854 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
855
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
856 static GtkWidget *
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
857 create_account_field(GaimRequestField *field)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
858 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
859 GtkWidget *widget;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
860
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
861 widget = gaim_gtk_account_option_menu_new(
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
862 gaim_request_field_account_get_default_value(field),
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
863 gaim_request_field_account_get_show_all(field),
8289
e39ea2b4f6cd [gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents: 8286
diff changeset
864 G_CALLBACK(field_account_cb),
e39ea2b4f6cd [gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents: 8286
diff changeset
865 gaim_request_field_account_get_filter(field),
e39ea2b4f6cd [gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents: 8286
diff changeset
866 field);
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
867
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
868 return widget;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
869 }
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
870
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
871 static void
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
872 select_field_list_item(GtkTreeModel *model, GtkTreePath *path,
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
873 GtkTreeIter *iter, gpointer data)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
874 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
875 GaimRequestField *field = (GaimRequestField *)data;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
876 const char *text;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
877
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
878 gtk_tree_model_get(model, iter, 1, &text, -1);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
879
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
880 gaim_request_field_list_add_selected(field, text);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
881 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
882
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
883 static void
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
884 list_field_select_changed_cb(GtkTreeSelection *sel, GaimRequestField *field)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
885 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
886 gaim_request_field_list_clear_selected(field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
887
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
888 gtk_tree_selection_selected_foreach(sel, select_field_list_item, field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
889 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
890
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
891 static GtkWidget *
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
892 create_list_field(GaimRequestField *field)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
893 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
894 GtkWidget *sw;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
895 GtkWidget *treeview;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
896 GtkListStore *store;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
897 GtkCellRenderer *renderer;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
898 GtkTreeSelection *sel;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
899 GtkTreeViewColumn *column;
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
900 GtkTreeIter iter;
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
901 const GList *l;
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
902
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
903 /* Create the scrolled window */
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
904 sw = gtk_scrolled_window_new(NULL, NULL);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
905 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
8332
f4a878d48254 [gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents: 8323
diff changeset
906 GTK_POLICY_AUTOMATIC,
f4a878d48254 [gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents: 8323
diff changeset
907 GTK_POLICY_AUTOMATIC);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
908 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
909 GTK_SHADOW_IN);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
910 gtk_widget_show(sw);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
911
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
912 /* Create the list store */
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
913 store = gtk_list_store_new(2, G_TYPE_POINTER, G_TYPE_STRING);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
914
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
915 /* Create the tree view */
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
916 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
917 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
918 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
919
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
920 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
921
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
922 if (gaim_request_field_list_get_multi_select(field))
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
923 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
924
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
925 g_signal_connect(G_OBJECT(sel), "changed",
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
926 G_CALLBACK(list_field_select_changed_cb), field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
927
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
928 column = gtk_tree_view_column_new();
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
929 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
930
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
931 renderer = gtk_cell_renderer_text_new();
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
932 gtk_tree_view_column_pack_start(column, renderer, TRUE);
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
933 gtk_tree_view_column_add_attribute(column, renderer, "text", 1);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
934
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
935 for (l = gaim_request_field_list_get_items(field); l != NULL; l = l->next)
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
936 {
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
937 const char *text = (const char *)l->data;
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
938
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
939 gtk_list_store_append(store, &iter);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
940
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
941 gtk_list_store_set(store, &iter,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
942 0, gaim_request_field_list_get_data(field, text),
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
943 1, text,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
944 -1);
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
945
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
946 if (gaim_request_field_list_is_selected(field, text))
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
947 gtk_tree_selection_select_iter(sel, &iter);
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
948 }
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
949
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
950 gtk_container_add(GTK_CONTAINER(sw), treeview);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
951 gtk_widget_show(treeview);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
952
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
953 return sw;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
954 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
955
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
956 static void *
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
957 gaim_gtk_request_fields(const char *title, const char *primary,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
958 const char *secondary, GaimRequestFields *fields,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
959 const char *ok_text, GCallback ok_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
960 const char *cancel_text, GCallback cancel_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
961 void *user_data)
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
962 {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
963 GaimGtkRequestData *data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
964 GtkWidget *win;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
965 GtkWidget *vbox;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
966 GtkWidget *hbox;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
967 GtkWidget *bbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
968 GtkWidget *frame;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
969 GtkWidget *label;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
970 GtkWidget *table;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
971 GtkWidget *button;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
972 GtkWidget *img;
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
973 GtkSizeGroup *sg;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
974 GList *gl, *fl;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
975 GaimRequestFieldGroup *group;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
976 GaimRequestField *field;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
977 char *label_text;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
978
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
979 data = g_new0(GaimGtkRequestData, 1);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
980 data->type = GAIM_REQUEST_FIELDS;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
981 data->user_data = user_data;
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
982 data->u.multifield.fields = fields;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
983
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
984 fields->ui_data = data;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
985
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
986 data->cb_count = 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
987 data->cbs = g_new0(GCallback, 2);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
988
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
989 data->cbs[0] = ok_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
990 data->cbs[1] = cancel_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
991
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
992 data->dialog = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
993
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
994 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
995 gtk_window_set_title(GTK_WINDOW(win), title);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
996
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
997 gtk_window_set_role(GTK_WINDOW(win), "multifield");
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
998 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
999 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1000
8323
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1001 g_signal_connect(G_OBJECT(win), "delete_event",
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1002 G_CALLBACK(destroy_multifield_cb), data);
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1003
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1004 /* Setup the main horizontal box */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1005 hbox = gtk_hbox_new(FALSE, 12);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1006 gtk_container_add(GTK_CONTAINER(win), hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1007 gtk_widget_show(hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1008
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1009 /* Dialog icon. */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1010 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1011 GTK_ICON_SIZE_DIALOG);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1012 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1013 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1014 gtk_widget_show(img);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1015
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1016 /* Setup the vbox */
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1017 vbox = gtk_vbox_new(FALSE, 12);
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
1018 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1019 gtk_widget_show(vbox);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1020
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
1021 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
1022
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1023 if (primary != NULL || secondary != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1024 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1025 label_text = g_strdup_printf(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1026 (primary
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1027 ? "<span weight=\"bold\" size=\"larger\">"
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1028 "%s</span>%s%s"
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1029 : "%s%s%s"),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1030 (primary ? primary : ""),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1031 ((primary && secondary) ? "\n\n" : ""),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1032 (secondary ? secondary : ""));
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1033
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1034 label = gtk_label_new(NULL);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1035
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1036 gtk_label_set_markup(GTK_LABEL(label), label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1037 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1038 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1039 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
1040 gtk_widget_show(label);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1041
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1042 g_free(label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1043 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1044
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1045 for (gl = gaim_request_fields_get_groups(fields);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1046 gl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1047 gl = gl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1048 {
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
1049 GList *field_list;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1050 size_t field_count = 0;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1051 size_t cols = 1;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1052 size_t rows;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1053 size_t col_num;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1054 size_t row_num = 0;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1055
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
1056 group = gl->data;
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
1057 field_list = gaim_request_field_group_get_fields(group);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1058
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1059 if (gaim_request_field_group_get_title(group) != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1060 {
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
1061 frame = gaim_gtk_make_frame(vbox,
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
1062 gaim_request_field_group_get_title(group));
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
1063 }
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
1064 else
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
1065 frame = vbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1066
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
1067 field_count = g_list_length(field_list);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1068
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1069 if (field_count > 9)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1070 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1071 rows = field_count / 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1072 cols++;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1073 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1074 else
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1075 rows = field_count;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1076
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1077 col_num = 0;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1078
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1079 for (fl = field_list; fl != NULL; fl = fl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1080 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1081 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1082
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1083 field = (GaimRequestField *)fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1084
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1085 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1086
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1087 if (type == GAIM_REQUEST_FIELD_LABEL)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1088 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1089 if (col_num > 0)
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1090 rows++;
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1091
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1092 rows++;
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1093 }
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1094 else if (type == GAIM_REQUEST_FIELD_STRING &&
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1095 gaim_request_field_string_is_multiline(field))
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1096 {
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1097 if (col_num > 0)
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1098 rows++;
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1099
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1100 rows += 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1101 }
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1102
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1103 col_num++;
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1104
8323
4786adbe8720 [gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents: 8302
diff changeset
1105 if (col_num >= cols)
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1106 col_num = 0;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1107 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1108
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1109 table = gtk_table_new(rows, 2 * cols, FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1110 gtk_table_set_row_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1111 gtk_table_set_col_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1112
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1113 gtk_container_add(GTK_CONTAINER(frame), table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1114 gtk_widget_show(table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1115
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1116 for (row_num = 0, fl = field_list;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1117 row_num < rows && fl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1118 row_num++)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1119 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1120 for (col_num = 0;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1121 col_num < cols && fl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1122 col_num++, fl = fl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1123 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1124 size_t col_offset = col_num * 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1125 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1126 GtkWidget *widget = NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1127
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1128 field = fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1129
7922
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
1130 if (!gaim_request_field_is_visible(field)) {
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
1131 col_num--;
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
1132 continue;
7922
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
1133 }
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
1134
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1135 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1136
8332
f4a878d48254 [gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents: 8323
diff changeset
1137 if (type != GAIM_REQUEST_FIELD_BOOLEAN &&
f4a878d48254 [gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents: 8323
diff changeset
1138 gaim_request_field_get_label(field))
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1139 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1140 char *text;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1141
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1142 text = g_strdup_printf("%s:",
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1143 gaim_request_field_get_label(field));
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1144
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1145 label = gtk_label_new(NULL);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1146 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1147 g_free(text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1148
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1149 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1150
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1151 gtk_size_group_add_widget(sg, label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1152
7905
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
1153 if (type == GAIM_REQUEST_FIELD_LABEL ||
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
1154 (type == GAIM_REQUEST_FIELD_STRING &&
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
1155 gaim_request_field_string_is_multiline(field)))
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1156 {
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1157 if(col_num > 0)
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1158 row_num++;
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1159
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1160 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1161 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1162 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1163
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1164 row_num++;
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
1165 col_num=cols;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1166 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1167 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1168 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1169 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1170 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1171 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1172 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1173
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1174 gtk_widget_show(label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1175 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1176
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1177 if (type == GAIM_REQUEST_FIELD_STRING)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1178 widget = create_string_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1179 else if (type == GAIM_REQUEST_FIELD_INTEGER)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1180 widget = create_int_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1181 else if (type == GAIM_REQUEST_FIELD_BOOLEAN)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1182 widget = create_bool_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1183 else if (type == GAIM_REQUEST_FIELD_CHOICE)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1184 widget = create_choice_field(field);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
1185 else if (type == GAIM_REQUEST_FIELD_LIST)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
1186 widget = create_list_field(field);
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1187 else if (type == GAIM_REQUEST_FIELD_ACCOUNT)
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1188 widget = create_account_field(field);
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
1189 else
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
1190 continue;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1191
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1192 if (type == GAIM_REQUEST_FIELD_STRING &&
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1193 gaim_request_field_string_is_multiline(field))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1194 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1195 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1196 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1197 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1198 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1199 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1200 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1201 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1202 else if (type != GAIM_REQUEST_FIELD_BOOLEAN)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1203 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1204 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1205 col_offset + 1, col_offset + 2,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1206 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1207 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1208 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1209 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1210 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1211 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
1212 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1213 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1214 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1215 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1216 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1217 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1218 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1219 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1220
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1221 gtk_widget_show(widget);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1222
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1223 field->ui_data = widget;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1224 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
1225 }
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1226 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1227
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
1228 g_object_unref(sg);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
1229
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1230 /* Button box. */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1231 bbox = gtk_hbutton_box_new();
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1232 gtk_box_set_spacing(GTK_BOX(bbox), 6);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1233 gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1234 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1235 gtk_widget_show(bbox);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1236
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1237 /* Cancel button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1238 button = gtk_button_new_from_stock(text_to_stock(cancel_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1239 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1240 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1241
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1242 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1243 G_CALLBACK(multifield_cancel_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1244
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1245 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1246
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1247 /* OK button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1248 button = gtk_button_new_from_stock(text_to_stock(ok_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1249 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1250 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
1251
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1252 data->ok_button = button;
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1253
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1254 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1255 gtk_window_set_default(GTK_WINDOW(win), button);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1256
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1257 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1258 G_CALLBACK(multifield_ok_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1259
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1260 if (!gaim_request_fields_all_required_filled(fields))
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1261 gtk_widget_set_sensitive(button, FALSE);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1262
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1263 gtk_widget_show(win);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1264
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1265 return data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1266 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1267
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
1268 static void
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1269 gaim_gtk_close_request(GaimRequestType type, void *ui_handle)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1270 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1271 GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1272
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1273 if (data->cbs != NULL)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1274 g_free(data->cbs);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1275
8286
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1276 gtk_widget_destroy(data->dialog);
89d9d004e3f3 [gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents: 8137
diff changeset
1277
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1278 if (type == GAIM_REQUEST_FIELDS)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1279 gaim_request_fields_destroy(data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
1280
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1281 g_free(data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1282 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1283
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1284 static GaimRequestUiOps ops =
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1285 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1286 gaim_gtk_request_input,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1287 gaim_gtk_request_choice,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1288 gaim_gtk_request_action,
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1289 gaim_gtk_request_fields,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1290 gaim_gtk_close_request
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1291 };
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1292
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1293 GaimRequestUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
1294 gaim_gtk_request_get_ui_ops(void)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1295 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1296 return &ops;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1297 }