annotate src/gtkrequest.c @ 7330:5500f20a4331

[gaim-migrate @ 7918] I made the "clear log" button use gaim_request_whatever. This fixes bug 824285, which is: Gaim crashes if you 1) Open log viewer 2) Click on "Clear"" 3) Close log viewer 4) Click on "Ok" A side effect of this is that I removed some gtk code from dialogs.c I hope I didn't step on Sean's toe's too much... committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 25 Oct 2003 21:08:57 +0000
parents 5d0db846c42d
children 7c320cdc0f3a
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
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
25 #include "debug.h"
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
26 #include "prefs.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
27
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28 #include "gtkrequest.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5846
diff changeset
29 #include "gtkutils.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "stock.h"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
31 #include "ui.h"
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
33 #ifdef USE_GTKSPELL
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
34 # include <gtkspell/gtkspell.h>
7074
c6807437dcd7 [gaim-migrate @ 7639]
Nathan Walp <nwalp@pidgin.im>
parents: 7068
diff changeset
35 # ifdef _WIN32
c6807437dcd7 [gaim-migrate @ 7639]
Nathan Walp <nwalp@pidgin.im>
parents: 7068
diff changeset
36 # include "wspell.h"
c6807437dcd7 [gaim-migrate @ 7639]
Nathan Walp <nwalp@pidgin.im>
parents: 7068
diff changeset
37 # endif
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
38 #endif
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
39
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 typedef struct
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 GaimRequestType type;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 void *user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 size_t cb_count;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 GCallback *cbs;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
50 union
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
51 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
52 struct
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
53 {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
54 GtkWidget *entry;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
55
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
56 gboolean multiline;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
57
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
58 } input;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
59
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
60 struct
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
61 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
62 GaimRequestFields *fields;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
63
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
64 } multifield;
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
65
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
66 } u;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
67
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
68 } GaimGtkRequestData;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
71 input_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 {
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
73 const char *value;
7174
5d0db846c42d [gaim-migrate @ 7742]
Nathan Walp <nwalp@pidgin.im>
parents: 7172
diff changeset
74 char *multiline_value = NULL;
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
75
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
76 if (data->u.input.multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
77 GtkTextIter start_iter, end_iter;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
78 GtkTextBuffer *buffer =
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
79 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
80
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
81 gtk_text_buffer_get_start_iter(buffer, &start_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
82 gtk_text_buffer_get_end_iter(buffer, &end_iter);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
83
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
84 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
85 FALSE);
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
86 value = multiline_value;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 }
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
88 else
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
89 value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
90
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
91 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
92 ((GaimRequestInputCb)data->cbs[id])(data->user_data, value);
6110
d1d8e70cf33d [gaim-migrate @ 6572]
Mark Doliner <mark@kingant.net>
parents: 6109
diff changeset
93 else if (data->cbs[1] != NULL)
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
94 ((GaimRequestInputCb)data->cbs[1])(data->user_data, value);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95
7172
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
96 if (data->u.input.multiline)
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
97 g_free(multiline_value);
895cd1d03efb [gaim-migrate @ 7740]
Mark Doliner <mark@kingant.net>
parents: 7142
diff changeset
98
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 gaim_request_close(GAIM_REQUEST_INPUT, data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
102 static void
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
103 action_response_cb(GtkDialog *dialog, gint id, GaimGtkRequestData *data)
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
104 {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
105 if (id < data->cb_count && data->cbs[id] != NULL)
5498
cce2d7868c78 [gaim-migrate @ 5894]
Christian Hammond <chipx86@chipx86.com>
parents: 5496
diff changeset
106 ((GaimRequestActionCb)data->cbs[id])(data->user_data, id);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
107
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
108 gaim_request_close(GAIM_REQUEST_INPUT, data);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
109 }
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
110
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
111 static gboolean
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
112 field_string_focus_out_cb(GtkWidget *entry, GdkEventFocus *event,
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
113 GaimRequestField *field)
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
114 {
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
115 const char *value;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
116
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
117 gaim_debug(GAIM_DEBUG_MISC, "gtkrequest", "field_string_focus_out_cb\n");
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
118
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
119 if (gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
120 GtkTextBuffer *buffer;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
121 GtkTextIter start_iter, end_iter;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
122
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
123 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
124
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
125 gtk_text_buffer_get_start_iter(buffer, &start_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
126 gtk_text_buffer_get_end_iter(buffer, &end_iter);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
127
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
128 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
129 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
130 else
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
131 value = gtk_entry_get_text(GTK_ENTRY(entry));
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
132
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
133 gaim_debug(GAIM_DEBUG_MISC, "gtkrequest", "'%s' = '%s'\n",
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
134 gaim_request_field_get_id(field), value);
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
135 gaim_request_field_string_set_value(field,
5834
77eba2e68d07 [gaim-migrate @ 6265]
Christian Hammond <chipx86@chipx86.com>
parents: 5832
diff changeset
136 (*value == '\0' ? NULL : value));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
137
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
138 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
139 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
140
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
141 static gboolean
5846
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
142 field_int_focus_out_cb(GtkEntry *entry, GdkEventFocus *event,
4676b498ff4b [gaim-migrate @ 6277]
Christian Hammond <chipx86@chipx86.com>
parents: 5845
diff changeset
143 GaimRequestField *field)
5832
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 gaim_request_field_int_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
146 atoi(gtk_entry_get_text(entry)));
5835
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
147
9a08899192ee [gaim-migrate @ 6266]
Christian Hammond <chipx86@chipx86.com>
parents: 5834
diff changeset
148 return FALSE;
5832
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
149 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
150
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
151 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
152 field_bool_cb(GtkToggleButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
153 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
154 gaim_request_field_bool_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
155 gtk_toggle_button_get_active(button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
156 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
157
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
158 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
159 field_choice_menu_cb(GtkOptionMenu *menu, GaimRequestField *field)
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 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
162 gtk_option_menu_get_history(menu));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
163 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
164
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
165 static void
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
166 field_choice_option_cb(GtkRadioButton *button, GaimRequestField *field)
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
167 {
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
168 if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)))
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
169 gaim_request_field_choice_set_value(field,
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
170 g_slist_index(gtk_radio_button_get_group(button), button));
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
171 }
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
172
db204c4a411b [gaim-migrate @ 6263]
Christian Hammond <chipx86@chipx86.com>
parents: 5817
diff changeset
173 static void
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
174 multifield_ok_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
175 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
176 if (data->cbs[0] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
177 ((GaimRequestFieldsCb)data->cbs[0])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
178 data->u.multifield.fields);
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 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
181 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
182
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
183 static void
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
184 multifield_cancel_cb(GtkWidget *button, GaimGtkRequestData *data)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
185 {
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
186 if (data->cbs[1] != NULL)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
187 ((GaimRequestFieldsCb)data->cbs[1])(data->user_data,
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
188 data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
189
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
190 gaim_request_close(GAIM_REQUEST_FIELDS, data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
191 }
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
192
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 #define STOCK_ITEMIZE(r, l) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 if (!strcmp((r), text)) \
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195 return (l);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 static const char *
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
198 text_to_stock(const char *text)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 {
6334
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
200 STOCK_ITEMIZE(_("Yes"), GTK_STOCK_YES);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
201 STOCK_ITEMIZE(_("No"), GTK_STOCK_NO);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
202 STOCK_ITEMIZE(_("OK"), GTK_STOCK_OK);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
203 STOCK_ITEMIZE(_("Cancel"), GTK_STOCK_CANCEL);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
204 STOCK_ITEMIZE(_("Apply"), GTK_STOCK_APPLY);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
205 STOCK_ITEMIZE(_("Close"), GTK_STOCK_CLOSE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
206 STOCK_ITEMIZE(_("Delete"), GTK_STOCK_DELETE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
207 STOCK_ITEMIZE(_("Add"), GTK_STOCK_ADD);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
208 STOCK_ITEMIZE(_("Remove"), GTK_STOCK_REMOVE);
930708df05dd [gaim-migrate @ 6833]
Christian Hammond <chipx86@chipx86.com>
parents: 6326
diff changeset
209 STOCK_ITEMIZE(_("Save"), GTK_STOCK_SAVE);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
211 return text;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
212 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
213
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
214 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 gaim_gtk_request_input(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216 const char *secondary, const char *default_value,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
217 gboolean multiline, gboolean masked,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 const char *cancel_text, GCallback cancel_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220 void *user_data)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
221 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
222 GaimGtkRequestData *data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
223 GtkWidget *dialog;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 GtkWidget *vbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225 GtkWidget *hbox;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 GtkWidget *label;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 GtkWidget *entry;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228 GtkWidget *img;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 char *label_text;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
231 data = g_new0(GaimGtkRequestData, 1);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 data->type = GAIM_REQUEST_INPUT;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 data->user_data = user_data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 data->cb_count = 2;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236 data->cbs = g_new0(GCallback, 2);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
237
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
238 data->cbs[0] = ok_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
239 data->cbs[1] = cancel_cb;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 /* Create the dialog. */
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
242 dialog = gtk_dialog_new_with_buttons(title, NULL, 0,
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
243 text_to_stock(cancel_text), 1,
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
244 text_to_stock(ok_text), 0,
5485
c103ba09c62a [gaim-migrate @ 5881]
Sean Egan <seanegan@gmail.com>
parents: 5480
diff changeset
245 NULL);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 data->dialog = dialog;
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 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
249 G_CALLBACK(input_response_cb), data);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 /* Setup the dialog */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
253 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
254 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
256 gtk_dialog_set_default_response(GTK_DIALOG(dialog), 0);
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
259 /* Setup the main horizontal box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
260 hbox = gtk_hbox_new(FALSE, 12);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
261 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
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 /* Dialog icon. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 GTK_ICON_SIZE_DIALOG);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 /* Vertical box */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 vbox = gtk_vbox_new(FALSE, 12);
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_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274 /* Descriptive label */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 label_text = g_strdup_printf("<span weight=\"bold\" size=\"larger\">"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
276 "%s</span>%s%s",
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
277 primary,
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
278 (secondary ? "\n\n" : ""),
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
279 (secondary ? secondary : ""));
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 label = gtk_label_new(NULL);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
282
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
283 gtk_label_set_markup(GTK_LABEL(label), label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
284 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
285 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
286 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
288 g_free(label_text);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
289
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
290 /* Entry field. */
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
291 data->u.input.multiline = multiline;
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 if (multiline) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
294 GtkWidget *sw;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
295
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
296 sw = gtk_scrolled_window_new(NULL, NULL);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
297 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
298 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
299 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw),
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
300 GTK_SHADOW_IN);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
301
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
302 gtk_widget_set_size_request(sw, 320, 130);
5490
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 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
305
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
306 entry = gtk_text_view_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
307 gtk_text_view_set_editable(GTK_TEXT_VIEW(entry), TRUE);
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
308 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
309
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
310 #ifdef USE_GTKSPELL
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
311 if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
312 gtkspell_new_attach(GTK_TEXT_VIEW(entry), NULL, NULL);
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
313 #endif
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
314
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
315 gtk_container_add(GTK_CONTAINER(sw), entry);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
316
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
317 if (default_value != NULL) {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
318 GtkTextBuffer *buffer;
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
319
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
320 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(entry));
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
321 gtk_text_buffer_set_text(buffer, default_value, -1);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
322 }
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 else {
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
325 entry = gtk_entry_new();
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
326
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
327 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
328
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
329 gtk_box_pack_start(GTK_BOX(vbox), entry, FALSE, FALSE, 0);
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
330
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
331 if (default_value != NULL)
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
332 gtk_entry_set_text(GTK_ENTRY(entry), default_value);
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
333
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
334 if (masked)
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
335 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
5490
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
336 }
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
337
421020171808 [gaim-migrate @ 5886]
Christian Hammond <chipx86@chipx86.com>
parents: 5485
diff changeset
338 data->u.input.entry = entry;
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 /* Show everything. */
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 gtk_widget_show_all(dialog);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 return data;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
346 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
347 gaim_gtk_request_choice(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
348 const char *secondary, unsigned int default_value,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
349 const char *ok_text, GCallback ok_cb,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
350 const char *cancel_text, GCallback cancel_cb,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
351 void *user_data, size_t choice_count, va_list args)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
352 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
353 return NULL;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
354 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
355
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
356 static void *
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
357 gaim_gtk_request_action(const char *title, const char *primary,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
358 const char *secondary, unsigned int default_action,
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
359 void *user_data, size_t action_count, va_list actions)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
360 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
361 GaimGtkRequestData *data;
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
362 GtkWidget *dialog;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
363 GtkWidget *vbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
364 GtkWidget *hbox;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
365 GtkWidget *label;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
366 GtkWidget *img;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
367 void **buttons;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
368 char *label_text;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
369 int i;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
370
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
371 data = g_new0(GaimGtkRequestData, 1);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
372 data->type = GAIM_REQUEST_ACTION;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
373 data->user_data = user_data;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
374
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
375 data->cb_count = action_count;
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
376 data->cbs = g_new0(GCallback, action_count);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
377
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
378 /* Reverse the buttons */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
379 buttons = g_new0(void *, action_count * 2);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
380
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
381 for (i = 0; i < action_count * 2; i += 2) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
382 buttons[(action_count * 2) - i - 2] = va_arg(actions, char *);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
383 buttons[(action_count * 2) - i - 1] = va_arg(actions, GCallback);
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 /* Create the dialog. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
387 data->dialog = dialog = gtk_dialog_new();
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6363
diff changeset
388
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
389 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
390 gtk_window_set_title(GTK_WINDOW(dialog), title);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
391
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
392 for (i = 0; i < action_count; i++) {
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
393 gtk_dialog_add_button(GTK_DIALOG(dialog),
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
394 text_to_stock(buttons[2 * i]), i);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
395
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
396 data->cbs[i] = buttons[2 * i + 1];
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
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
399 g_free(buttons);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
400
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
401 g_signal_connect(G_OBJECT(dialog), "response",
5794
5e93fc46d1af [gaim-migrate @ 6219]
Christian Hammond <chipx86@chipx86.com>
parents: 5510
diff changeset
402 G_CALLBACK(action_response_cb), data);
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
403
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
404 /* Setup the dialog */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
405 gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
406 gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
407 gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
408 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(dialog)->vbox), 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
409 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
410
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
411 /* Setup the main horizontal box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
412 hbox = gtk_hbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
413 gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), hbox);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
414
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
415 /* Dialog icon. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
416 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
417 GTK_ICON_SIZE_DIALOG);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
418 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
419 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
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 /* Vertical box */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
422 vbox = gtk_vbox_new(FALSE, 12);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
423 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
424
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
425 /* Descriptive label */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
426 label_text = g_strdup_printf("<span weight=\"bold\" size=\"larger\">"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
427 "%s</span>%s%s",
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
428 primary,
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
429 (secondary ? "\n\n" : ""),
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
430 (secondary ? secondary : ""));
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
431
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
432 label = gtk_label_new(NULL);
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 gtk_label_set_markup(GTK_LABEL(label), label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
435 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
436 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
437 gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
438
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
439 g_free(label_text);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
440
5510
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
441 if (default_action != -1)
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
442 gtk_dialog_set_default_response(GTK_DIALOG(dialog), default_action);
da18a02c3705 [gaim-migrate @ 5909]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
443
5496
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
444 /* Show everything. */
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
445 gtk_widget_show_all(dialog);
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
446
b7c0be69c749 [gaim-migrate @ 5892]
Christian Hammond <chipx86@chipx86.com>
parents: 5490
diff changeset
447 return data;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
448 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
449
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
450 static void *
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
451 gaim_gtk_request_fields(const char *title, const char *primary,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
452 const char *secondary, GaimRequestFields *fields,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
453 const char *ok_text, GCallback ok_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
454 const char *cancel_text, GCallback cancel_cb,
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
455 void *user_data)
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
456 {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
457 GaimGtkRequestData *data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
458 GtkWidget *win;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
459 GtkWidget *vbox;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
460 GtkWidget *hbox;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
461 GtkWidget *bbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
462 GtkWidget *frame;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
463 GtkWidget *label;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
464 GtkWidget *table;
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
465 GtkWidget *button;
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
466 GtkWidget *img;
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
467 GtkSizeGroup *sg;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
468 GList *gl, *fl;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
469 GaimRequestFieldGroup *group;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
470 GaimRequestField *field;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
471 char *text;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
472 char *label_text;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
473
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
474 data = g_new0(GaimGtkRequestData, 1);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
475 data->type = GAIM_REQUEST_FIELDS;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
476 data->user_data = user_data;
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
477 data->u.multifield.fields = fields;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
478
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
479 data->cb_count = 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
480 data->cbs = g_new0(GCallback, 2);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
481
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
482 data->cbs[0] = ok_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
483 data->cbs[1] = cancel_cb;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
484
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
485 data->dialog = win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
486
6109
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
487 if (title != NULL)
0922bb7a7bbc [gaim-migrate @ 6571]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
488 gtk_window_set_title(GTK_WINDOW(win), title);
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
489
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
490 gtk_window_set_role(GTK_WINDOW(win), "multifield");
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
491 gtk_container_set_border_width(GTK_CONTAINER(win), 12);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
492 gtk_window_set_resizable(GTK_WINDOW(win), FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
493
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
494 /* Setup the main horizontal box */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
495 hbox = gtk_hbox_new(FALSE, 12);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
496 gtk_container_add(GTK_CONTAINER(win), hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
497 gtk_widget_show(hbox);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
498
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
499 /* Dialog icon. */
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
500 img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_QUESTION,
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
501 GTK_ICON_SIZE_DIALOG);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
502 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
503 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
504 gtk_widget_show(img);
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
505
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
506 /* Setup the vbox */
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
507 vbox = gtk_vbox_new(FALSE, 12);
6326
f6480d79cb89 [gaim-migrate @ 6825]
Christian Hammond <chipx86@chipx86.com>
parents: 6325
diff changeset
508 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
509 gtk_widget_show(vbox);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
510
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
511 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
512
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
513 if (primary != NULL || secondary != NULL) {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
514 label_text = g_strdup_printf("<span weight=\"bold\" size=\"larger\">"
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
515 "%s</span>%s%s",
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
516 (primary ? primary : ""),
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
517 (secondary ? "\n\n" : ""),
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
518 (secondary ? secondary : ""));
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
519
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
520 label = gtk_label_new(NULL);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
521
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
522 gtk_label_set_markup(GTK_LABEL(label), label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
523 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
524 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
525 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
526 gtk_widget_show(label);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
527
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
528 g_free(label_text);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
529 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
530
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
531 for (gl = gaim_request_fields_get_groups(fields);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
532 gl != NULL;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
533 gl = gl->next) {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
534
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
535 GList *field_list;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
536 size_t field_count = 0;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
537 size_t cols = 1;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
538 size_t rows;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
539 size_t col_num;
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
540 size_t row_num = 0;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
541
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
542 group = gl->data;
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
543 field_list = gaim_request_field_group_get_fields(group);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
544
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
545 if (gaim_request_field_group_get_title(group) != NULL) {
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
546 frame = gaim_gtk_make_frame(vbox,
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
547 gaim_request_field_group_get_title(group));
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
548 }
6325
de67cb0dd09d [gaim-migrate @ 6824]
Christian Hammond <chipx86@chipx86.com>
parents: 6324
diff changeset
549 else
6324
01ce15fb27eb [gaim-migrate @ 6823]
Christian Hammond <chipx86@chipx86.com>
parents: 6110
diff changeset
550 frame = vbox;
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
551
5816
64a164aa6f70 [gaim-migrate @ 6246]
Christian Hammond <chipx86@chipx86.com>
parents: 5815
diff changeset
552 field_count = g_list_length(field_list);
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
553
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
554 if (field_count > 9) {
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
555 rows = field_count / 2;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
556 cols++;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
557 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
558 else
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
559 rows = field_count;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
560
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
561 for (fl = field_list; fl != NULL; fl = fl->next) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
562 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
563
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
564 field = (GaimRequestField *)fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
565
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
566 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
567
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
568 if (type == GAIM_REQUEST_FIELD_STRING &&
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
569 gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
570
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
571 rows += 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
572 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
573 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
574
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
575 table = gtk_table_new(rows, 2 * cols, FALSE);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
576 gtk_table_set_row_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
577 gtk_table_set_col_spacings(GTK_TABLE(table), 6);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
578
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
579 gtk_container_add(GTK_CONTAINER(frame), table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
580 gtk_widget_show(table);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
581
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
582 for (row_num = 0, fl = field_list;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
583 row_num < rows && fl != NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
584 row_num++) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
585
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
586 for (col_num = 0;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
587 col_num < cols && fl != NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
588 col_num++, fl = fl->next) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
589
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
590 size_t col_offset = col_num * 2;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
591 GaimRequestFieldType type;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
592 GtkWidget *widget = NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
593
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
594 field = fl->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
595
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
596 type = gaim_request_field_get_type(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
597
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
598 if (type != GAIM_REQUEST_FIELD_BOOLEAN) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
599 text = g_strdup_printf("%s:",
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
600 gaim_request_field_get_label(field));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
601
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
602 label = gtk_label_new(NULL);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
603 gtk_label_set_markup_with_mnemonic(GTK_LABEL(label), text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
604 g_free(text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
605
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
606 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
607
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
608 gtk_size_group_add_widget(sg, label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
609
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
610 if (type == GAIM_REQUEST_FIELD_STRING &&
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
611 gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
612
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
613 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
614 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
615 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
616
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
617 row_num++;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
618 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
619 else {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
620 gtk_table_attach_defaults(GTK_TABLE(table), label,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
621 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
622 row_num, row_num + 1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
623 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
624
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
625 gtk_widget_show(label);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
626 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
627
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
628 if (type == GAIM_REQUEST_FIELD_STRING) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
629 const char *value;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
630
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
631 value = gaim_request_field_string_get_default_value(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
632
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
633 if (gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
634 GtkWidget *textview;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
635
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
636 widget = gtk_scrolled_window_new(NULL, NULL);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
637 gtk_scrolled_window_set_shadow_type(
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
638 GTK_SCROLLED_WINDOW(widget),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
639 GTK_SHADOW_IN);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
640 gtk_scrolled_window_set_policy(
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
641 GTK_SCROLLED_WINDOW(widget),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
642 GTK_POLICY_NEVER,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
643 GTK_POLICY_AUTOMATIC);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
644
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
645 textview = gtk_text_view_new();
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
646 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
647 TRUE);
7068
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
648 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(textview),
faddd59a0e74 [gaim-migrate @ 7632]
Christian Hammond <chipx86@chipx86.com>
parents: 7066
diff changeset
649 GTK_WRAP_WORD_CHAR);
7066
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
650
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
651 #ifdef USE_GTKSPELL
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
652 if (gaim_prefs_get_bool(
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
653 "/gaim/gtk/conversations/spellcheck"))
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
654 {
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
655 gtkspell_new_attach(GTK_TEXT_VIEW(widget),
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
656 NULL, NULL);
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
657 }
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
658 #endif
87bfe52a4099 [gaim-migrate @ 7630]
Christian Hammond <chipx86@chipx86.com>
parents: 7048
diff changeset
659
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
660 gtk_container_add(GTK_CONTAINER(widget), textview);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
661 gtk_widget_show(textview);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
662
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
663 gtk_widget_set_size_request(widget, -1, 75);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
664
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
665 if (value != NULL) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
666 GtkTextBuffer *buffer;
7036
b3896e1eca2a [gaim-migrate @ 7599]
Christian Hammond <chipx86@chipx86.com>
parents: 7035
diff changeset
667
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
668 buffer = gtk_text_view_get_buffer(
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
669 GTK_TEXT_VIEW(textview));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
670
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
671 gtk_text_buffer_set_text(buffer, value, -1);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
672 }
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
673
7142
cef309da8793 [gaim-migrate @ 7709]
Christian Hammond <chipx86@chipx86.com>
parents: 7074
diff changeset
674 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview),
7048
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
675 gaim_request_field_string_is_editable(field));
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
676
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
677 g_signal_connect(G_OBJECT(textview), "focus-out-event",
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
678 G_CALLBACK(field_string_focus_out_cb),
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
679 field);
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
680 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
681 else {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
682 widget = gtk_entry_new();
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
683
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
684 if (value != NULL)
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
685 gtk_entry_set_text(GTK_ENTRY(widget), value);
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
686
7048
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
687 gtk_entry_set_visibility(GTK_ENTRY(widget),
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
688 !gaim_request_field_string_is_masked(field));
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
689
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
690 gtk_editable_set_editable(GTK_EDITABLE(widget),
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
691 gaim_request_field_string_is_editable(field));
3f9e106dfeef [gaim-migrate @ 7611]
Christian Hammond <chipx86@chipx86.com>
parents: 7039
diff changeset
692
6338
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
693 g_signal_connect(G_OBJECT(widget), "focus-out-event",
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
694 G_CALLBACK(field_string_focus_out_cb),
644ebf75f686 [gaim-migrate @ 6837]
Christian Hammond <chipx86@chipx86.com>
parents: 6337
diff changeset
695 field);
6337
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
696 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
697 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
698 else if (type == GAIM_REQUEST_FIELD_INTEGER) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
699 int value;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
700
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
701 widget = gtk_entry_new();
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
702
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
703 value = gaim_request_field_int_get_default_value(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
704
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
705 if (value != 0) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
706 char buf[32];
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
707
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
708 g_snprintf(buf, sizeof(buf), "%d", value);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
709
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
710 gtk_entry_set_text(GTK_ENTRY(widget), buf);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
711 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
712
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
713 g_signal_connect(G_OBJECT(widget), "focus-out-event",
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
714 G_CALLBACK(field_int_focus_out_cb),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
715 field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
716 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
717 else if (type == GAIM_REQUEST_FIELD_BOOLEAN) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
718 widget = gtk_check_button_new_with_label(
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
719 gaim_request_field_get_label(field));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
720
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
721 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(widget),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
722 gaim_request_field_bool_get_default_value(field));
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
723
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
724 g_signal_connect(G_OBJECT(widget), "toggled",
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
725 G_CALLBACK(field_bool_cb), field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
726 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
727 else if (type == GAIM_REQUEST_FIELD_CHOICE) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
728 GList *labels;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
729 GList *l;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
730
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
731 labels = gaim_request_field_choice_get_labels(field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
732
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
733 if (g_list_length(labels) > 5) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
734 GtkWidget *menu;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
735 GtkWidget *item;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
736
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
737 widget = gtk_option_menu_new();
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
738
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
739 menu = gtk_menu_new();
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
740
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
741 gtk_option_menu_set_menu(GTK_OPTION_MENU(widget), menu);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
742
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
743 for (l = labels; l != NULL; l = l->next) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
744 const char *text = l->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
745
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
746 item = gtk_menu_item_new_with_label(text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
747
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
748 gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
749 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
750
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
751 g_signal_connect(G_OBJECT(widget), "changed",
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
752 G_CALLBACK(field_choice_menu_cb),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
753 field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
754 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
755 else {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
756 GtkWidget *box;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
757 GtkWidget *first_radio = NULL;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
758 GtkWidget *radio;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
759
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
760 if (g_list_length(labels) == 2)
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
761 box = gtk_hbox_new(FALSE, 6);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
762 else
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
763 box = gtk_vbox_new(FALSE, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
764
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
765 widget = box;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
766
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
767 for (l = labels; l != NULL; l = l->next) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
768 const char *text = l->data;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
769
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
770 radio =
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
771 gtk_radio_button_new_with_label_from_widget(
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
772 GTK_RADIO_BUTTON(first_radio), text);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
773
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
774 if (first_radio == NULL)
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
775 first_radio = radio;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
776
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
777 gtk_box_pack_start(GTK_BOX(box), radio,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
778 TRUE, TRUE, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
779 gtk_widget_show(radio);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
780
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
781 g_signal_connect(G_OBJECT(radio), "toggled",
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
782 G_CALLBACK(field_choice_option_cb),
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
783 field);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
784 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
785 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
786 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
787
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
788 if (type == GAIM_REQUEST_FIELD_STRING &&
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
789 gaim_request_field_string_is_multiline(field)) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
790
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
791 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
792 0, 2 * cols,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
793 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
794 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
795 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
796 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
797 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
798 else if (type != GAIM_REQUEST_FIELD_BOOLEAN) {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
799 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
800 col_offset + 1, col_offset + 2,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
801 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
802 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
803 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
804 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
805 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
806 else {
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
807 gtk_table_attach(GTK_TABLE(table), widget,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
808 col_offset, col_offset + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
809 row_num, row_num + 1,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
810 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
811 GTK_FILL | GTK_EXPAND,
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
812 5, 0);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
813 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
814
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
815 gtk_widget_show(widget);
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
816
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
817 field->ui_data = widget;
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
818 }
957c1d28b96a [gaim-migrate @ 6836]
Christian Hammond <chipx86@chipx86.com>
parents: 6335
diff changeset
819 }
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
820 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
821
5813
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
822 g_object_unref(sg);
b116f3a73256 [gaim-migrate @ 6243]
Christian Hammond <chipx86@chipx86.com>
parents: 5811
diff changeset
823
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
824 /* Button box. */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
825 bbox = gtk_hbutton_box_new();
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
826 gtk_box_set_spacing(GTK_BOX(bbox), 6);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
827 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
828 gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
829 gtk_widget_show(bbox);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
830
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
831 /* Cancel button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
832 button = gtk_button_new_from_stock(text_to_stock(cancel_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
833 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
834 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
835
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
836 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
837 G_CALLBACK(multifield_cancel_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
838
5815
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
839 /* OK button */
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
840 button = gtk_button_new_from_stock(text_to_stock(ok_text));
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
841 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
842 gtk_widget_show(button);
c900fc823a21 [gaim-migrate @ 6245]
Christian Hammond <chipx86@chipx86.com>
parents: 5813
diff changeset
843
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
844 g_signal_connect(G_OBJECT(button), "clicked",
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
845 G_CALLBACK(multifield_ok_cb), data);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
846
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
847 gtk_widget_show(win);
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
848
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
849 return data;
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
850 }
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
851
6363
b7ef10bbe9bb [gaim-migrate @ 6868]
Christian Hammond <chipx86@chipx86.com>
parents: 6338
diff changeset
852 static void
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
853 gaim_gtk_close_request(GaimRequestType type, void *ui_handle)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
854 {
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
855 GaimGtkRequestData *data = (GaimGtkRequestData *)ui_handle;
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
856
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
857 if (data->cbs != NULL)
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
858 g_free(data->cbs);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
859
5817
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
860 if (type == GAIM_REQUEST_FIELDS)
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
861 gaim_request_fields_destroy(data->u.multifield.fields);
571e895bf6ba [gaim-migrate @ 6247]
Christian Hammond <chipx86@chipx86.com>
parents: 5816
diff changeset
862
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
863 gtk_widget_destroy(data->dialog);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
864
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
865 g_free(data);
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
866 }
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
867
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
868 static GaimRequestUiOps ops =
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
869 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
870 gaim_gtk_request_input,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
871 gaim_gtk_request_choice,
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
872 gaim_gtk_request_action,
5811
9467bff78029 [gaim-migrate @ 6241]
Christian Hammond <chipx86@chipx86.com>
parents: 5794
diff changeset
873 gaim_gtk_request_fields,
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
874 gaim_gtk_close_request
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
875 };
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
876
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
877 GaimRequestUiOps *
7035
feb3d21a7794 [gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
878 gaim_gtk_request_get_ui_ops(void)
5480
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
879 {
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
880 return &ops;
f19620d8694f [gaim-migrate @ 5876]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
881 }