Mercurial > pidgin
annotate src/gtkrequest.c @ 13399:18d5d4018604
[gaim-migrate @ 15773]
Dereferencing the pointer-pointer to check if it's NULL. Oops, my bad.
Resolves CID 11
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 06 Mar 2006 17:01:32 +0000 |
parents | fb178093e364 |
children | ffd724befbf8 |
rev | line source |
---|---|
5480 | 1 /** |
2 * @file gtkrequest.c GTK+ Request API | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
10 * |
5480 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5846
diff
changeset
|
27 |
7066
87bfe52a4099
[gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents:
7048
diff
changeset
|
28 #include "prefs.h" |
11780 | 29 #include "util.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5846
diff
changeset
|
30 |
9709 | 31 #include "gtkimhtml.h" |
32 #include "gtkimhtmltoolbar.h" | |
5480 | 33 #include "gtkrequest.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5846
diff
changeset
|
34 #include "gtkutils.h" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10294
diff
changeset
|
35 #include "gtkstock.h" |
5480 | 36 |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
37 #include <gdk/gdkkeysyms.h> |
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
38 |
13360
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
39 static GtkWidget * create_account_field(GaimRequestField *field); |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
40 |
5480 | 41 typedef struct |
42 { | |
43 GaimRequestType type; | |
44 | |
45 void *user_data; | |
11177
3924db2b1ca8
[gaim-migrate @ 13285]
Richard Laager <rlaager@wiktel.com>
parents:
11071
diff
changeset
|
46 GtkWidget *dialog; |
5480 | 47 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
48 GtkWidget *ok_button; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
49 |
5480 | 50 size_t cb_count; |
51 GCallback *cbs; | |
52 | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
53 union |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
54 { |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
55 struct |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
56 { |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
57 GtkWidget *entry; |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
58 |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
59 gboolean multiline; |
8697 | 60 gchar *hint; |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
61 |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
62 } input; |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
63 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
64 struct |
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 GaimRequestFields *fields; |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
67 |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
68 } multifield; |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
69 |
9502 | 70 struct |
71 { | |
72 gboolean savedialog; | |
73 gchar *name; | |
74 | |
75 } file; | |
76 | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
77 } u; |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
78 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
79 } GaimGtkRequestData; |
5480 | 80 |
81 static void | |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
82 generic_response_start(GaimGtkRequestData *data) |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
83 { |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
84 GdkWindow *window = GTK_WIDGET(data->dialog)->window; |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
85 GdkCursor *cursor; |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
86 |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
87 /* Tell the user we're doing something. */ |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
88 cursor = gdk_cursor_new(GDK_WATCH); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
89 gdk_window_set_cursor(window, cursor); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
90 gdk_cursor_unref(cursor); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
91 while (gtk_events_pending()) |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
92 gtk_main_iteration(); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
93 |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
94 } |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
95 |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
96 static void |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
97 input_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data) |
5480 | 98 { |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
99 const char *value; |
7174 | 100 char *multiline_value = NULL; |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
101 |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
102 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
103 |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
104 if (data->u.input.multiline) { |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
105 GtkTextIter start_iter, end_iter; |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
106 GtkTextBuffer *buffer = |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
107 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
|
108 |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
109 gtk_text_buffer_get_start_iter(buffer, &start_iter); |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
110 gtk_text_buffer_get_end_iter(buffer, &end_iter); |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
111 |
8697 | 112 if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) |
113 multiline_value = gtk_imhtml_get_markup(GTK_IMHTML(data->u.input.entry)); | |
114 else | |
115 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
|
116 FALSE); |
8697 | 117 |
7172 | 118 value = multiline_value; |
5480 | 119 } |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
120 else |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
121 value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry)); |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
122 |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
123 if (id < data->cb_count && data->cbs[id] != NULL) |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
124 ((GaimRequestInputCb)data->cbs[id])(data->user_data, value); |
6110 | 125 else if (data->cbs[1] != NULL) |
6109 | 126 ((GaimRequestInputCb)data->cbs[1])(data->user_data, value); |
5480 | 127 |
7172 | 128 if (data->u.input.multiline) |
129 g_free(multiline_value); | |
130 | |
5480 | 131 gaim_request_close(GAIM_REQUEST_INPUT, data); |
132 } | |
133 | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
134 static void |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
135 action_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data) |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
136 { |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
137 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
138 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
139 if (id < data->cb_count && data->cbs[id] != NULL) |
5498
cce2d7868c78
[gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents:
5496
diff
changeset
|
140 ((GaimRequestActionCb)data->cbs[id])(data->user_data, id); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
141 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
142 gaim_request_close(GAIM_REQUEST_INPUT, data); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
143 } |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
144 |
10229 | 145 |
146 static void | |
147 choice_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data) | |
148 { | |
149 GtkWidget *radio = g_object_get_data(G_OBJECT(dialog), "radio"); | |
150 GSList *group = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio)); | |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
151 |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
152 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
153 |
10980
842a21e7480b
[gaim-migrate @ 12810]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10943
diff
changeset
|
154 if (id < data->cb_count && data->cbs[id] != NULL) |
10229 | 155 while (group) { |
156 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(group->data))) { | |
157 ((GaimRequestChoiceCb)data->cbs[id])(data->user_data, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(group->data), "choice_id"))); | |
158 break; | |
159 } | |
160 group = group->next; | |
161 } | |
162 gaim_request_close(GAIM_REQUEST_INPUT, data); | |
163 } | |
164 | |
5835
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
165 static gboolean |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
166 field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event, |
5846
4676b498ff4b
[gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents:
5845
diff
changeset
|
167 GaimRequestField *field) |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
168 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
169 const char *value; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
170 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
171 if (gaim_request_field_string_is_multiline(field)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
172 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
173 GtkTextBuffer *buffer; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
174 GtkTextIter start_iter, end_iter; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
175 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
176 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
177 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
178 gtk_text_buffer_get_start_iter(buffer, &start_iter); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
179 gtk_text_buffer_get_end_iter(buffer, &end_iter); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
180 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
181 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
|
182 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
183 else |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
184 value = gtk_entry_get_text(GTK_ENTRY(entry)); |
5834
77eba2e68d07
[gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents:
5832
diff
changeset
|
185 |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
186 gaim_request_field_string_set_value(field, |
5834
77eba2e68d07
[gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents:
5832
diff
changeset
|
187 (*value == '\0' ? NULL : value)); |
5835
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
188 |
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
189 return FALSE; |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
190 } |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
191 |
5835
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
192 static gboolean |
5846
4676b498ff4b
[gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents:
5845
diff
changeset
|
193 field_int_focus_out_cb(GtkEntry *entry, GdkEventFocus *event, |
4676b498ff4b
[gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents:
5845
diff
changeset
|
194 GaimRequestField *field) |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
195 { |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
196 gaim_request_field_int_set_value(field, |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
197 atoi(gtk_entry_get_text(entry))); |
5835
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
198 |
9a08899192ee
[gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents:
5834
diff
changeset
|
199 return FALSE; |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
200 } |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
201 |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
202 static void |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
203 field_bool_cb(GtkToggleButton *button, GaimRequestField *field) |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
204 { |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
205 gaim_request_field_bool_set_value(field, |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
206 gtk_toggle_button_get_active(button)); |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
207 } |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
208 |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
209 static void |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
210 field_choice_menu_cb(GtkOptionMenu *menu, GaimRequestField *field) |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
211 { |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
212 gaim_request_field_choice_set_value(field, |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
213 gtk_option_menu_get_history(menu)); |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
214 } |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
215 |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
216 static void |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
217 field_choice_option_cb(GtkRadioButton *button, GaimRequestField *field) |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
218 { |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
219 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
220 gaim_request_field_choice_set_value(field, |
10943 | 221 (g_slist_length(gtk_radio_button_get_group(button)) - |
222 g_slist_index(gtk_radio_button_get_group(button), button)) - 1); | |
5832
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
223 } |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
224 |
db204c4a411b
[gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents:
5817
diff
changeset
|
225 static void |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
226 field_account_cb(GObject *w, GaimAccount *account, GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
227 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
228 gaim_request_field_account_set_value(field, account); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
229 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
230 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
231 static void |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
232 multifield_ok_cb(GtkWidget *button, GaimGtkRequestData *data) |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
233 { |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
234 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
235 |
8521
4cfb32f78d71
[gaim-migrate @ 9260]
Christian Hammond <chipx86@chipx86.com>
parents:
8332
diff
changeset
|
236 if (!GTK_WIDGET_HAS_FOCUS(button)) |
4cfb32f78d71
[gaim-migrate @ 9260]
Christian Hammond <chipx86@chipx86.com>
parents:
8332
diff
changeset
|
237 gtk_widget_grab_focus(button); |
4cfb32f78d71
[gaim-migrate @ 9260]
Christian Hammond <chipx86@chipx86.com>
parents:
8332
diff
changeset
|
238 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
239 if (data->cbs[0] != NULL) |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
240 ((GaimRequestFieldsCb)data->cbs[0])(data->user_data, |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
241 data->u.multifield.fields); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
242 |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
243 gaim_request_close(GAIM_REQUEST_FIELDS, data); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
244 } |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
245 |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
246 static void |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
247 multifield_cancel_cb(GtkWidget *button, GaimGtkRequestData *data) |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
248 { |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
249 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
250 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
251 if (data->cbs[1] != NULL) |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
252 ((GaimRequestFieldsCb)data->cbs[1])(data->user_data, |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
253 data->u.multifield.fields); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
254 |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
255 gaim_request_close(GAIM_REQUEST_FIELDS, data); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
256 } |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
257 |
8323
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
258 static void |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
259 destroy_multifield_cb(GtkWidget *dialog, GdkEvent *event, |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
260 GaimGtkRequestData *data) |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
261 { |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
262 multifield_cancel_cb(NULL, data); |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
263 } |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
264 |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
265 |
5480 | 266 #define STOCK_ITEMIZE(r, l) \ |
267 if (!strcmp((r), text)) \ | |
268 return (l); | |
269 | |
270 static const char * | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
271 text_to_stock(const char *text) |
5480 | 272 { |
6334
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
273 STOCK_ITEMIZE(_("Yes"), GTK_STOCK_YES); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
274 STOCK_ITEMIZE(_("No"), GTK_STOCK_NO); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
275 STOCK_ITEMIZE(_("OK"), GTK_STOCK_OK); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
276 STOCK_ITEMIZE(_("Cancel"), GTK_STOCK_CANCEL); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
277 STOCK_ITEMIZE(_("Apply"), GTK_STOCK_APPLY); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
278 STOCK_ITEMIZE(_("Close"), GTK_STOCK_CLOSE); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
279 STOCK_ITEMIZE(_("Delete"), GTK_STOCK_DELETE); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
280 STOCK_ITEMIZE(_("Add"), GTK_STOCK_ADD); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
281 STOCK_ITEMIZE(_("Remove"), GTK_STOCK_REMOVE); |
930708df05dd
[gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents:
6326
diff
changeset
|
282 STOCK_ITEMIZE(_("Save"), GTK_STOCK_SAVE); |
8302
462ead6fc1a0
[gaim-migrate @ 9026]
Christian Hammond <chipx86@chipx86.com>
parents:
8294
diff
changeset
|
283 STOCK_ITEMIZE(_("Alias"), GAIM_STOCK_ALIAS); |
5480 | 284 |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
285 return text; |
5480 | 286 } |
287 | |
6363
b7ef10bbe9bb
[gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents:
6338
diff
changeset
|
288 static void * |
5480 | 289 gaim_gtk_request_input(const char *title, const char *primary, |
290 const char *secondary, const char *default_value, | |
8697 | 291 gboolean multiline, gboolean masked, gchar *hint, |
5480 | 292 const char *ok_text, GCallback ok_cb, |
293 const char *cancel_text, GCallback cancel_cb, | |
294 void *user_data) | |
295 { | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
296 GaimGtkRequestData *data; |
5480 | 297 GtkWidget *dialog; |
298 GtkWidget *vbox; | |
299 GtkWidget *hbox; | |
300 GtkWidget *label; | |
301 GtkWidget *entry; | |
302 GtkWidget *img; | |
8782
5a2b5e4abf3a
[gaim-migrate @ 9544]
Christian Hammond <chipx86@chipx86.com>
parents:
8697
diff
changeset
|
303 GtkWidget *toolbar; |
5480 | 304 char *label_text; |
10774 | 305 char *primary_esc, *secondary_esc; |
5480 | 306 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
307 data = g_new0(GaimGtkRequestData, 1); |
5480 | 308 data->type = GAIM_REQUEST_INPUT; |
309 data->user_data = user_data; | |
310 | |
311 data->cb_count = 2; | |
312 data->cbs = g_new0(GCallback, 2); | |
313 | |
314 data->cbs[0] = ok_cb; | |
315 data->cbs[1] = cancel_cb; | |
316 | |
317 /* Create the dialog. */ | |
7678 | 318 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE, |
319 NULL, 0, | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
320 text_to_stock(cancel_text), 1, |
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
321 text_to_stock(ok_text), 0, |
5485 | 322 NULL); |
5480 | 323 data->dialog = dialog; |
324 | |
325 g_signal_connect(G_OBJECT(dialog), "response", | |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
326 G_CALLBACK(input_response_cb), data); |
5480 | 327 |
328 /* Setup the dialog */ | |
11243 | 329 gtk_container_set_border_width(GTK_CONTAINER(dialog), GAIM_HIG_BORDER/2); |
330 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER/2); | |
5480 | 331 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
332 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
5510
da18a02c3705
[gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
333 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0); |
11243 | 334 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); |
5480 | 335 |
336 /* Setup the main horizontal box */ | |
11243 | 337 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
5480 | 338 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
339 | |
340 /* Dialog icon. */ | |
341 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, | |
342 GTK_ICON_SIZE_DIALOG); | |
343 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
344 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
345 | |
346 /* Vertical box */ | |
11243 | 347 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
5480 | 348 |
349 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); | |
350 | |
351 /* Descriptive label */ | |
10774 | 352 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
353 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
7843 | 354 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">" |
355 "%s</span>%s%s" : "%s%s%s"), | |
10774 | 356 (primary ? primary_esc : ""), |
7843 | 357 ((primary && secondary) ? "\n\n" : ""), |
10774 | 358 (secondary ? secondary_esc : "")); |
359 g_free(primary_esc); | |
360 g_free(secondary_esc); | |
5480 | 361 |
362 label = gtk_label_new(NULL); | |
363 | |
364 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
365 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
366 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
367 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); | |
368 | |
369 g_free(label_text); | |
370 | |
371 /* Entry field. */ | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
372 data->u.input.multiline = multiline; |
8697 | 373 data->u.input.hint = (hint == NULL ? NULL : g_strdup(hint)); |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
374 |
8697 | 375 if ((data->u.input.hint != NULL) && (!strcmp(data->u.input.hint, "html"))) { |
10146 | 376 GtkWidget *frame; |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
377 |
10181 | 378 /* imhtml */ |
13280
3de53fe8345f
[gaim-migrate @ 15646]
Richard Laager <rlaager@wiktel.com>
parents:
13269
diff
changeset
|
379 frame = gaim_gtk_create_imhtml(TRUE, &entry, &toolbar, NULL); |
10181 | 380 gtk_widget_set_size_request(entry, 320, 130); |
381 gtk_widget_set_name(entry, "gaim_gtkrequest_imhtml"); | |
382 if (default_value != NULL) | |
383 gtk_imhtml_append_text(GTK_IMHTML(entry), default_value, GTK_IMHTML_NO_SCROLL); | |
10146 | 384 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
385 gtk_widget_show(frame); | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
386 } |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
387 else { |
8697 | 388 if (multiline) { |
389 GtkWidget *sw; | |
390 | |
391 sw = gtk_scrolled_window_new(NULL, NULL); | |
392 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
393 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
394 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
395 GTK_SHADOW_IN); | |
396 | |
397 gtk_widget_set_size_request(sw, 320, 130); | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
398 |
8697 | 399 /* GtkTextView */ |
400 entry = gtk_text_view_new(); | |
401 gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE); | |
5510
da18a02c3705
[gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
402 |
8697 | 403 if (default_value != NULL) { |
404 GtkTextBuffer *buffer; | |
405 | |
406 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry)); | |
407 gtk_text_buffer_set_text(buffer, default_value, -1); | |
408 } | |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
409 |
8697 | 410 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR); |
411 | |
412 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
413 | |
414 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) | |
12067
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12061
diff
changeset
|
415 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(entry)); |
6035
8c44020a958e
[gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
416 |
8697 | 417 gtk_container_add(GTK_CONTAINER(sw), entry); |
418 } | |
419 else { | |
420 entry = gtk_entry_new(); | |
421 | |
422 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); | |
423 | |
424 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0); | |
425 | |
426 if (default_value != NULL) | |
427 gtk_entry_set_text(GTK_ENTRY(entry), default_value); | |
428 | |
429 if (masked) | |
11986 | 430 { |
8697 | 431 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
11986 | 432 gtk_entry_set_invisible_char(GTK_ENTRY(entry), GAIM_INVISIBLE_CHAR); |
433 } | |
8697 | 434 } |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
435 } |
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
436 |
8137 | 437 gaim_set_accessible_label (entry, label); |
5490
421020171808
[gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents:
5485
diff
changeset
|
438 data->u.input.entry = entry; |
5480 | 439 |
440 /* Show everything. */ | |
441 gtk_widget_show_all(dialog); | |
442 | |
443 return data; | |
444 } | |
445 | |
6363
b7ef10bbe9bb
[gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents:
6338
diff
changeset
|
446 static void * |
5480 | 447 gaim_gtk_request_choice(const char *title, const char *primary, |
10229 | 448 const char *secondary, unsigned int default_value, |
449 const char *ok_text, GCallback ok_cb, | |
450 const char *cancel_text, GCallback cancel_cb, | |
451 void *user_data, va_list args) | |
5480 | 452 { |
10229 | 453 GaimGtkRequestData *data; |
454 GtkWidget *dialog; | |
455 GtkWidget *vbox, *vbox2; | |
456 GtkWidget *hbox; | |
457 GtkWidget *label; | |
458 GtkWidget *img; | |
459 GtkWidget *radio = NULL; | |
460 char *label_text; | |
461 char *radio_text; | |
10774 | 462 char *primary_esc, *secondary_esc; |
10233 | 463 |
10229 | 464 data = g_new0(GaimGtkRequestData, 1); |
465 data->type = GAIM_REQUEST_ACTION; | |
466 data->user_data = user_data; | |
467 | |
468 data->cb_count = 2; | |
469 data->cbs = g_new0(GCallback, 2); | |
470 data->cbs[0] = cancel_cb; | |
471 data->cbs[1] = ok_cb; | |
472 | |
473 /* Create the dialog. */ | |
474 data->dialog = dialog = gtk_dialog_new(); | |
475 | |
476 if (title != NULL) | |
477 gtk_window_set_title(GTK_WINDOW(dialog), title); | |
478 | |
479 | |
480 gtk_dialog_add_button(GTK_DIALOG(dialog), | |
481 text_to_stock(cancel_text), 0); | |
10233 | 482 |
10229 | 483 gtk_dialog_add_button(GTK_DIALOG(dialog), |
484 text_to_stock(ok_text), 1); | |
485 | |
486 g_signal_connect(G_OBJECT(dialog), "response", | |
487 G_CALLBACK(choice_response_cb), data); | |
488 | |
489 /* Setup the dialog */ | |
11243 | 490 gtk_container_set_border_width(GTK_CONTAINER(dialog), GAIM_HIG_BORDER/2); |
491 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER/2); | |
10229 | 492 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
493 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); | |
11243 | 494 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); |
10229 | 495 |
496 /* Setup the main horizontal box */ | |
11243 | 497 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
10229 | 498 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
499 | |
500 /* Dialog icon. */ | |
501 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, | |
502 GTK_ICON_SIZE_DIALOG); | |
503 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); | |
504 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); | |
505 | |
506 /* Vertical box */ | |
11243 | 507 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
10229 | 508 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
10233 | 509 |
10229 | 510 /* Descriptive label */ |
10774 | 511 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
512 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
10229 | 513 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">" |
514 "%s</span>%s%s" : "%s%s%s"), | |
10774 | 515 (primary ? primary_esc : ""), |
10229 | 516 ((primary && secondary) ? "\n\n" : ""), |
10774 | 517 (secondary ? secondary_esc : "")); |
518 g_free(primary_esc); | |
519 g_free(secondary_esc); | |
10233 | 520 |
10229 | 521 label = gtk_label_new(NULL); |
522 | |
523 gtk_label_set_markup(GTK_LABEL(label), label_text); | |
524 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
525 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
526 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); | |
527 | |
528 g_free(label_text); | |
10233 | 529 |
11243 | 530 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
10229 | 531 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); |
532 while ((radio_text = va_arg(args, char*))) { | |
533 int resp = va_arg(args, int); | |
534 radio = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(radio), radio_text); | |
535 gtk_box_pack_start(GTK_BOX(vbox2), radio, FALSE, FALSE, 0); | |
536 g_object_set_data(G_OBJECT(radio), "choice_id", GINT_TO_POINTER(resp)); | |
537 if (resp == default_value) | |
538 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); | |
539 } | |
10233 | 540 |
10229 | 541 g_object_set_data(G_OBJECT(dialog), "radio", radio); |
542 | |
543 /* Show everything. */ | |
544 gtk_widget_show_all(dialog); | |
545 | |
546 return data; | |
5480 | 547 } |
548 | |
6363
b7ef10bbe9bb
[gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents:
6338
diff
changeset
|
549 static void * |
5480 | 550 gaim_gtk_request_action(const char *title, const char *primary, |
551 const char *secondary, unsigned int default_action, | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
552 void *user_data, size_t action_count, va_list actions) |
5480 | 553 { |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
554 GaimGtkRequestData *data; |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
555 GtkWidget *dialog; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
556 GtkWidget *vbox; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
557 GtkWidget *hbox; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
558 GtkWidget *label; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
559 GtkWidget *img; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
560 void **buttons; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
561 char *label_text; |
10774 | 562 char *primary_esc, *secondary_esc; |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
563 int i; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
564 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
565 data = g_new0(GaimGtkRequestData, 1); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
566 data->type = GAIM_REQUEST_ACTION; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
567 data->user_data = user_data; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
568 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
569 data->cb_count = action_count; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
570 data->cbs = g_new0(GCallback, action_count); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
571 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
572 /* Reverse the buttons */ |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
573 buttons = g_new0(void *, action_count * 2); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
574 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
575 for (i = 0; i < action_count * 2; i += 2) { |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
576 buttons[(action_count * 2) - i - 2] = va_arg(actions, char *); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
577 buttons[(action_count * 2) - i - 1] = va_arg(actions, GCallback); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
578 } |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
579 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
580 /* Create the dialog. */ |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
581 data->dialog = dialog = gtk_dialog_new(); |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6363
diff
changeset
|
582 |
6109 | 583 if (title != NULL) |
584 gtk_window_set_title(GTK_WINDOW(dialog), title); | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
585 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
586 for (i = 0; i < action_count; i++) { |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
587 gtk_dialog_add_button(GTK_DIALOG(dialog), |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
588 text_to_stock(buttons[2 * i]), i); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
589 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
590 data->cbs[i] = buttons[2 * i + 1]; |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
591 } |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
592 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
593 g_free(buttons); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
594 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
595 g_signal_connect(G_OBJECT(dialog), "response", |
5794
5e93fc46d1af
[gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents:
5510
diff
changeset
|
596 G_CALLBACK(action_response_cb), data); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
597 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
598 /* Setup the dialog */ |
11243 | 599 gtk_container_set_border_width(GTK_CONTAINER(dialog), GAIM_HIG_BORDER/2); |
600 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER/2); | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
601 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
602 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); |
11243 | 603 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), GAIM_HIG_BORDER); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
604 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
605 /* Setup the main horizontal box */ |
11243 | 606 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
607 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
608 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
609 /* Dialog icon. */ |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
610 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
611 GTK_ICON_SIZE_DIALOG); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
612 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
613 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
614 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
615 /* Vertical box */ |
11243 | 616 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
617 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
618 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
619 /* Descriptive label */ |
10774 | 620 primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; |
621 secondary_esc = (secondary != NULL) ? g_markup_escape_text(secondary, -1) : NULL; | |
7843 | 622 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">" |
623 "%s</span>%s%s" : "%s%s%s"), | |
10774 | 624 (primary ? primary_esc : ""), |
7843 | 625 ((primary && secondary) ? "\n\n" : ""), |
10774 | 626 (secondary ? secondary_esc : "")); |
627 g_free(primary_esc); | |
628 g_free(secondary_esc); | |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
629 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
630 label = gtk_label_new(NULL); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
631 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
632 gtk_label_set_markup(GTK_LABEL(label), label_text); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
633 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
634 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
635 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
636 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
637 g_free(label_text); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
638 |
9948 | 639 |
12286
255e6912607b
[gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12234
diff
changeset
|
640 if (default_action == GAIM_DEFAULT_ACTION_NONE) { |
10418 | 641 GTK_WIDGET_SET_FLAGS(img, GTK_CAN_DEFAULT); |
642 GTK_WIDGET_SET_FLAGS(img, GTK_CAN_FOCUS); | |
9948 | 643 gtk_widget_grab_focus(img); |
644 gtk_widget_grab_default(img); | |
12286
255e6912607b
[gaim-migrate @ 14590]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12234
diff
changeset
|
645 } else |
5510
da18a02c3705
[gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
646 gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action); |
da18a02c3705
[gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
647 |
5496
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
648 /* Show everything. */ |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
649 gtk_widget_show_all(dialog); |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
650 |
b7c0be69c749
[gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents:
5490
diff
changeset
|
651 return data; |
5480 | 652 } |
653 | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
654 static void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
655 req_entry_field_changed_cb(GtkWidget *entry, GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
656 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
657 GaimGtkRequestData *req_data; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
658 const char *text = gtk_entry_get_text(GTK_ENTRY(entry)); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
659 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
660 gaim_request_field_string_set_value(field, (*text == '\0' ? NULL : text)); |
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 req_data = (GaimGtkRequestData *)field->group->fields_list->ui_data; |
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 gtk_widget_set_sensitive(req_data->ok_button, |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
665 gaim_request_fields_all_required_filled(field->group->fields_list)); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
666 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
667 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
668 static void |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
669 setup_entry_field(GtkWidget *entry, GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
670 { |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
671 const char *type_hint; |
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
672 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
673 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
674 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
675 if (gaim_request_field_is_required(field)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
676 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
677 g_signal_connect(G_OBJECT(entry), "changed", |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
678 G_CALLBACK(req_entry_field_changed_cb), field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
679 } |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
680 |
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
681 if ((type_hint = gaim_request_field_get_type_hint(field)) != NULL) |
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
682 { |
13360
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
683 if (gaim_str_has_prefix(type_hint, "screenname")) |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
684 { |
13360
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
685 GtkWidget *optmenu = NULL; |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
686 GList *fields = field->group->fields; |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
687 while (fields) |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
688 { |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
689 GaimRequestField *fld = fields->data; |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
690 fields = fields->next; |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
691 |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
692 if (gaim_request_field_get_type(fld) == GAIM_REQUEST_FIELD_ACCOUNT) |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
693 { |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
694 const char *type_hint = gaim_request_field_get_type_hint(fld); |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
695 if (type_hint != NULL && strcmp(type_hint, "account") == 0) |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
696 { |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
697 if (fld->ui_data == NULL) |
13361
9b4a80566fd5
[gaim-migrate @ 15734]
Richard Laager <rlaager@wiktel.com>
parents:
13360
diff
changeset
|
698 fld->ui_data = create_account_field(fld); |
13360
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
699 optmenu = GTK_WIDGET(fld->ui_data); |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
700 break; |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
701 } |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
702 } |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
703 } |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
704 gaim_gtk_setup_screenname_autocomplete(entry, optmenu, !strcmp(type_hint, "screenname-all")); |
8294
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
705 } |
d5e59ea083be
[gaim-migrate @ 9018]
Christian Hammond <chipx86@chipx86.com>
parents:
8289
diff
changeset
|
706 } |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
707 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
708 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
709 static GtkWidget * |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
710 create_string_field(GaimRequestField *field) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
711 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
712 const char *value; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
713 GtkWidget *widget; |
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 value = gaim_request_field_string_get_default_value(field); |
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 if (gaim_request_field_string_is_multiline(field)) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
718 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
719 GtkWidget *textview; |
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 widget = gtk_scrolled_window_new(NULL, NULL); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
722 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
723 GTK_SHADOW_IN); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
724 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget), |
8916 | 725 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
726 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
727 textview = gtk_text_view_new(); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
728 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
729 TRUE); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
730 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
731 GTK_WRAP_WORD_CHAR); |
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 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) |
12067
e859c1663a27
[gaim-migrate @ 14362]
Richard Laager <rlaager@wiktel.com>
parents:
12061
diff
changeset
|
734 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(textview)); |
7900
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_container_add(GTK_CONTAINER(widget), textview); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
737 gtk_widget_show(textview); |
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 gtk_widget_set_size_request(widget, -1, 75); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
740 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
741 if (value != NULL) |
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 GtkTextBuffer *buffer; |
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 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
746 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
747 gtk_text_buffer_set_text(buffer, value, -1); |
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 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
750 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
751 gaim_request_field_string_is_editable(field)); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
752 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
753 g_signal_connect(G_OBJECT(textview), "focus-out-event", |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
754 G_CALLBACK(field_string_focus_out_cb), field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
755 } |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
756 else |
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 widget = gtk_entry_new(); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
759 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
760 setup_entry_field(widget, field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
761 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
762 if (value != NULL) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
763 gtk_entry_set_text(GTK_ENTRY(widget), value); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
764 |
11986 | 765 if (gaim_request_field_string_is_masked(field)) |
766 { | |
767 gtk_entry_set_visibility(GTK_ENTRY(widget), FALSE); | |
768 gtk_entry_set_invisible_char(GTK_ENTRY(widget), GAIM_INVISIBLE_CHAR); | |
769 } | |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
770 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
771 gtk_editable_set_editable(GTK_EDITABLE(widget), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
772 gaim_request_field_string_is_editable(field)); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
773 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
774 g_signal_connect(G_OBJECT(widget), "focus-out-event", |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
775 G_CALLBACK(field_string_focus_out_cb), field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
776 } |
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 return widget; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
779 } |
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 static GtkWidget * |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
782 create_int_field(GaimRequestField *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 int value; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
785 GtkWidget *widget; |
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 widget = gtk_entry_new(); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
788 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
789 setup_entry_field(widget, field); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
790 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
791 value = gaim_request_field_int_get_default_value(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 if (value != 0) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
794 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
795 char buf[32]; |
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 g_snprintf(buf, sizeof(buf), "%d", value); |
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 gtk_entry_set_text(GTK_ENTRY(widget), buf); |
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 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
802 g_signal_connect(G_OBJECT(widget), "focus-out-event", |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
803 G_CALLBACK(field_int_focus_out_cb), field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
804 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
805 return widget; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
806 } |
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 static GtkWidget * |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
809 create_bool_field(GaimRequestField *field) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
810 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
811 GtkWidget *widget; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
812 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
813 widget = gtk_check_button_new_with_label( |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
814 gaim_request_field_get_label(field)); |
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_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget), |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
817 gaim_request_field_bool_get_default_value(field)); |
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), "toggled", |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
820 G_CALLBACK(field_bool_cb), field); |
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 return widget; |
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 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
825 static GtkWidget * |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
826 create_choice_field(GaimRequestField *field) |
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 GtkWidget *widget; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
829 GList *labels; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
830 GList *l; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
831 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
832 labels = gaim_request_field_choice_get_labels(field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
833 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
834 if (g_list_length(labels) > 5) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
835 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
836 GtkWidget *menu; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
837 GtkWidget *item; |
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 widget = gtk_option_menu_new(); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
840 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
841 menu = gtk_menu_new(); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
842 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
843 for (l = labels; l != NULL; l = l->next) |
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 const char *text = l->data; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
846 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
847 item = gtk_menu_item_new_with_label(text); |
10294
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
848 gtk_widget_show(item); |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
849 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
850 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); |
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 |
10294
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
853 gtk_widget_show(menu); |
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
854 gtk_option_menu_set_menu(GTK_OPTION_MENU(widget), menu); |
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
855 gtk_option_menu_set_history(GTK_OPTION_MENU(widget), |
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
856 gaim_request_field_choice_get_default_value(field)); |
6484242e4e30
[gaim-migrate @ 11473]
Luke Schierer <lschiere@pidgin.im>
parents:
10233
diff
changeset
|
857 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
858 g_signal_connect(G_OBJECT(widget), "changed", |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
859 G_CALLBACK(field_choice_menu_cb), field); |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
860 } |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
861 else |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
862 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
863 GtkWidget *box; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
864 GtkWidget *first_radio = NULL; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
865 GtkWidget *radio; |
10943 | 866 gint i; |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
867 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
868 if (g_list_length(labels) == 2) |
11243 | 869 box = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
870 else |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
871 box = gtk_vbox_new(FALSE, 0); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
872 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
873 widget = box; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
874 |
10943 | 875 for (l = labels, i = 0; l != NULL; l = l->next, i++) |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
876 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
877 const char *text = l->data; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
878 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
879 radio = gtk_radio_button_new_with_label_from_widget( |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
880 GTK_RADIO_BUTTON(first_radio), text); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
881 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
882 if (first_radio == NULL) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
883 first_radio = radio; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
884 |
10943 | 885 if (i == gaim_request_field_choice_get_default_value(field)) |
886 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(radio), TRUE); | |
887 | |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
888 gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
889 gtk_widget_show(radio); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
890 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
891 g_signal_connect(G_OBJECT(radio), "toggled", |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
892 G_CALLBACK(field_choice_option_cb), field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
893 } |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
894 } |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
895 |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
896 return widget; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
897 } |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
898 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
899 static GtkWidget * |
11357 | 900 create_image_field(GaimRequestField *field) |
901 { | |
902 GtkWidget *widget; | |
903 GdkPixbuf *buf, *scale; | |
904 GdkPixbufLoader *loader; | |
905 | |
906 loader = gdk_pixbuf_loader_new(); | |
907 gdk_pixbuf_loader_write(loader, | |
908 (const guchar *)gaim_request_field_image_get_buffer(field), | |
909 gaim_request_field_image_get_size(field), | |
910 NULL); | |
911 gdk_pixbuf_loader_close(loader, NULL); | |
912 buf = gdk_pixbuf_loader_get_pixbuf(loader); | |
913 | |
914 scale = gdk_pixbuf_scale_simple(buf, | |
915 gaim_request_field_image_get_scale_x(field) * gdk_pixbuf_get_width(buf), | |
916 gaim_request_field_image_get_scale_y(field) * gdk_pixbuf_get_height(buf), | |
917 GDK_INTERP_BILINEAR); | |
918 widget = gtk_image_new_from_pixbuf(scale); | |
919 g_object_unref(G_OBJECT(buf)); | |
920 g_object_unref(G_OBJECT(scale)); | |
921 | |
922 return widget; | |
923 } | |
924 | |
925 static GtkWidget * | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
926 create_account_field(GaimRequestField *field) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
927 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
928 GtkWidget *widget; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
929 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
930 widget = gaim_gtk_account_option_menu_new( |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
931 gaim_request_field_account_get_default_value(field), |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
932 gaim_request_field_account_get_show_all(field), |
8289
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
933 G_CALLBACK(field_account_cb), |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
934 gaim_request_field_account_get_filter(field), |
e39ea2b4f6cd
[gaim-migrate @ 9013]
Christian Hammond <chipx86@chipx86.com>
parents:
8286
diff
changeset
|
935 field); |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
936 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
937 return widget; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
938 } |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
939 |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
940 static void |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
941 select_field_list_item(GtkTreeModel *model, GtkTreePath *path, |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
942 GtkTreeIter *iter, gpointer data) |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
943 { |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
944 GaimRequestField *field = (GaimRequestField *)data; |
13355
d278dac585a5
[gaim-migrate @ 15728]
Richard Laager <rlaager@wiktel.com>
parents:
13282
diff
changeset
|
945 char *text; |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
946 |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
947 gtk_tree_model_get(model, iter, 1, &text, -1); |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
948 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
949 gaim_request_field_list_add_selected(field, text); |
13355
d278dac585a5
[gaim-migrate @ 15728]
Richard Laager <rlaager@wiktel.com>
parents:
13282
diff
changeset
|
950 g_free(text); |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
951 } |
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 static void |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
954 list_field_select_changed_cb(GtkTreeSelection *sel, GaimRequestField *field) |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
955 { |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
956 gaim_request_field_list_clear_selected(field); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
957 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
958 gtk_tree_selection_selected_foreach(sel, select_field_list_item, field); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
959 } |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
960 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
961 static GtkWidget * |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
962 create_list_field(GaimRequestField *field) |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
963 { |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
964 GtkWidget *sw; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
965 GtkWidget *treeview; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
966 GtkListStore *store; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
967 GtkCellRenderer *renderer; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
968 GtkTreeSelection *sel; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
969 GtkTreeViewColumn *column; |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
970 GtkTreeIter iter; |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
971 const GList *l; |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
972 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
973 /* Create the scrolled window */ |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
974 sw = gtk_scrolled_window_new(NULL, NULL); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
975 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
8332
f4a878d48254
[gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents:
8323
diff
changeset
|
976 GTK_POLICY_AUTOMATIC, |
f4a878d48254
[gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents:
8323
diff
changeset
|
977 GTK_POLICY_AUTOMATIC); |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
978 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
979 GTK_SHADOW_IN); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
980 gtk_widget_show(sw); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
981 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
982 /* Create the list store */ |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
983 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
|
984 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
985 /* Create the tree view */ |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
986 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
987 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
988 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
989 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
990 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
991 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
992 if (gaim_request_field_list_get_multi_select(field)) |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
993 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
994 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
995 g_signal_connect(G_OBJECT(sel), "changed", |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
996 G_CALLBACK(list_field_select_changed_cb), field); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
997 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
998 column = gtk_tree_view_column_new(); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
999 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1000 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1001 renderer = gtk_cell_renderer_text_new(); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1002 gtk_tree_view_column_pack_start(column, renderer, TRUE); |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1003 gtk_tree_view_column_add_attribute(column, renderer, "text", 1); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1004 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1005 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
|
1006 { |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1007 const char *text = (const char *)l->data; |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1008 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1009 gtk_list_store_append(store, &iter); |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1010 |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1011 gtk_list_store_set(store, &iter, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1012 0, gaim_request_field_list_get_data(field, text), |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1013 1, text, |
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1014 -1); |
7964
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7951
diff
changeset
|
1015 |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7951
diff
changeset
|
1016 if (gaim_request_field_list_is_selected(field, text)) |
a5c70e43ee43
[gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents:
7951
diff
changeset
|
1017 gtk_tree_selection_select_iter(sel, &iter); |
7909
5be22af4ebfc
[gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents:
7905
diff
changeset
|
1018 } |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1019 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1020 gtk_container_add(GTK_CONTAINER(sw), treeview); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1021 gtk_widget_show(treeview); |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1022 |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1023 return sw; |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1024 } |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1025 |
6363
b7ef10bbe9bb
[gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents:
6338
diff
changeset
|
1026 static void * |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1027 gaim_gtk_request_fields(const char *title, const char *primary, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1028 const char *secondary, GaimRequestFields *fields, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1029 const char *ok_text, GCallback ok_cb, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1030 const char *cancel_text, GCallback cancel_cb, |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1031 void *user_data) |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1032 { |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1033 GaimGtkRequestData *data; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1034 GtkWidget *win; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1035 GtkWidget *vbox; |
8524 | 1036 GtkWidget *vbox2; |
6326
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1037 GtkWidget *hbox; |
5815
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1038 GtkWidget *bbox; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1039 GtkWidget *frame; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1040 GtkWidget *label; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1041 GtkWidget *table; |
5815
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1042 GtkWidget *button; |
6326
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1043 GtkWidget *img; |
8524 | 1044 GtkWidget *sw; |
5813
b116f3a73256
[gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
1045 GtkSizeGroup *sg; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1046 GList *gl, *fl; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1047 GaimRequestFieldGroup *group; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1048 GaimRequestField *field; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1049 char *label_text; |
10774 | 1050 char *primary_esc, *secondary_esc; |
8524 | 1051 int total_fields = 0; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1052 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1053 data = g_new0(GaimGtkRequestData, 1); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1054 data->type = GAIM_REQUEST_FIELDS; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1055 data->user_data = user_data; |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1056 data->u.multifield.fields = fields; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1057 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1058 fields->ui_data = data; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1059 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1060 data->cb_count = 2; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1061 data->cbs = g_new0(GCallback, 2); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1062 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1063 data->cbs[0] = ok_cb; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1064 data->cbs[1] = cancel_cb; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1065 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1066 data->dialog = win = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
6325
de67cb0dd09d
[gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents:
6324
diff
changeset
|
1067 |
6109 | 1068 if (title != NULL) |
1069 gtk_window_set_title(GTK_WINDOW(win), title); | |
6325
de67cb0dd09d
[gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents:
6324
diff
changeset
|
1070 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1071 gtk_window_set_role(GTK_WINDOW(win), "multifield"); |
11243 | 1072 gtk_container_set_border_width(GTK_CONTAINER(win), GAIM_HIG_BORDER); |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1073 gtk_window_set_resizable(GTK_WINDOW(win), FALSE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1074 |
8323
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
1075 g_signal_connect(G_OBJECT(win), "delete_event", |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
1076 G_CALLBACK(destroy_multifield_cb), data); |
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
1077 |
6326
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1078 /* Setup the main horizontal box */ |
11243 | 1079 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BORDER); |
6326
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1080 gtk_container_add(GTK_CONTAINER(win), hbox); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1081 gtk_widget_show(hbox); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1082 |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1083 /* Dialog icon. */ |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1084 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION, |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1085 GTK_ICON_SIZE_DIALOG); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1086 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1087 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1088 gtk_widget_show(img); |
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1089 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1090 /* Setup the vbox */ |
11243 | 1091 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
6326
f6480d79cb89
[gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents:
6325
diff
changeset
|
1092 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
|
1093 gtk_widget_show(vbox); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1094 |
5813
b116f3a73256
[gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
1095 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
b116f3a73256
[gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
1096 |
8524 | 1097 if(primary) { |
10774 | 1098 primary_esc = g_markup_escape_text(primary, -1); |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1099 label_text = g_strdup_printf( |
10774 | 1100 "<span weight=\"bold\" size=\"larger\">%s</span>", primary_esc); |
1101 g_free(primary_esc); | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1102 label = gtk_label_new(NULL); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1103 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1104 gtk_label_set_markup(GTK_LABEL(label), label_text); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1105 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1106 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1107 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
|
1108 gtk_widget_show(label); |
8524 | 1109 g_free(label_text); |
1110 } | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1111 |
8524 | 1112 for (gl = gaim_request_fields_get_groups(fields); gl != NULL; |
1113 gl = gl->next) | |
1114 total_fields += g_list_length(gaim_request_field_group_get_fields(gl->data)); | |
1115 | |
1116 if(total_fields > 9) { | |
1117 sw = gtk_scrolled_window_new(NULL, NULL); | |
1118 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), | |
1119 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1120 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), | |
1121 GTK_SHADOW_NONE); | |
1122 gtk_widget_set_size_request(sw, -1, 200); | |
1123 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1124 gtk_widget_show(sw); | |
1125 | |
11243 | 1126 vbox2 = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
8524 | 1127 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), vbox2); |
1128 gtk_widget_show(vbox2); | |
1129 } else { | |
1130 vbox2 = vbox; | |
1131 } | |
1132 | |
1133 if (secondary) { | |
10774 | 1134 secondary_esc = g_markup_escape_text(secondary, -1); |
8524 | 1135 label = gtk_label_new(NULL); |
1136 | |
10774 | 1137 gtk_label_set_markup(GTK_LABEL(label), secondary_esc); |
1138 g_free(secondary_esc); | |
8524 | 1139 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); |
1140 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1141 gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0); | |
1142 gtk_widget_show(label); | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1143 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1144 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1145 for (gl = gaim_request_fields_get_groups(fields); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1146 gl != NULL; |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1147 gl = gl->next) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1148 { |
5816
64a164aa6f70
[gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents:
5815
diff
changeset
|
1149 GList *field_list; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1150 size_t field_count = 0; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1151 size_t cols = 1; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1152 size_t rows; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1153 size_t col_num; |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1154 size_t row_num = 0; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1155 |
5816
64a164aa6f70
[gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents:
5815
diff
changeset
|
1156 group = gl->data; |
64a164aa6f70
[gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents:
5815
diff
changeset
|
1157 field_list = gaim_request_field_group_get_fields(group); |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1158 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1159 if (gaim_request_field_group_get_title(group) != NULL) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1160 { |
8524 | 1161 frame = gaim_gtk_make_frame(vbox2, |
6324
01ce15fb27eb
[gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents:
6110
diff
changeset
|
1162 gaim_request_field_group_get_title(group)); |
01ce15fb27eb
[gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents:
6110
diff
changeset
|
1163 } |
6325
de67cb0dd09d
[gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents:
6324
diff
changeset
|
1164 else |
8524 | 1165 frame = vbox2; |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1166 |
5816
64a164aa6f70
[gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents:
5815
diff
changeset
|
1167 field_count = g_list_length(field_list); |
8524 | 1168 /* |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1169 if (field_count > 9) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1170 { |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1171 rows = field_count / 2; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1172 cols++; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1173 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1174 else |
8524 | 1175 */ |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1176 rows = field_count; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1177 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1178 col_num = 0; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1179 |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1180 for (fl = field_list; fl != NULL; fl = fl->next) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1181 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1182 GaimRequestFieldType type; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1183 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1184 field = (GaimRequestField *)fl->data; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1185 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1186 type = gaim_request_field_get_type(field); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1187 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1188 if (type == GAIM_REQUEST_FIELD_LABEL) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1189 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1190 if (col_num > 0) |
7921 | 1191 rows++; |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1192 |
7921 | 1193 rows++; |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1194 } |
10627
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1195 else if ((type == GAIM_REQUEST_FIELD_LIST) || |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1196 (type == GAIM_REQUEST_FIELD_STRING && |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1197 gaim_request_field_string_is_multiline(field))) |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1198 { |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1199 if (col_num > 0) |
7921 | 1200 rows++; |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1201 |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1202 rows += 2; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1203 } |
7921 | 1204 |
1205 col_num++; | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1206 |
8323
4786adbe8720
[gaim-migrate @ 9047]
Christian Hammond <chipx86@chipx86.com>
parents:
8302
diff
changeset
|
1207 if (col_num >= cols) |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1208 col_num = 0; |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1209 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1210 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1211 table = gtk_table_new(rows, 2 * cols, FALSE); |
11243 | 1212 gtk_table_set_row_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE); |
1213 gtk_table_set_col_spacings(GTK_TABLE(table), GAIM_HIG_BOX_SPACE); | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1214 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1215 gtk_container_add(GTK_CONTAINER(frame), table); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1216 gtk_widget_show(table); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1217 |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1218 for (row_num = 0, fl = field_list; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1219 row_num < rows && fl != NULL; |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1220 row_num++) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1221 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1222 for (col_num = 0; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1223 col_num < cols && fl != NULL; |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1224 col_num++, fl = fl->next) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1225 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1226 size_t col_offset = col_num * 2; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1227 GaimRequestFieldType type; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1228 GtkWidget *widget = NULL; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1229 |
12666
8765dee8f517
[gaim-migrate @ 15009]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
1230 label = NULL; |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1231 field = fl->data; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1232 |
7922 | 1233 if (!gaim_request_field_is_visible(field)) { |
1234 col_num--; | |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7903
diff
changeset
|
1235 continue; |
7922 | 1236 } |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7903
diff
changeset
|
1237 |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1238 type = gaim_request_field_get_type(field); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1239 |
8332
f4a878d48254
[gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents:
8323
diff
changeset
|
1240 if (type != GAIM_REQUEST_FIELD_BOOLEAN && |
f4a878d48254
[gaim-migrate @ 9056]
Christian Hammond <chipx86@chipx86.com>
parents:
8323
diff
changeset
|
1241 gaim_request_field_get_label(field)) |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1242 { |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1243 char *text; |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1244 |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1245 text = g_strdup_printf("%s:", |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1246 gaim_request_field_get_label(field)); |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1247 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1248 label = gtk_label_new(NULL); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1249 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1250 g_free(text); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1251 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1252 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1253 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1254 gtk_size_group_add_widget(sg, label); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1255 |
7905
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
1256 if (type == GAIM_REQUEST_FIELD_LABEL || |
10627
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1257 type == GAIM_REQUEST_FIELD_LIST || |
7905
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
1258 (type == GAIM_REQUEST_FIELD_STRING && |
1d0bc32f8038
[gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents:
7904
diff
changeset
|
1259 gaim_request_field_string_is_multiline(field))) |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1260 { |
7921 | 1261 if(col_num > 0) |
1262 row_num++; | |
1263 | |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1264 gtk_table_attach_defaults(GTK_TABLE(table), label, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1265 0, 2 * cols, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1266 row_num, row_num + 1); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1267 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1268 row_num++; |
7921 | 1269 col_num=cols; |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1270 } |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1271 else |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1272 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1273 gtk_table_attach_defaults(GTK_TABLE(table), label, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1274 col_offset, col_offset + 1, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1275 row_num, row_num + 1); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1276 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1277 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1278 gtk_widget_show(label); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1279 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1280 |
13360
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
1281 if (field->ui_data != NULL) |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
1282 widget = GTK_WIDGET(field->ui_data); |
2e6dda9f9159
[gaim-migrate @ 15733]
Richard Laager <rlaager@wiktel.com>
parents:
13355
diff
changeset
|
1283 else if (type == GAIM_REQUEST_FIELD_STRING) |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1284 widget = create_string_field(field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1285 else if (type == GAIM_REQUEST_FIELD_INTEGER) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1286 widget = create_int_field(field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1287 else if (type == GAIM_REQUEST_FIELD_BOOLEAN) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1288 widget = create_bool_field(field); |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1289 else if (type == GAIM_REQUEST_FIELD_CHOICE) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1290 widget = create_choice_field(field); |
7903
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1291 else if (type == GAIM_REQUEST_FIELD_LIST) |
d91806e4ea64
[gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents:
7900
diff
changeset
|
1292 widget = create_list_field(field); |
11357 | 1293 else if (type == GAIM_REQUEST_FIELD_IMAGE) |
1294 widget = create_image_field(field); | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1295 else if (type == GAIM_REQUEST_FIELD_ACCOUNT) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1296 widget = create_account_field(field); |
7904
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7903
diff
changeset
|
1297 else |
9b478c6e0bfa
[gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents:
7903
diff
changeset
|
1298 continue; |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1299 |
12666
8765dee8f517
[gaim-migrate @ 15009]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
1300 if (label) |
8765dee8f517
[gaim-migrate @ 15009]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
1301 gtk_label_set_mnemonic_widget(GTK_LABEL(label), widget); |
8765dee8f517
[gaim-migrate @ 15009]
Richard Laager <rlaager@wiktel.com>
parents:
12600
diff
changeset
|
1302 |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1303 if (type == GAIM_REQUEST_FIELD_STRING && |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1304 gaim_request_field_string_is_multiline(field)) |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1305 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1306 gtk_table_attach(GTK_TABLE(table), widget, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1307 0, 2 * cols, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1308 row_num, row_num + 1, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1309 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1310 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1311 5, 0); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1312 } |
10627
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1313 else if (type == GAIM_REQUEST_FIELD_LIST) |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1314 { |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1315 gtk_table_attach(GTK_TABLE(table), widget, |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1316 0, 2 * cols, |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1317 row_num, row_num + 1, |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1318 GTK_FILL | GTK_EXPAND, |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1319 GTK_FILL | GTK_EXPAND, |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1320 5, 0); |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1321 } |
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1322 else if (type == GAIM_REQUEST_FIELD_BOOLEAN) |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1323 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1324 gtk_table_attach(GTK_TABLE(table), widget, |
10627
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1325 col_offset, col_offset + 1, |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1326 row_num, row_num + 1, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1327 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1328 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1329 5, 0); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1330 } |
7900
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1331 else |
365d8a67972d
[gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents:
7844
diff
changeset
|
1332 { |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1333 gtk_table_attach(GTK_TABLE(table), widget, |
10627
57589eb36449
[gaim-migrate @ 12102]
Luke Schierer <lschiere@pidgin.im>
parents:
10605
diff
changeset
|
1334 1, 2 * cols, |
6337
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1335 row_num, row_num + 1, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1336 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1337 GTK_FILL | GTK_EXPAND, |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1338 5, 0); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1339 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1340 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1341 gtk_widget_show(widget); |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1342 |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1343 field->ui_data = widget; |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1344 } |
957c1d28b96a
[gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents:
6335
diff
changeset
|
1345 } |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1346 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1347 |
5813
b116f3a73256
[gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
1348 g_object_unref(sg); |
b116f3a73256
[gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents:
5811
diff
changeset
|
1349 |
5815
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1350 /* Button box. */ |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1351 bbox = gtk_hbutton_box_new(); |
11243 | 1352 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); |
5815
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1353 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
|
1354 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1355 gtk_widget_show(bbox); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1356 |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1357 /* Cancel button */ |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1358 button = gtk_button_new_from_stock(text_to_stock(cancel_text)); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1359 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1360 gtk_widget_show(button); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1361 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1362 g_signal_connect(G_OBJECT(button), "clicked", |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1363 G_CALLBACK(multifield_cancel_cb), data); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1364 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1365 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1366 |
5815
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1367 /* OK button */ |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1368 button = gtk_button_new_from_stock(text_to_stock(ok_text)); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1369 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1370 gtk_widget_show(button); |
c900fc823a21
[gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents:
5813
diff
changeset
|
1371 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1372 data->ok_button = button; |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1373 |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1374 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1375 gtk_window_set_default(GTK_WINDOW(win), button); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1376 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1377 g_signal_connect(G_OBJECT(button), "clicked", |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1378 G_CALLBACK(multifield_ok_cb), data); |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1379 |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1380 if (!gaim_request_fields_all_required_filled(fields)) |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1381 gtk_widget_set_sensitive(button, FALSE); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1382 |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1383 gtk_widget_show(win); |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1384 |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1385 return data; |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1386 } |
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1387 |
6363
b7ef10bbe9bb
[gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents:
6338
diff
changeset
|
1388 static void |
9502 | 1389 file_yes_no_cb(GaimGtkRequestData *data, gint id) |
1390 { | |
10605 | 1391 /* Only call the callback if yes was selected, otherwise the request |
1392 * (eg. file transfer) will be cancelled, then when a new filename is chosen | |
1393 * things go BOOM */ | |
1394 if (id == 1) { | |
1395 if (data->cbs[1] != NULL) | |
1396 ((GaimRequestFileCb)data->cbs[1])(data->user_data, data->u.file.name); | |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1397 gaim_request_close(data->type, data); |
13372
fb178093e364
[gaim-migrate @ 15745]
Richard Laager <rlaager@wiktel.com>
parents:
13361
diff
changeset
|
1398 } else { |
fb178093e364
[gaim-migrate @ 15745]
Richard Laager <rlaager@wiktel.com>
parents:
13361
diff
changeset
|
1399 gdk_window_set_cursor(GTK_WIDGET(data->dialog)->window, NULL); |
10605 | 1400 } |
9502 | 1401 } |
1402 | |
9573 | 1403 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
9502 | 1404 static void |
1405 file_ok_check_if_exists_cb(GtkWidget *widget, gint response, GaimGtkRequestData *data) | |
1406 { | |
10536 | 1407 gchar *current_folder; |
1408 | |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1409 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1410 |
9502 | 1411 if (response != GTK_RESPONSE_ACCEPT) { |
1412 if (data->cbs[0] != NULL) | |
1413 ((GaimRequestFileCb)data->cbs[0])(data->user_data, NULL); | |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1414 gaim_request_close(data->type, data); |
9502 | 1415 return; |
1416 } | |
1417 | |
1418 data->u.file.name = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(data->dialog)); | |
10605 | 1419 current_folder = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(data->dialog)); |
1420 if (current_folder != NULL) { | |
1421 if (data->u.file.savedialog) { | |
1422 gaim_prefs_set_string("/gaim/gtk/filelocations/last_save_folder", current_folder); | |
1423 } else { | |
1424 gaim_prefs_set_string("/gaim/gtk/filelocations/last_open_folder", current_folder); | |
10536 | 1425 } |
10605 | 1426 g_free(current_folder); |
10536 | 1427 } |
10605 | 1428 |
9502 | 1429 #else /* FILECHOOSER */ |
10605 | 1430 |
9573 | 1431 static void |
9502 | 1432 file_ok_check_if_exists_cb(GtkWidget *button, GaimGtkRequestData *data) |
1433 { | |
9503 | 1434 const gchar *name; |
10605 | 1435 gchar *current_folder; |
9502 | 1436 |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1437 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1438 |
9503 | 1439 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->dialog)); |
9513 | 1440 |
1441 /* If name is a directory then change directories */ | |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1442 if (data->type == GAIM_REQUEST_FILE) { |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1443 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->dialog))) |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1444 return; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1445 } |
9513 | 1446 |
10605 | 1447 current_folder = g_path_get_dirname(name); |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1448 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1449 g_free(data->u.file.name); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1450 if (data->type == GAIM_REQUEST_FILE) |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1451 data->u.file.name = g_strdup(name); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1452 else |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1453 { |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1454 if (g_file_test(name, G_FILE_TEST_IS_DIR)) |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1455 data->u.file.name = g_strdup(name); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1456 else |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1457 data->u.file.name = g_strdup(current_folder); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1458 } |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1459 |
10605 | 1460 if (current_folder != NULL) { |
1461 if (data->u.file.savedialog) { | |
1462 gaim_prefs_set_string("/gaim/gtk/filelocations/last_save_folder", current_folder); | |
1463 } else { | |
1464 gaim_prefs_set_string("/gaim/gtk/filelocations/last_open_folder", current_folder); | |
1465 } | |
1466 g_free(current_folder); | |
1467 } | |
1468 | |
9502 | 1469 #endif /* FILECHOOSER */ |
1470 | |
1471 if ((data->u.file.savedialog == TRUE) && | |
1472 (g_file_test(data->u.file.name, G_FILE_TEST_EXISTS))) { | |
1473 gaim_request_yes_no(data, NULL, _("That file already exists"), | |
10116 | 1474 _("Would you like to overwrite it?"), 0, data, |
9502 | 1475 G_CALLBACK(file_yes_no_cb), |
1476 G_CALLBACK(file_yes_no_cb)); | |
1477 } else | |
1478 file_yes_no_cb(data, 1); | |
1479 } | |
1480 | |
1481 #if !GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
1482 static void | |
9506 | 1483 file_cancel_cb(GaimGtkRequestData *data) |
9502 | 1484 { |
12234
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1485 generic_response_start(data); |
7de5514bc406
[gaim-migrate @ 14536]
Richard Laager <rlaager@wiktel.com>
parents:
12067
diff
changeset
|
1486 |
9502 | 1487 if (data->cbs[0] != NULL) |
1488 ((GaimRequestFileCb)data->cbs[0])(data->user_data, NULL); | |
1489 | |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1490 gaim_request_close(data->type, data); |
9502 | 1491 } |
1492 #endif /* FILECHOOSER */ | |
1493 | |
1494 static void * | |
1495 gaim_gtk_request_file(const char *title, const char *filename, | |
1496 gboolean savedialog, | |
1497 GCallback ok_cb, GCallback cancel_cb, | |
1498 void *user_data) | |
1499 { | |
1500 GaimGtkRequestData *data; | |
1501 GtkWidget *filesel; | |
10605 | 1502 const gchar *current_folder; |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1503 #if GTK_CHECK_VERSION(2,4,0) |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1504 gboolean folder_set = FALSE; |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1505 #endif |
9502 | 1506 |
1507 data = g_new0(GaimGtkRequestData, 1); | |
1508 data->type = GAIM_REQUEST_FILE; | |
1509 data->user_data = user_data; | |
1510 data->cb_count = 2; | |
1511 data->cbs = g_new0(GCallback, 2); | |
1512 data->cbs[0] = cancel_cb; | |
1513 data->cbs[1] = ok_cb; | |
1514 data->u.file.savedialog = savedialog; | |
1515 | |
1516 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ | |
1517 filesel = gtk_file_chooser_dialog_new( | |
1518 title ? title : (savedialog ? _("Save File...") | |
1519 : _("Open File...")), | |
1520 NULL, | |
1521 savedialog ? GTK_FILE_CHOOSER_ACTION_SAVE | |
1522 : GTK_FILE_CHOOSER_ACTION_OPEN, | |
1523 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, | |
1524 savedialog ? GTK_STOCK_SAVE | |
1525 : GTK_STOCK_OPEN, | |
1526 GTK_RESPONSE_ACCEPT, | |
1527 NULL); | |
1528 gtk_dialog_set_default_response(GTK_DIALOG(filesel), GTK_RESPONSE_ACCEPT); | |
10605 | 1529 |
1530 if (savedialog) { | |
1531 current_folder = gaim_prefs_get_string("/gaim/gtk/filelocations/last_save_folder"); | |
1532 } else { | |
1533 current_folder = gaim_prefs_get_string("/gaim/gtk/filelocations/last_open_folder"); | |
9502 | 1534 } |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1535 |
10605 | 1536 if (filename != NULL) |
1537 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(filesel), filename); | |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1538 if ((current_folder != NULL) && (*current_folder != '\0')) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1539 folder_set = gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(filesel), current_folder); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1540 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1541 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1542 #ifdef _WIN32 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1543 if (!folder_set) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1544 char *my_documents = wgaim_get_special_folder(CSIDL_PERSONAL); |
10605 | 1545 |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1546 if (my_documents != NULL) { |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1547 gtk_file_chooser_set_current_folder( |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1548 GTK_FILE_CHOOSER(filesel), my_documents); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1549 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1550 g_free(my_documents); |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1551 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1552 } |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1553 |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1554 #endif |
9502 | 1555 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(filesel)), "response", |
1556 G_CALLBACK(file_ok_check_if_exists_cb), data); | |
1557 #else /* FILECHOOSER */ | |
10673
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1558 filesel = gtk_file_selection_new( |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1559 title ? title : (savedialog ? _("Save File...") |
179b0245a2f7
[gaim-migrate @ 12213]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10668
diff
changeset
|
1560 : _("Open File..."))); |
10605 | 1561 if (savedialog) { |
1562 current_folder = gaim_prefs_get_string("/gaim/gtk/filelocations/last_save_folder"); | |
1563 } else { | |
1564 current_folder = gaim_prefs_get_string("/gaim/gtk/filelocations/last_open_folder"); | |
1565 } | |
1566 if (current_folder != NULL) { | |
1567 gchar *path = g_strdup_printf("%s%s", current_folder, G_DIR_SEPARATOR_S); | |
1568 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), path); | |
1569 g_free(path); | |
1570 } | |
10225 | 1571 if (filename != NULL) |
1572 gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), filename); | |
10605 | 1573 |
9506 | 1574 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)), "delete_event", |
1575 G_CALLBACK(file_cancel_cb), data); | |
1576 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(filesel)->cancel_button), | |
9502 | 1577 "clicked", G_CALLBACK(file_cancel_cb), data); |
9506 | 1578 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(filesel)->ok_button), "clicked", |
1579 G_CALLBACK(file_ok_check_if_exists_cb), data); | |
9502 | 1580 #endif /* FILECHOOSER */ |
1581 | |
1582 data->dialog = filesel; | |
1583 gtk_widget_show(filesel); | |
1584 | |
1585 return (void *)data; | |
1586 } | |
1587 | |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1588 static void * |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1589 gaim_gtk_request_folder(const char *title, const char *dirname, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1590 GCallback ok_cb, GCallback cancel_cb, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1591 void *user_data) |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1592 { |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1593 GaimGtkRequestData *data; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1594 GtkWidget *dirsel; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1595 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1596 data = g_new0(GaimGtkRequestData, 1); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1597 data->type = GAIM_REQUEST_FOLDER; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1598 data->user_data = user_data; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1599 data->cb_count = 2; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1600 data->cbs = g_new0(GCallback, 2); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1601 data->cbs[0] = cancel_cb; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1602 data->cbs[1] = ok_cb; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1603 data->u.file.savedialog = FALSE; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1604 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1605 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */ |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1606 /* Use a translated "Select Folder..." in place of NULL after strings thaw. */ |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1607 dirsel = gtk_file_chooser_dialog_new( |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1608 title ? title : NULL, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1609 NULL, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1610 GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1611 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1612 GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1613 NULL); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1614 gtk_dialog_set_default_response(GTK_DIALOG(dirsel), GTK_RESPONSE_ACCEPT); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1615 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1616 if ((dirname != NULL) && (*dirname != '\0')) |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1617 gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dirsel), dirname); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1618 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1619 g_signal_connect(G_OBJECT(GTK_FILE_CHOOSER(dirsel)), "response", |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1620 G_CALLBACK(file_ok_check_if_exists_cb), data); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1621 #else |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1622 /* Use a translated "Select Folder..." in place of NULL after strings thaw. */ |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1623 dirsel = gtk_file_selection_new(title ? title : NULL); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1624 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1625 g_signal_connect_swapped(G_OBJECT(dirsel), "delete_event", |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1626 G_CALLBACK(file_cancel_cb), data); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1627 g_signal_connect_swapped(G_OBJECT(GTK_FILE_SELECTION(dirsel)->cancel_button), |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1628 "clicked", G_CALLBACK(file_cancel_cb), data); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1629 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(dirsel)->ok_button), "clicked", |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1630 G_CALLBACK(file_ok_check_if_exists_cb), data); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1631 #endif |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1632 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1633 data->dialog = dirsel; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1634 gtk_widget_show(dirsel); |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1635 |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1636 return (void *)data; |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1637 } |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1638 |
9502 | 1639 static void |
5480 | 1640 gaim_gtk_close_request(GaimRequestType type, void *ui_handle) |
1641 { | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1642 GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle; |
5480 | 1643 |
1644 if (data->cbs != NULL) | |
1645 g_free(data->cbs); | |
1646 | |
8286
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1647 gtk_widget_destroy(data->dialog); |
89d9d004e3f3
[gaim-migrate @ 9010]
Christian Hammond <chipx86@chipx86.com>
parents:
8137
diff
changeset
|
1648 |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1649 if (type == GAIM_REQUEST_FIELDS) |
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1650 gaim_request_fields_destroy(data->u.multifield.fields); |
9513 | 1651 else if (type == GAIM_REQUEST_FILE) |
1652 g_free(data->u.file.name); | |
5817
571e895bf6ba
[gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents:
5816
diff
changeset
|
1653 |
5480 | 1654 g_free(data); |
1655 } | |
1656 | |
1657 static GaimRequestUiOps ops = | |
1658 { | |
1659 gaim_gtk_request_input, | |
1660 gaim_gtk_request_choice, | |
1661 gaim_gtk_request_action, | |
5811
9467bff78029
[gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents:
5794
diff
changeset
|
1662 gaim_gtk_request_fields, |
8843 | 1663 gaim_gtk_request_file, |
13282
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1664 gaim_gtk_close_request, |
a651bfe0a922
[gaim-migrate @ 15648]
Richard Laager <rlaager@wiktel.com>
parents:
13280
diff
changeset
|
1665 gaim_gtk_request_folder |
5480 | 1666 }; |
1667 | |
1668 GaimRequestUiOps * | |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
1669 gaim_gtk_request_get_ui_ops(void) |
5480 | 1670 { |
1671 return &ops; | |
1672 } |