annotate src/gtkrequest.c @ 7971:6fca0d9cc98b

[gaim-migrate @ 8648] this particular work of art is topic changing support for jabber, and support for setting the topic by just changing the text in the chat window. hopefully someone less lazy than I will implement the right function for IRC, and any other chats that do topics. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 02 Jan 2004 06:16:44 +0000
parents a5c70e43ee43
children fa6395637e2c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file gtkrequest.c GTK+ Request API
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 * @ingroup gtkui
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 * gaim
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
8 *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or modify
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * it under the terms of the GNU General Public License as published by
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * the Free Software Foundation; either version 2 of the License, or
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 * (at your option) any later version.
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 * GNU General Public License for more details.
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 *
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6363
diff changeset
23 #include "gtkinternal.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
24
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
25 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
26
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #include "gtkrequest.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
28 #include "gtkutils.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "stock.h"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
30 #include "ui.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 typedef struct
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 GaimRequestType type;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 void *user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 size_t cb_count;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 GCallback *cbs;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
42 union
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
43 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
44 struct
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
45 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
46 GtkWidget *entry;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
47
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
48 gboolean multiline;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
49
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
50 } input;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
51
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
52 struct
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
53 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
54 GaimRequestFields *fields;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
55
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
56 } multifield;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
57
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
58 } u;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
59
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
60 } GaimGtkRequestData;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
63 input_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 {
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
65 const char *value;
7174
5d0db846c42d [gaim-migrate @ 7742]
Nathan Walp <nwalp@pidgin.im>
parents: 7172
diff changeset
66 char *multiline_value = NULL;
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
67
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
68 if (data->u.input.multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
69 GtkTextIter start_iter, end_iter;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
70 GtkTextBuffer *buffer =
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
71 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
72
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
73 gtk_text_buffer_get_start_iter(buffer, &start_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
74 gtk_text_buffer_get_end_iter(buffer, &end_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
75
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
76 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
77 FALSE);
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
78 value = multiline_value;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 }
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
80 else
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
81 value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
82
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
83 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
84 ((GaimRequestInputCb)data->cbs[id])(data->user_data, value);
6110
d1d8e70cf33d [gaim-migrate @ 6572]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
85 else if (data->cbs[1] != NULL)
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
86 ((GaimRequestInputCb)data->cbs[1])(data->user_data, value);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
88 if (data->u.input.multiline)
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
89 g_free(multiline_value);
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
90
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 gaim_request_close(GAIM_REQUEST_INPUT, data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
94 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
95 action_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
96 {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
97 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
98 ((GaimRequestActionCb)data->cbs[id])(data->user_data, id);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
99
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
100 gaim_request_close(GAIM_REQUEST_INPUT, data);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
101 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
102
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
103 static gboolean
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
104 field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event,
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
105 GaimRequestField *field)
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
106 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
107 const char *value;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
108
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
109 if (gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
110 GtkTextBuffer *buffer;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
111 GtkTextIter start_iter, end_iter;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
112
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
113 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
114
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
115 gtk_text_buffer_get_start_iter(buffer, &start_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
116 gtk_text_buffer_get_end_iter(buffer, &end_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
117
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
118 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
119 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
120 else
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
121 value = gtk_entry_get_text(GTK_ENTRY(entry));
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
122
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
123 gaim_request_field_string_set_value(field,
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
124 (*value == '\0' ? NULL : value));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
125
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
126 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
127 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
128
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
129 static gboolean
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
130 field_int_focus_out_cb(GtkEntry *entry, GdkEventFocus *event,
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
131 GaimRequestField *field)
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
132 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
133 gaim_request_field_int_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
134 atoi(gtk_entry_get_text(entry)));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
135
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
136 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
137 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
138
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
139 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
140 field_bool_cb(GtkToggleButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
141 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
142 gaim_request_field_bool_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
143 gtk_toggle_button_get_active(button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
144 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
145
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
146 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
147 field_choice_menu_cb(GtkOptionMenu *menu, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
148 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
149 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
150 gtk_option_menu_get_history(menu));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
151 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
152
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
153 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
154 field_choice_option_cb(GtkRadioButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
155 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
156 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
157 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
158 g_slist_index(gtk_radio_button_get_group(button), button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
159 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
160
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
161 static void
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
162 multifield_ok_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
163 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
164 if (data->cbs[0] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
165 ((GaimRequestFieldsCb)data->cbs[0])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
166 data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
167
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
168 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
169 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
170
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
171 static void
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
172 multifield_cancel_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
173 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
174 if (data->cbs[1] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
175 ((GaimRequestFieldsCb)data->cbs[1])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
176 data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
177
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
178 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
179 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
180
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 #define STOCK_ITEMIZE(r, l) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 if (!strcmp((r), text)) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 return (l);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 static const char *
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
186 text_to_stock(const char *text)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 {
6334
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
188 STOCK_ITEMIZE(_("Yes"), GTK_STOCK_YES);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
189 STOCK_ITEMIZE(_("No"), GTK_STOCK_NO);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
190 STOCK_ITEMIZE(_("OK"), GTK_STOCK_OK);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
191 STOCK_ITEMIZE(_("Cancel"), GTK_STOCK_CANCEL);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
192 STOCK_ITEMIZE(_("Apply"), GTK_STOCK_APPLY);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
193 STOCK_ITEMIZE(_("Close"), GTK_STOCK_CLOSE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
194 STOCK_ITEMIZE(_("Delete"), GTK_STOCK_DELETE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
195 STOCK_ITEMIZE(_("Add"), GTK_STOCK_ADD);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
196 STOCK_ITEMIZE(_("Remove"), GTK_STOCK_REMOVE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
197 STOCK_ITEMIZE(_("Save"), GTK_STOCK_SAVE);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
199 return text;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
202 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203 gaim_gtk_request_input(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 const char *secondary, const char *default_value,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
205 gboolean multiline, gboolean masked,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 const char *cancel_text, GCallback cancel_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 void *user_data)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
210 GaimGtkRequestData *data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 GtkWidget *vbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213 GtkWidget *hbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214 GtkWidget *label;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 GtkWidget *entry;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 GtkWidget *img;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 char *label_text;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
219 data = g_new0(GaimGtkRequestData, 1);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 data->type = GAIM_REQUEST_INPUT;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 data->user_data = user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
222
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 data->cb_count = 2;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 data->cbs = g_new0(GCallback, 2);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 data->cbs[0] = ok_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 data->cbs[1] = cancel_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 /* Create the dialog. */
7678
cf6a7939af78 [gaim-migrate @ 8322]
Sean Egan <seanegan@gmail.com>
parents: 7538
diff changeset
230 dialog = gtk_dialog_new_with_buttons(title ? title : GAIM_ALERT_TITLE,
cf6a7939af78 [gaim-migrate @ 8322]
Sean Egan <seanegan@gmail.com>
parents: 7538
diff changeset
231 NULL, 0,
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
232 text_to_stock(cancel_text), 1,
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
233 text_to_stock(ok_text), 0,
5485
c103ba09c62a [gaim-migrate @ 5881]
Sean Egan <seanegan@gmail.com>
parents: 5480
diff changeset
234 NULL);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 data->dialog = dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
238 G_CALLBACK(input_response_cb), data);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 /* Setup the dialog */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
242 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
245 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 /* Setup the main horizontal box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 hbox = gtk_hbox_new(FALSE, 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 /* Dialog icon. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 GTK_ICON_SIZE_DIALOG);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258 /* Vertical box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 vbox = gtk_vbox_new(FALSE, 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 /* Descriptive label */
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
264 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
265 "%s</span>%s%s" : "%s%s%s"),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
266 (primary ? primary : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
267 ((primary && secondary) ? "\n\n" : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
268 (secondary ? secondary : ""));
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 label = gtk_label_new(NULL);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 gtk_label_set_markup(GTK_LABEL(label), label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277 g_free(label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 /* Entry field. */
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
280 data->u.input.multiline = multiline;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
281
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
282 if (multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
283 GtkWidget *sw;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
284
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
285 sw = gtk_scrolled_window_new(NULL, NULL);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
286 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
287 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
288 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
289 GTK_SHADOW_IN);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
290
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
291 gtk_widget_set_size_request(sw, 320, 130);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
292
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
293 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
294
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
295 entry = gtk_text_view_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
296 gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE);
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
297 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(entry), GTK_WRAP_WORD_CHAR);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
299 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
7538
357eb1c39b72 [gaim-migrate @ 8151]
Christian Hammond <chipx86@chipx86.com>
parents: 7458
diff changeset
300 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(entry));
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
301
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
302 gtk_container_add(GTK_CONTAINER(sw), entry);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
303
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
304 if (default_value != NULL) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
305 GtkTextBuffer *buffer;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
306
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
307 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
308 gtk_text_buffer_set_text(buffer, default_value, -1);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
309 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
310 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
311 else {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
312 entry = gtk_entry_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
313
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
314 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
315
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
316 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
317
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
318 if (default_value != NULL)
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
319 gtk_entry_set_text(GTK_ENTRY(entry), default_value);
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
320
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
321 if (masked)
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
322 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
323 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
324
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
325 data->u.input.entry = entry;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 /* Show everything. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 gtk_widget_show_all(dialog);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 return data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
333 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 gaim_gtk_request_choice(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335 const char *secondary, unsigned int default_value,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
338 void *user_data, size_t choice_count, va_list args)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 return NULL;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
343 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 gaim_gtk_request_action(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 const char *secondary, unsigned int default_action,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
346 void *user_data, size_t action_count, va_list actions)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
348 GaimGtkRequestData *data;
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
349 GtkWidget *dialog;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
350 GtkWidget *vbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
351 GtkWidget *hbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
352 GtkWidget *label;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
353 GtkWidget *img;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
354 void **buttons;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
355 char *label_text;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
356 int i;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
357
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
358 data = g_new0(GaimGtkRequestData, 1);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
359 data->type = GAIM_REQUEST_ACTION;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
360 data->user_data = user_data;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
361
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
362 data->cb_count = action_count;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
363 data->cbs = g_new0(GCallback, action_count);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
364
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
365 /* Reverse the buttons */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
366 buttons = g_new0(void *, action_count * 2);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
367
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
368 for (i = 0; i < action_count * 2; i += 2) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
369 buttons[(action_count * 2) - i - 2] = va_arg(actions, char *);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
370 buttons[(action_count * 2) - i - 1] = va_arg(actions, GCallback);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
371 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
372
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
373 /* Create the dialog. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
374 data->dialog = dialog = gtk_dialog_new();
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6363
diff changeset
375
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
376 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
377 gtk_window_set_title(GTK_WINDOW(dialog), title);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
378
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
379 for (i = 0; i < action_count; i++) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
380 gtk_dialog_add_button(GTK_DIALOG(dialog),
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
381 text_to_stock(buttons[2 * i]), i);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
382
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
383 data->cbs[i] = buttons[2 * i + 1];
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
384 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
385
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
386 g_free(buttons);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
387
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
388 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
389 G_CALLBACK(action_response_cb), data);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
390
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
391 /* Setup the dialog */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
392 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
393 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
394 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
395 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
396 gtk_container_set_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 6);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
397
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
398 /* Setup the main horizontal box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
399 hbox = gtk_hbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
400 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
401
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
402 /* Dialog icon. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
403 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
404 GTK_ICON_SIZE_DIALOG);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
405 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
406 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
407
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
408 /* Vertical box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
409 vbox = gtk_vbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
410 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
411
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
412 /* Descriptive label */
7843
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
413 label_text = g_strdup_printf((primary ? "<span weight=\"bold\" size=\"larger\">"
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
414 "%s</span>%s%s" : "%s%s%s"),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
415 (primary ? primary : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
416 ((primary && secondary) ? "\n\n" : ""),
9408c12b4a61 [gaim-migrate @ 8497]
Mark Doliner <mark@kingant.net>
parents: 7678
diff changeset
417 (secondary ? secondary : ""));
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
418
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
419 label = gtk_label_new(NULL);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
420
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
421 gtk_label_set_markup(GTK_LABEL(label), label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
422 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
423 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
424 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
425
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
426 g_free(label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
427
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
428 if (default_action != -1)
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
429 gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
430
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
431 /* Show everything. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
432 gtk_widget_show_all(dialog);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
433
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
434 return data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
435 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
436
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
437 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
438 create_string_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
439 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
440 const char *value;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
441 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
442
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
443 value = gaim_request_field_string_get_default_value(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
444
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
445 if (gaim_request_field_string_is_multiline(field))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
446 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
447 GtkWidget *textview;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
448
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
449 widget = gtk_scrolled_window_new(NULL, NULL);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
450 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
451 GTK_SHADOW_IN);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
452 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
453 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
454
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
455 textview = gtk_text_view_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
456 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
457 TRUE);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
458 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
459 GTK_WRAP_WORD_CHAR);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
460
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
461 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
462 gaim_gtk_setup_gtkspell(GTK_TEXT_VIEW(textview));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
463
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
464 gtk_container_add(GTK_CONTAINER(widget), textview);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
465 gtk_widget_show(textview);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
466
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
467 gtk_widget_set_size_request(widget, -1, 75);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
468
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
469 if (value != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
470 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
471 GtkTextBuffer *buffer;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
472
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
473 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
474
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
475 gtk_text_buffer_set_text(buffer, value, -1);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
476 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
477
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
478 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
479 gaim_request_field_string_is_editable(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
480
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
481 g_signal_connect(G_OBJECT(textview), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
482 G_CALLBACK(field_string_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
483 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
484 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
485 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
486 widget = gtk_entry_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
487
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
488 if (value != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
489 gtk_entry_set_text(GTK_ENTRY(widget), value);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
490
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
491 gtk_entry_set_visibility(GTK_ENTRY(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
492 !gaim_request_field_string_is_masked(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
493
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
494 gtk_editable_set_editable(GTK_EDITABLE(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
495 gaim_request_field_string_is_editable(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
496
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
497 g_signal_connect(G_OBJECT(widget), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
498 G_CALLBACK(field_string_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
499 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
500
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
501 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
502 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
503
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
504 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
505 create_int_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
506 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
507 int value;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
508 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
509
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
510 widget = gtk_entry_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
511
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
512 value = gaim_request_field_int_get_default_value(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
513
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
514 if (value != 0)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
515 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
516 char buf[32];
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
517
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
518 g_snprintf(buf, sizeof(buf), "%d", value);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
519
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
520 gtk_entry_set_text(GTK_ENTRY(widget), buf);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
521 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
522
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
523 g_signal_connect(G_OBJECT(widget), "focus-out-event",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
524 G_CALLBACK(field_int_focus_out_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
525
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
526 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
527 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
528
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
529 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
530 create_bool_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
531 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
532 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
533
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
534 widget = gtk_check_button_new_with_label(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
535 gaim_request_field_get_label(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
536
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
537 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
538 gaim_request_field_bool_get_default_value(field));
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
539
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
540 g_signal_connect(G_OBJECT(widget), "toggled",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
541 G_CALLBACK(field_bool_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
542
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
543 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
544 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
545
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
546 static GtkWidget *
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
547 create_choice_field(GaimRequestField *field)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
548 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
549 GtkWidget *widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
550 GList *labels;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
551 GList *l;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
552
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
553 labels = gaim_request_field_choice_get_labels(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
554
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
555 if (g_list_length(labels) > 5)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
556 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
557 GtkWidget *menu;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
558 GtkWidget *item;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
559
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
560 widget = gtk_option_menu_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
561
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
562 menu = gtk_menu_new();
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
563
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
564 gtk_option_menu_set_menu(GTK_OPTION_MENU(widget), menu);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
565
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
566 for (l = labels; l != NULL; l = l->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
567 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
568 const char *text = l->data;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
569
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
570 item = gtk_menu_item_new_with_label(text);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
571
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
572 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
573 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
574
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
575 g_signal_connect(G_OBJECT(widget), "changed",
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
576 G_CALLBACK(field_choice_menu_cb), field);
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
577 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
578 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
579 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
580 GtkWidget *box;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
581 GtkWidget *first_radio = NULL;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
582 GtkWidget *radio;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
583
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
584 if (g_list_length(labels) == 2)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
585 box = gtk_hbox_new(FALSE, 6);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
586 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
587 box = gtk_vbox_new(FALSE, 0);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
588
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
589 widget = box;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
590
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
591 for (l = labels; l != NULL; l = l->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
592 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
593 const char *text = l->data;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
594
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
595 radio = gtk_radio_button_new_with_label_from_widget(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
596 GTK_RADIO_BUTTON(first_radio), text);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
597
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
598 if (first_radio == NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
599 first_radio = radio;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
600
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
601 gtk_box_pack_start(GTK_BOX(box), radio, TRUE, TRUE, 0);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
602 gtk_widget_show(radio);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
603
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
604 g_signal_connect(G_OBJECT(radio), "toggled",
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
605 G_CALLBACK(field_choice_option_cb), field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
606 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
607 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
608
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
609 return widget;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
610 }
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
611
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
612 static void
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
613 select_field_list_item(GtkTreeModel *model, GtkTreePath *path,
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
614 GtkTreeIter *iter, gpointer data)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
615 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
616 GaimRequestField *field = (GaimRequestField *)data;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
617 const char *text;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
618
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
619 gtk_tree_model_get(model, iter, 1, &text, -1);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
620
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
621 gaim_request_field_list_add_selected(field, text);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
622 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
623
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
624 static void
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
625 list_field_select_changed_cb(GtkTreeSelection *sel, GaimRequestField *field)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
626 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
627 gaim_request_field_list_clear_selected(field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
628
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
629 gtk_tree_selection_selected_foreach(sel, select_field_list_item, field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
630 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
631
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
632 static GtkWidget *
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
633 create_list_field(GaimRequestField *field)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
634 {
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
635 GtkWidget *sw;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
636 GtkWidget *treeview;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
637 GtkListStore *store;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
638 GtkCellRenderer *renderer;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
639 GtkTreeSelection *sel;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
640 GtkTreeViewColumn *column;
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
641 GtkTreeIter iter;
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
642 const GList *l;
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
643
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
644 /* Create the scrolled window */
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
645 sw = gtk_scrolled_window_new(NULL, NULL);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
646 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
647 GTK_POLICY_AUTOMATIC,
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
648 GTK_POLICY_ALWAYS);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
649 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
650 GTK_SHADOW_IN);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
651 gtk_widget_show(sw);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
652
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
653 /* Create the list store */
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
654 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
655
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
656 /* Create the tree view */
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
657 treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
658 gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(treeview), TRUE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
659 gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), FALSE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
660
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
661 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
662
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
663 if (gaim_request_field_list_get_multi_select(field))
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
664 gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
665
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
666 g_signal_connect(G_OBJECT(sel), "changed",
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
667 G_CALLBACK(list_field_select_changed_cb), field);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
668
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
669 column = gtk_tree_view_column_new();
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
670 gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
671
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
672 renderer = gtk_cell_renderer_text_new();
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
673 gtk_tree_view_column_pack_start(column, renderer, TRUE);
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
674 gtk_tree_view_column_add_attribute(column, renderer, "text", 1);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
675
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
676 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
677 {
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
678 const char *text = (const char *)l->data;
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
679
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
680 gtk_list_store_append(store, &iter);
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
681
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
682 gtk_list_store_set(store, &iter,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
683 0, gaim_request_field_list_get_data(field, text),
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
684 1, text,
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
685 -1);
7964
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
686
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
687 if (gaim_request_field_list_is_selected(field, text))
a5c70e43ee43 [gaim-migrate @ 8641]
Christian Hammond <chipx86@chipx86.com>
parents: 7951
diff changeset
688 gtk_tree_selection_select_iter(sel, &iter);
7909
5be22af4ebfc [gaim-migrate @ 8569]
Christian Hammond <chipx86@chipx86.com>
parents: 7905
diff changeset
689 }
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
690
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
691 gtk_container_add(GTK_CONTAINER(sw), treeview);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
692 gtk_widget_show(treeview);
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
693
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
694 return sw;
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
695 }
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
696
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
697 static void *
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
698 gaim_gtk_request_fields(const char *title, const char *primary,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
699 const char *secondary, GaimRequestFields *fields,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
700 const char *ok_text, GCallback ok_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
701 const char *cancel_text, GCallback cancel_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
702 void *user_data)
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
703 {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
704 GaimGtkRequestData *data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
705 GtkWidget *win;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
706 GtkWidget *vbox;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
707 GtkWidget *hbox;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
708 GtkWidget *bbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
709 GtkWidget *frame;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
710 GtkWidget *label;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
711 GtkWidget *table;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
712 GtkWidget *button;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
713 GtkWidget *img;
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
714 GtkSizeGroup *sg;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
715 GList *gl, *fl;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
716 GaimRequestFieldGroup *group;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
717 GaimRequestField *field;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
718 char *label_text;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
719
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
720 data = g_new0(GaimGtkRequestData, 1);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
721 data->type = GAIM_REQUEST_FIELDS;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
722 data->user_data = user_data;
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
723 data->u.multifield.fields = fields;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
724
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
725 data->cb_count = 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
726 data->cbs = g_new0(GCallback, 2);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
727
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
728 data->cbs[0] = ok_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
729 data->cbs[1] = cancel_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
730
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
731 data->dialog = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
732
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
733 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
734 gtk_window_set_title(GTK_WINDOW(win), title);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
735
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
736 gtk_window_set_role(GTK_WINDOW(win), "multifield");
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
737 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
738 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
739
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
740 /* Setup the main horizontal box */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
741 hbox = gtk_hbox_new(FALSE, 12);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
742 gtk_container_add(GTK_CONTAINER(win), hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
743 gtk_widget_show(hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
744
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
745 /* Dialog icon. */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
746 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
747 GTK_ICON_SIZE_DIALOG);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
748 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
749 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
750 gtk_widget_show(img);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
751
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
752 /* Setup the vbox */
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
753 vbox = gtk_vbox_new(FALSE, 12);
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
754 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
755 gtk_widget_show(vbox);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
756
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
757 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
758
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
759 if (primary != NULL || secondary != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
760 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
761 label_text = g_strdup_printf(
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
762 (primary
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
763 ? "<span weight=\"bold\" size=\"larger\">"
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
764 "%s</span>%s%s"
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
765 : "%s%s%s"),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
766 (primary ? primary : ""),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
767 ((primary && secondary) ? "\n\n" : ""),
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
768 (secondary ? secondary : ""));
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
769
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
770 label = gtk_label_new(NULL);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
771
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
772 gtk_label_set_markup(GTK_LABEL(label), label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
773 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
774 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
775 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
776 gtk_widget_show(label);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
777
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
778 g_free(label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
779 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
780
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
781 for (gl = gaim_request_fields_get_groups(fields);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
782 gl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
783 gl = gl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
784 {
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
785 GList *field_list;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
786 size_t field_count = 0;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
787 size_t cols = 1;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
788 size_t rows;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
789 size_t col_num;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
790 size_t row_num = 0;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
791
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
792 group = gl->data;
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
793 field_list = gaim_request_field_group_get_fields(group);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
794
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
795 if (gaim_request_field_group_get_title(group) != NULL)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
796 {
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
797 frame = gaim_gtk_make_frame(vbox,
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
798 gaim_request_field_group_get_title(group));
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
799 }
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
800 else
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
801 frame = vbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
802
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
803 field_count = g_list_length(field_list);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
804
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
805 if (field_count > 9)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
806 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
807 rows = field_count / 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
808 cols++;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
809 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
810 else
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
811 rows = field_count;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
812
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
813 col_num=0;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
814 for (fl = field_list; fl != NULL; fl = fl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
815 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
816 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
817
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
818 field = (GaimRequestField *)fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
819
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
820 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
821
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
822 if (type == GAIM_REQUEST_FIELD_LABEL) {
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
823 if(col_num > 0)
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
824 rows++;
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
825 rows++;
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
826 } else if(type == GAIM_REQUEST_FIELD_STRING && gaim_request_field_string_is_multiline(field)){
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
827 if(col_num > 0)
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
828 rows++;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
829 rows += 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
830 }
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
831
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
832 col_num++;
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
833 if(col_num >= cols)
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
834 col_num=0;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
835 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
836
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
837 table = gtk_table_new(rows, 2 * cols, FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
838 gtk_table_set_row_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
839 gtk_table_set_col_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
840
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
841 gtk_container_add(GTK_CONTAINER(frame), table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
842 gtk_widget_show(table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
843
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
844 for (row_num = 0, fl = field_list;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
845 row_num < rows && fl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
846 row_num++)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
847 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
848 for (col_num = 0;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
849 col_num < cols && fl != NULL;
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
850 col_num++, fl = fl->next)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
851 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
852 size_t col_offset = col_num * 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
853 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
854 GtkWidget *widget = NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
855
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
856 field = fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
857
7922
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
858 if (!gaim_request_field_is_visible(field)) {
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
859 col_num--;
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
860 continue;
7922
1fb7a840b5c7 [gaim-migrate @ 8591]
Nathan Walp <nwalp@pidgin.im>
parents: 7921
diff changeset
861 }
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
862
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
863 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
864
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
865 if (type != GAIM_REQUEST_FIELD_BOOLEAN)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
866 {
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
867 char *text;
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
868
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
869 text = g_strdup_printf("%s:",
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
870 gaim_request_field_get_label(field));
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
871
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
872 label = gtk_label_new(NULL);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
873 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
874 g_free(text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
875
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
876 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
877
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
878 gtk_size_group_add_widget(sg, label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
879
7905
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
880 if (type == GAIM_REQUEST_FIELD_LABEL ||
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
881 (type == GAIM_REQUEST_FIELD_STRING &&
1d0bc32f8038 [gaim-migrate @ 8565]
Christian Hammond <chipx86@chipx86.com>
parents: 7904
diff changeset
882 gaim_request_field_string_is_multiline(field)))
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
883 {
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
884 if(col_num > 0)
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
885 row_num++;
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
886
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
887 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
888 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
889 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
890
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
891 row_num++;
7921
c3dc33bb94dc [gaim-migrate @ 8589]
Nathan Walp <nwalp@pidgin.im>
parents: 7909
diff changeset
892 col_num=cols;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
893 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
894 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
895 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
896 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
897 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
898 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
899 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
900
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
901 gtk_widget_show(label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
902 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
903
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
904 if (type == GAIM_REQUEST_FIELD_STRING)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
905 widget = create_string_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
906 else if (type == GAIM_REQUEST_FIELD_INTEGER)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
907 widget = create_int_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
908 else if (type == GAIM_REQUEST_FIELD_BOOLEAN)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
909 widget = create_bool_field(field);
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
910 else if (type == GAIM_REQUEST_FIELD_CHOICE)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
911 widget = create_choice_field(field);
7903
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
912 else if (type == GAIM_REQUEST_FIELD_LIST)
d91806e4ea64 [gaim-migrate @ 8563]
Christian Hammond <chipx86@chipx86.com>
parents: 7900
diff changeset
913 widget = create_list_field(field);
7904
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
914 else
9b478c6e0bfa [gaim-migrate @ 8564]
Christian Hammond <chipx86@chipx86.com>
parents: 7903
diff changeset
915 continue;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
916
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
917 if (type == GAIM_REQUEST_FIELD_STRING &&
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
918 gaim_request_field_string_is_multiline(field))
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
919 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
920 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
921 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
922 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
923 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
924 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
925 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
926 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
927 else if (type != GAIM_REQUEST_FIELD_BOOLEAN)
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
928 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
929 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
930 col_offset + 1, col_offset + 2,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
931 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
932 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
933 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
934 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
935 }
7900
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
936 else
365d8a67972d [gaim-migrate @ 8560]
Christian Hammond <chipx86@chipx86.com>
parents: 7844
diff changeset
937 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
938 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
939 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
940 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
941 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
942 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
943 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
944 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
945
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
946 gtk_widget_show(widget);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
947
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
948 field->ui_data = widget;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
949 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
950 }
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
951 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
952
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
953 g_object_unref(sg);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
954
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
955 /* Button box. */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
956 bbox = gtk_hbutton_box_new();
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
957 gtk_box_set_spacing(GTK_BOX(bbox), 6);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
958 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
959 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
960 gtk_widget_show(bbox);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
961
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
962 /* Cancel button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
963 button = gtk_button_new_from_stock(text_to_stock(cancel_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
964 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
965 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
966
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
967 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
968 G_CALLBACK(multifield_cancel_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
969
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
970 /* OK button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
971 button = gtk_button_new_from_stock(text_to_stock(ok_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
972 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
973 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
974
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
975 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
976 G_CALLBACK(multifield_ok_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
977
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
978 gtk_widget_show(win);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
979
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
980 return data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
981 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
982
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
983 static void
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
984 gaim_gtk_close_request(GaimRequestType type, void *ui_handle)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
985 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
986 GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
987
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
988 if (data->cbs != NULL)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
989 g_free(data->cbs);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
990
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
991 if (type == GAIM_REQUEST_FIELDS)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
992 gaim_request_fields_destroy(data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
993
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
994 gtk_widget_destroy(data->dialog);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
995
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
996 g_free(data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
997 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
998
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
999 static GaimRequestUiOps ops =
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1000 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1001 gaim_gtk_request_input,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1002 gaim_gtk_request_choice,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1003 gaim_gtk_request_action,
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
1004 gaim_gtk_request_fields,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1005 gaim_gtk_close_request
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1006 };
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1007
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1008 GaimRequestUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
1009 gaim_gtk_request_get_ui_ops(void)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1010 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1011 return &ops;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1012 }