Mercurial > pidgin
annotate src/prefs.c @ 3620:8856bb4b284e
[gaim-migrate @ 3734]
buf gix.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Wed, 09 Oct 2002 16:31:33 +0000 |
parents | ec86e76d0427 |
children | 9682c0e022c6 |
rev | line source |
---|---|
1 | 1 /* |
2 * gaim | |
3 * | |
3434 | 4 * Copyright (C) 1998-2002, Mark Spencer <markster@marko.net> |
1 | 5 * |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
2090
b66aca8e8dce
[gaim-migrate @ 2100]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2074
diff
changeset
|
23 #include <config.h> |
349
b402a23f35df
[gaim-migrate @ 359]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
340
diff
changeset
|
24 #endif |
1 | 25 #include <string.h> |
26 #include <sys/time.h> | |
27 | |
28 #include <sys/types.h> | |
29 #include <sys/stat.h> | |
30 | |
31 #include <unistd.h> | |
32 #include <stdio.h> | |
33 #include <stdlib.h> | |
970 | 34 #include <stdarg.h> |
3379 | 35 #include <ctype.h> |
1 | 36 #include <gtk/gtk.h> |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
37 #include "gtkimhtml.h" |
1 | 38 #include "gaim.h" |
1357
783ba886b6b6
[gaim-migrate @ 1367]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1324
diff
changeset
|
39 #include "prpl.h" |
3366 | 40 #include "proxy.h" |
41 | |
42 /* temporary preferences */ | |
43 static guint misc_options_new; | |
44 static guint logging_options_new; | |
45 static guint blist_options_new; | |
46 static guint convo_options_new; | |
47 static guint im_options_new; | |
48 static guint chat_options_new; | |
49 static guint font_options_new; | |
50 static guint sound_options_new; | |
51 static char *sound_file_new[NUM_SOUNDS]; | |
52 static guint away_options_new; | |
53 static guint away_resend_new; | |
54 static int auto_away_new; | |
55 static int report_idle_new; | |
56 static int proxytype_new; | |
57 static struct away_message* default_away_new; | |
58 static int web_browser_new; | |
59 static char sound_cmd_new[2048]; | |
60 static char web_command_new[2048]; | |
61 static int fontsize_new; | |
62 GdkColor fgcolor_new, bgcolor_new; | |
63 static struct window_size conv_size_new, buddy_chat_size_new; | |
64 char fontface_new[128]; | |
65 char fontface[128]; | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
66 |
3567 | 67 GtkWidget *tree_v = NULL; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
68 GtkWidget *prefs_away_list = NULL; |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1087
diff
changeset
|
69 GtkWidget *prefs_away_menu = NULL; |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
70 GtkWidget *preftree = NULL; |
3366 | 71 GtkWidget *fontseld = NULL; |
72 | |
3379 | 73 GtkListStore *prefs_away_store = NULL; |
3366 | 74 |
75 static int sound_row_sel = 0; | |
76 static char *last_sound_dir = NULL; | |
77 | |
78 static GtkWidget *sounddialog = NULL; | |
79 static GtkWidget *browser_entry = NULL; | |
80 static GtkWidget *sound_entry = NULL; | |
81 static GtkWidget *away_text = NULL; | |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
82 GtkCTreeNode *general_node = NULL; |
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
83 GtkCTreeNode *deny_node = NULL; |
2254 | 84 GtkWidget *prefs_proxy_frame = NULL; |
3366 | 85 static GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); |
3427 | 86 GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int, GtkSizeGroup *); |
3366 | 87 static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...); |
88 static GtkWidget *show_color_pref(GtkWidget *, gboolean); | |
89 static void delete_prefs(GtkWidget *, void *); | |
90 void set_default_away(GtkWidget *, gpointer); | |
3500 | 91 static void apply_prefs(); |
1026 | 92 |
3366 | 93 struct debug_window *dw = NULL; |
3565 | 94 GtkWidget *prefs = NULL; |
3366 | 95 GtkWidget *debugbutton = NULL; |
3565 | 96 static int notebook_page = 0; |
97 static GtkTreeIter plugin_iter; | |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
98 |
3366 | 99 void delete_prefs(GtkWidget *asdf, void *gdsa) { |
100 int v; | |
3500 | 101 |
3485 | 102 prefs = NULL; |
103 for (v = 0; v < NUM_SOUNDS; v++) { | |
104 if (sound_file_new[v]) { | |
3366 | 105 g_free(sound_file_new[v]); |
3551 | 106 sound_file_new[v] = NULL; |
3485 | 107 } |
108 } | |
3567 | 109 tree_v = NULL; |
3485 | 110 sound_entry = NULL; |
111 browser_entry = NULL; | |
3526 | 112 debugbutton = NULL; |
113 prefs_away_menu = NULL; | |
3565 | 114 notebook_page = 0; |
3485 | 115 if(sounddialog) |
3379 | 116 gtk_widget_destroy(sounddialog); |
3500 | 117 g_object_unref(G_OBJECT(prefs_away_store)); |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
118 } |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
119 |
3366 | 120 GtkWidget *preflabel; |
121 GtkWidget *prefsnotebook; | |
122 GtkTreeStore *prefstree; | |
1750
d2eca7a46cfd
[gaim-migrate @ 1760]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1711
diff
changeset
|
123 |
3500 | 124 static void set_misc_options(); |
3366 | 125 static void set_logging_options(); |
3500 | 126 static void set_blist_options(); |
3366 | 127 static void set_convo_options(); |
128 static void set_im_options(); | |
129 static void set_chat_options(); | |
130 static void set_font_options(); | |
131 static void set_sound_options(); | |
132 static void set_away_options(); | |
1750
d2eca7a46cfd
[gaim-migrate @ 1760]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1711
diff
changeset
|
133 |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
134 #define PROXYHOST 0 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
135 #define PROXYPORT 1 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
136 #define PROXYTYPE 2 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
137 #define PROXYUSER 3 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
138 #define PROXYPASS 4 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
139 static void proxy_print_option(GtkEntry *entry, int entrynum) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
140 { |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
141 if (entrynum == PROXYHOST) |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
142 g_snprintf(proxyhost, sizeof(proxyhost), "%s", gtk_entry_get_text(entry)); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
143 else if (entrynum == PROXYPORT) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
144 proxyport = atoi(gtk_entry_get_text(entry)); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
145 else if (entrynum == PROXYUSER) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
146 g_snprintf(proxyuser, sizeof(proxyuser), "%s", gtk_entry_get_text(entry)); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
147 else if (entrynum == PROXYPASS) |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
148 g_snprintf(proxypass, sizeof(proxypass), "%s", gtk_entry_get_text(entry)); |
3500 | 149 apply_prefs(); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
150 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
151 |
3366 | 152 |
3565 | 153 GtkWidget *make_frame(GtkWidget *ret, char *text) { |
3427 | 154 GtkWidget *vbox, *label, *hbox; |
155 char labeltext[256]; | |
3500 | 156 |
3427 | 157 vbox = gtk_vbox_new(FALSE, 6); |
158 gtk_box_pack_start(GTK_BOX(ret), vbox, FALSE, FALSE, 0); | |
159 label = gtk_label_new(NULL); | |
160 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\">%s</span>", text); | |
161 gtk_label_set_markup(GTK_LABEL(label), labeltext); | |
162 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
163 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); | |
164 hbox = gtk_hbox_new(FALSE, 6); | |
165 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); | |
166 label = gtk_label_new(" "); | |
167 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
168 vbox = gtk_vbox_new(FALSE, 6); | |
169 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); | |
170 return vbox; | |
171 } | |
172 | |
3366 | 173 /* OK, Apply and Cancel */ |
174 | |
175 static void apply_cb(GtkWidget *button, void *data) | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
176 { |
3500 | 177 apply_prefs(); |
178 } | |
179 | |
180 static void apply_prefs() | |
181 { | |
3366 | 182 int r; |
183 if (misc_options != misc_options_new) | |
184 set_misc_options(); | |
185 if (logging_options != logging_options_new) | |
186 set_logging_options(); | |
187 if (blist_options != blist_options_new) | |
188 set_blist_options(); | |
3500 | 189 if (convo_options != convo_options_new) |
3366 | 190 set_convo_options(); |
3500 | 191 if (im_options != im_options_new) |
3366 | 192 set_im_options(); |
3500 | 193 if (chat_options != chat_options_new) |
3366 | 194 set_chat_options(); |
195 chat_options = chat_options_new; | |
3500 | 196 if (font_options != font_options_new) |
3366 | 197 set_font_options(); |
3500 | 198 if (sound_options != sound_options_new) |
3366 | 199 set_sound_options(); |
200 for (r = 0; r < NUM_SOUNDS; r++) { | |
201 if (sound_file[r]) | |
202 g_free(sound_file[r]); | |
3485 | 203 sound_file[r] = g_strdup(sound_file_new[r]); |
3366 | 204 } |
3500 | 205 if (away_options != away_options_new) |
3366 | 206 set_away_options(); |
207 away_resend = away_resend_new; | |
208 auto_away = auto_away_new; | |
209 report_idle = report_idle_new; | |
210 web_browser = web_browser_new; | |
3500 | 211 proxytype = proxytype_new; |
3366 | 212 default_away = default_away_new; |
213 fontsize = fontsize_new; | |
214 g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", sound_cmd_new); | |
215 g_snprintf(web_command, sizeof(web_command), "%s", web_command_new); | |
216 memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); | |
3500 | 217 memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); |
3366 | 218 memcpy(&fgcolor, &fgcolor_new, sizeof(GdkColor)); |
219 memcpy(&bgcolor, &bgcolor_new, sizeof(GdkColor)); | |
2254 | 220 |
3366 | 221 |
222 g_snprintf(fontface, sizeof(fontface), fontface_new); | |
223 update_convo_font(); | |
224 update_convo_color(); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
225 save_prefs(); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
226 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
227 |
3366 | 228 |
229 static void ok_cb(GtkWidget *button, void *data) | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
230 { |
3366 | 231 apply_cb(button, data); |
232 gtk_widget_destroy(prefs); | |
233 } | |
3427 | 234 |
3366 | 235 static void pref_nb_select(GtkTreeSelection *sel, GtkNotebook *nb) { |
236 GtkTreeIter iter; | |
3427 | 237 char text[128]; |
3366 | 238 GValue val = { 0, }; |
239 GtkTreeModel *model = GTK_TREE_MODEL(prefstree); | |
3500 | 240 |
3366 | 241 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
242 return; | |
243 gtk_tree_model_get_value (model, &iter, 1, &val); | |
3500 | 244 g_snprintf(text, sizeof(text), "<span weight=\"bold\" size=\"larger\">%s</span>", |
3427 | 245 g_value_get_string(&val)); |
246 gtk_label_set_markup (GTK_LABEL(preflabel), text); | |
3366 | 247 g_value_unset (&val); |
248 gtk_tree_model_get_value (model, &iter, 2, &val); | |
249 gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook), g_value_get_int (&val)); | |
250 | |
251 } | |
252 | |
253 /* These are the pages in the preferences notebook */ | |
254 GtkWidget *interface_page() { | |
255 GtkWidget *ret; | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
256 GtkWidget *vbox; |
3427 | 257 ret = gtk_vbox_new(FALSE, 18); |
258 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 259 |
3427 | 260 vbox = make_frame(ret, _("Interface Options")); |
261 /* This shouldn't have to wait for user to click OK or APPLY or whatnot */ | |
262 /* This really shouldn't be in preferences at all */ | |
3500 | 263 debugbutton = gaim_button(_("Show _Debug Window"), &misc_options_new, OPT_MISC_DEBUG, vbox); |
264 | |
3366 | 265 |
3427 | 266 gaim_button(_("Use _borderless buttons"), &misc_options_new, OPT_MISC_COOL_LOOK, vbox); |
3500 | 267 |
3427 | 268 gtk_widget_show_all(ret); |
3366 | 269 return ret; |
270 } | |
271 | |
272 GtkWidget *font_page() { | |
273 GtkWidget *ret; | |
274 GtkWidget *button; | |
275 GtkWidget *vbox, *hbox; | |
276 GtkWidget *select = NULL; | |
3427 | 277 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
3500 | 278 |
3427 | 279 ret = gtk_vbox_new(FALSE, 18); |
280 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3500 | 281 |
3427 | 282 vbox = make_frame(ret, _("Style")); |
3500 | 283 gaim_button(_("_Bold"), &font_options_new, OPT_FONT_BOLD, vbox); |
3427 | 284 gaim_button(_("_Italics"), &font_options_new, OPT_FONT_ITALIC, vbox); |
285 gaim_button(_("_Underline"), &font_options_new, OPT_FONT_UNDERLINE, vbox); | |
286 gaim_button(_("_Strikethough"), &font_options_new, OPT_FONT_STRIKE, vbox); | |
3500 | 287 |
3427 | 288 vbox = make_frame(ret, _("Face")); |
289 hbox = gtk_hbox_new(FALSE, 6); | |
290 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
291 button = gaim_button(_("Use custo_m face"), &font_options_new, OPT_FONT_FACE, hbox); | |
292 gtk_size_group_add_widget(sg, button); | |
293 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); | |
3366 | 294 |
295 if (!(font_options_new & OPT_FONT_FACE)) | |
296 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
297 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); | |
3500 | 298 gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_font_dialog), NULL); |
3366 | 299 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); |
300 | |
301 hbox = gtk_hbox_new(FALSE, 5); | |
302 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3427 | 303 button = gaim_button(_("Use custom si_ze"), &font_options_new, OPT_FONT_SIZE, hbox); |
304 gtk_size_group_add_widget(sg, button); | |
305 select = gaim_labeled_spin_button(hbox, NULL, &fontsize_new, 1, 7, NULL); | |
3366 | 306 if (!(font_options_new & OPT_FONT_SIZE)) |
307 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
308 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); | |
309 | |
3500 | 310 vbox = make_frame(ret, _("Color")); |
3366 | 311 hbox = gtk_hbox_new(FALSE, 5); |
312 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3500 | 313 |
314 | |
3427 | 315 button = gaim_button(_("_Text color"), &font_options_new, OPT_FONT_FGCOL, hbox); |
316 gtk_size_group_add_widget(sg, button); | |
317 | |
318 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
319 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
3366 | 320 pref_fg_picture = show_color_pref(hbox, TRUE); |
321 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), | |
322 pref_fg_picture); | |
3427 | 323 |
3366 | 324 if (!(font_options_new & OPT_FONT_FGCOL)) |
325 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
326 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); | |
327 gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_fgcolor_dialog), NULL); | |
328 hbox = gtk_hbox_new(FALSE, 5); | |
329 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3500 | 330 |
3427 | 331 button = gaim_button(_("Bac_kground color"), &font_options_new, OPT_FONT_BGCOL, hbox); |
332 gtk_size_group_add_widget(sg, button); | |
333 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
334 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
3366 | 335 pref_bg_picture = show_color_pref(hbox, FALSE); |
3427 | 336 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), |
3366 | 337 pref_bg_picture); |
3472 | 338 |
3366 | 339 if (!(font_options_new & OPT_FONT_BGCOL)) |
340 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
341 gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_bgcolor_dialog), NULL); | |
342 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); | |
343 | |
3427 | 344 gtk_widget_show_all(ret); |
3366 | 345 return ret; |
346 } | |
347 | |
348 | |
349 GtkWidget *messages_page() { | |
350 GtkWidget *ret; | |
351 GtkWidget *vbox; | |
3427 | 352 ret = gtk_vbox_new(FALSE, 18); |
353 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 354 |
3427 | 355 vbox = make_frame (ret, _("Display")); |
356 gaim_button(_("Show graphical _smileys"), &convo_options_new, OPT_CONVO_SHOW_SMILEY, vbox); | |
357 gaim_button(_("Show _timestamp on messages"), &convo_options_new, OPT_CONVO_SHOW_TIME, vbox); | |
358 gaim_button(_("Show _URLs as links"), &convo_options_new, OPT_CONVO_SEND_LINKS, vbox); | |
359 gaim_button(_("_Highlight misspelled words"), &convo_options_new, OPT_CONVO_CHECK_SPELLING, vbox); | |
3500 | 360 |
3427 | 361 vbox = make_frame (ret, _("Ignore")); |
362 gaim_button(_("Ignore c_olors"), &convo_options_new, OPT_CONVO_IGNORE_COLOUR, vbox); | |
363 gaim_button(_("Ignore font _faces"), &convo_options_new, OPT_CONVO_IGNORE_FONTS, vbox); | |
364 gaim_button(_("Ignore font si_zes"), &convo_options_new, OPT_CONVO_IGNORE_SIZES, vbox); | |
365 gaim_button(_("Ignore Ti_K Automated Messages"), &away_options_new, OPT_AWAY_TIK_HACK, vbox); | |
3500 | 366 |
3427 | 367 gtk_widget_show_all(ret); |
3366 | 368 return ret; |
369 } | |
370 | |
371 GtkWidget *hotkeys_page() { | |
372 GtkWidget *ret; | |
373 GtkWidget *vbox; | |
3427 | 374 ret = gtk_vbox_new(FALSE, 18); |
375 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 376 |
3427 | 377 vbox = make_frame(ret, _("Send Message")); |
378 gaim_button(_("_Enter sends message"), &convo_options_new, OPT_CONVO_ENTER_SENDS, vbox); | |
379 gaim_button(_("C_ontrol-Enter sends message"), &convo_options_new, OPT_CONVO_CTL_ENTER, vbox); | |
3500 | 380 |
3427 | 381 vbox = make_frame (ret, _("Window Closing")); |
382 gaim_button(_("E_scape closes window"), &convo_options_new, OPT_CONVO_ESC_CAN_CLOSE, vbox); | |
383 gaim_button(_("Control-_W closes window"), &convo_options_new, OPT_CONVO_CTL_W_CLOSES, vbox); | |
3366 | 384 |
3427 | 385 vbox = make_frame(ret, "Insertions"); |
386 gaim_button(_("Control-{B/I/U/S} inserts _HTML tags"), &convo_options_new, OPT_CONVO_CTL_CHARS, vbox); | |
387 gaim_button(_("Control-(number) inserts _smileys"), &convo_options_new, OPT_CONVO_CTL_SMILEYS, vbox); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
388 |
3427 | 389 gtk_widget_show_all(ret); |
3366 | 390 return ret; |
391 } | |
392 | |
393 GtkWidget *list_page() { | |
394 GtkWidget *ret; | |
395 GtkWidget *vbox; | |
3427 | 396 ret = gtk_vbox_new(FALSE, 18); |
397 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 398 |
3472 | 399 /* fixme: docklet |
400 gaim_button(_("Automatically show buddy list on sign on"), &blist_options_new, | |
401 OPT_BLIST_APP_BUDDY_SHOW, vbox); | |
402 gaim_button(_("Display Buddy List near applet"), &blist_options_new, OPT_BLIST_NEAR_APPLET, vbox); */ | |
403 | |
3427 | 404 vbox = make_frame (ret, _("Buttons")); |
405 gaim_button(_("_Hide IM/Info/Chat buttons"), &blist_options_new, OPT_BLIST_NO_BUTTONS, vbox); | |
406 gaim_button(_("Show _pictures on buttons"), &blist_options_new, OPT_BLIST_SHOW_BUTTON_XPM, vbox); | |
3366 | 407 |
3427 | 408 vbox = make_frame (ret, _("Buddy List Window")); |
409 gaim_button(_("_Save Window Size/Position"), &blist_options_new, OPT_BLIST_SAVED_WINDOWS, vbox); | |
410 gaim_button(_("_Raise Window on Events"), &blist_options_new, OPT_BLIST_POPUP, vbox); | |
3366 | 411 |
3427 | 412 vbox = make_frame (ret, _("Group Display")); |
413 gaim_button(_("Hide _groups with no online buddies"), &blist_options_new, OPT_BLIST_NO_MT_GRP, vbox); | |
414 gaim_button(_("Show _numbers in groups"), &blist_options_new, OPT_BLIST_SHOW_GRPNUM, vbox); | |
3366 | 415 |
3427 | 416 vbox = make_frame (ret, _("Buddy Display")); |
417 gaim_button(_("Show buddy type _icons"), &blist_options_new, OPT_BLIST_SHOW_PIXMAPS, vbox); | |
418 gaim_button(_("Show _warning levels"), &blist_options_new, OPT_BLIST_SHOW_WARN, vbox); | |
419 gaim_button(_("Show idle _times"), &blist_options_new, OPT_BLIST_SHOW_IDLETIME, vbox); | |
420 gaim_button(_("Grey i_dle buddies"), &blist_options_new, OPT_BLIST_GREY_IDLERS, vbox); | |
3366 | 421 |
3427 | 422 gtk_widget_show_all(ret); |
3366 | 423 return ret; |
424 } | |
425 | |
426 GtkWidget *im_page() { | |
427 GtkWidget *ret; | |
3500 | 428 GtkWidget *vbox; |
3427 | 429 GtkWidget *typingbutton, *widge; |
430 GtkSizeGroup *sg; | |
3366 | 431 |
3427 | 432 ret = gtk_vbox_new(FALSE, 18); |
433 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
434 | |
435 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
436 | |
437 vbox = make_frame (ret, _("Window")); | |
3500 | 438 widge = gaim_dropdown(vbox, "Show _buttons as:", &im_options_new, OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM, |
439 "Pictures", OPT_IM_BUTTON_XPM, | |
3366 | 440 "Text", OPT_IM_BUTTON_TEXT, |
441 "Pictures and text", OPT_IM_BUTTON_XPM | OPT_IM_BUTTON_TEXT, NULL); | |
3427 | 442 gtk_size_group_add_widget(sg, widge); |
443 gtk_misc_set_alignment(GTK_MISC(widge), 0, 0); | |
444 gaim_labeled_spin_button(vbox, _("New window _width:"), &conv_size_new.width, 25, 9999, sg); | |
445 gaim_labeled_spin_button(vbox, _("New window _height:"), &conv_size_new.height, 25, 9999, sg); | |
446 gaim_labeled_spin_button(vbox, _("_Entry widget height:"), &conv_size_new.entry_height, 25, 9999, sg); | |
447 gaim_button(_("_Raise windows on events"), &im_options_new, OPT_IM_POPUP, vbox); | |
448 gaim_button(_("Hide window on _send"), &im_options_new, OPT_IM_POPDOWN, vbox); | |
3366 | 449 gtk_widget_show (vbox); |
450 | |
3427 | 451 vbox = make_frame (ret, _("Buddy Icons")); |
452 gaim_button(_("Hide Buddy _Icons"), &im_options_new, OPT_IM_HIDE_ICONS, vbox); | |
453 gaim_button(_("Disable Buddy Icon A_nimation"), &im_options_new, OPT_IM_NO_ANIMATION, vbox); | |
3366 | 454 |
3427 | 455 vbox = make_frame (ret, _("Display")); |
456 gaim_button(_("Show _logins in window"), &im_options_new, OPT_IM_LOGON, vbox); | |
3366 | 457 |
3427 | 458 vbox = make_frame (ret, _("Typing Notification")); |
459 typingbutton = gaim_button(_("Notify buddies that you are _typing to them"), &misc_options_new, | |
3366 | 460 OPT_MISC_STEALTH_TYPING, vbox); |
461 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton))); | |
3404 | 462 misc_options_new ^= OPT_MISC_STEALTH_TYPING; |
3366 | 463 |
3427 | 464 gtk_widget_show_all(ret); |
3366 | 465 return ret; |
466 } | |
467 | |
468 GtkWidget *chat_page() { | |
469 GtkWidget *ret; | |
470 GtkWidget *vbox; | |
3427 | 471 GtkWidget *dd; |
472 GtkSizeGroup *sg; | |
3366 | 473 |
3427 | 474 ret = gtk_vbox_new(FALSE, 18); |
475 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3500 | 476 |
3427 | 477 sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); |
3366 | 478 |
3427 | 479 vbox = make_frame (ret, _("Window")); |
480 dd = gaim_dropdown(vbox, "Show _buttons as:", &chat_options_new, OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM, | |
3500 | 481 "Pictures", OPT_CHAT_BUTTON_XPM, |
3427 | 482 "Text", OPT_CHAT_BUTTON_TEXT, |
483 "Pictures and Text", OPT_CHAT_BUTTON_XPM | OPT_CHAT_BUTTON_TEXT, NULL); | |
484 gtk_size_group_add_widget(sg, dd); | |
485 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
486 gaim_labeled_spin_button(vbox, _("New window _width:"), &buddy_chat_size_new.width, 25, 9999, sg); | |
487 gaim_labeled_spin_button(vbox, _("New window _height:"), &buddy_chat_size_new.height, 25, 9999, sg); | |
488 gaim_labeled_spin_button(vbox, _("_Entry widget height:"), &buddy_chat_size_new.entry_height, 25, 9999, sg); | |
489 gaim_button(_("_Raise windows on events"), &chat_options_new, OPT_CHAT_POPUP, vbox); | |
3366 | 490 |
3427 | 491 vbox = make_frame (ret, _("Tab Completion")); |
492 gaim_button(_("_Tab-Complete Nicks"), &chat_options_new, OPT_CHAT_TAB_COMPLETE, vbox); | |
493 gaim_button(_("_Old-Style Tab Completion"), &chat_options_new, OPT_CHAT_OLD_STYLE_TAB, vbox); | |
494 | |
495 vbox = make_frame (ret, _("Display")); | |
496 gaim_button(_("_Show people joining/leaving in window"), &chat_options_new, OPT_CHAT_LOGON, vbox); | |
497 gaim_button(_("Co_lorize screennames"), &chat_options_new, OPT_CHAT_COLORIZE, vbox); | |
498 | |
499 gtk_widget_show_all(ret); | |
3366 | 500 return ret; |
501 } | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
502 |
3366 | 503 GtkWidget *tab_page() { |
504 GtkWidget *ret; | |
505 GtkWidget *vbox; | |
3427 | 506 GtkWidget *dd; |
507 GtkSizeGroup *sg; | |
508 ret = gtk_vbox_new(FALSE, 18); | |
509 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 510 |
3427 | 511 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
3500 | 512 |
3427 | 513 vbox = make_frame (ret, _("IM Tabs")); |
3500 | 514 dd = gaim_dropdown(vbox, "Tab _Placement:", &im_options_new, OPT_IM_SIDE_TAB | OPT_IM_BR_TAB, |
515 "Top", 0, | |
3366 | 516 "Bottom", OPT_IM_BR_TAB, |
517 "Left", OPT_IM_SIDE_TAB, | |
518 "Right", OPT_IM_BR_TAB | OPT_IM_SIDE_TAB, NULL); | |
3427 | 519 gtk_size_group_add_widget(sg, dd); |
520 gaim_button(_("Show all _Instant Messages in one tabbed\nwindow"), &im_options_new, OPT_IM_ONE_WINDOW, vbox); | |
521 gaim_button(_("Show a_liases in tabs/titles"), &im_options_new, OPT_IM_ALIAS_TAB, vbox); | |
3366 | 522 |
3427 | 523 vbox = make_frame (ret, _("Chat Tabs")); |
524 dd = gaim_dropdown(vbox, "Tab _Placement:", &chat_options_new, OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, | |
3500 | 525 "Top", 0, |
3427 | 526 "Bottom", OPT_CHAT_BR_TAB, |
527 "Left", OPT_CHAT_SIDE_TAB, | |
528 "Right", OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, NULL); | |
529 gtk_size_group_add_widget(sg, dd); | |
530 gaim_button(_("Show all c_hats in one tabbed window"), &chat_options_new, OPT_CHAT_ONE_WINDOW, | |
3366 | 531 vbox); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
532 |
3427 | 533 vbox = make_frame (ret, _("Combined Tabs")); |
534 gaim_button(_("Show IMs and chats in _same tabbed\nwindow."), &convo_options_new, OPT_CONVO_COMBINE, vbox); | |
3500 | 535 |
3427 | 536 vbox = make_frame (ret, _("Buddy List Tabs")); |
3500 | 537 dd = gaim_dropdown(vbox, "Tab _Placement:", &blist_options_new, OPT_BLIST_BOTTOM_TAB, |
538 "Top", 0, | |
3366 | 539 "Bottom", OPT_BLIST_BOTTOM_TAB, NULL); |
3427 | 540 gtk_size_group_add_widget(sg, dd); |
3500 | 541 |
3427 | 542 gtk_widget_show_all(ret); |
3366 | 543 return ret; |
544 } | |
545 | |
546 GtkWidget *proxy_page() { | |
547 GtkWidget *ret; | |
548 GtkWidget *vbox; | |
549 GtkWidget *entry; | |
550 GtkWidget *label; | |
551 GtkWidget *hbox; | |
552 GtkWidget *table; | |
553 | |
3427 | 554 ret = gtk_vbox_new(FALSE, 18); |
555 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 556 |
3427 | 557 vbox = make_frame (ret, _("Proxy Type")); |
558 gaim_dropdown(vbox, "Proxy _Type:", &proxytype_new, -1, | |
3500 | 559 "No Proxy", PROXY_NONE, |
3366 | 560 "SOCKS 4", PROXY_SOCKS4, |
561 "SOCKS 5", PROXY_SOCKS5, | |
562 "HTTP", PROXY_HTTP, NULL); | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
563 |
2254 | 564 table = gtk_table_new(2, 2, FALSE); |
565 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
566 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
567 gtk_table_set_row_spacings(GTK_TABLE(table), 5); | |
568 | |
3427 | 569 vbox = make_frame(ret, _("Proxy Server")); |
570 prefs_proxy_frame = vbox; | |
2254 | 571 |
572 if (proxytype == PROXY_NONE) | |
3427 | 573 gtk_widget_set_sensitive(GTK_WIDGET(vbox), FALSE); |
2254 | 574 |
575 table = gtk_table_new(2, 4, FALSE); | |
576 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
577 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
578 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
3427 | 579 gtk_container_add(GTK_CONTAINER(vbox), table); |
2254 | 580 |
581 | |
3427 | 582 label = gtk_label_new_with_mnemonic(_("_Host")); |
2254 | 583 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
584 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
585 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
586 entry = gtk_entry_new(); |
3427 | 587 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
3366 | 588 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
589 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
590 GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYHOST); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
591 gtk_entry_set_text(GTK_ENTRY(entry), proxyhost); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
592 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
593 hbox = gtk_hbox_new(TRUE, 5); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
594 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
595 |
3427 | 596 label = gtk_label_new_with_mnemonic(_("Port")); |
2254 | 597 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
598 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
599 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
600 entry = gtk_entry_new(); |
3427 | 601 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
3366 | 602 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
603 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
604 GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYPORT); |
2254 | 605 |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
606 if (proxyport) { |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
607 char buf[128]; |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
608 g_snprintf(buf, sizeof(buf), "%d", proxyport); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
609 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
610 } |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
611 |
3427 | 612 label = gtk_label_new_with_mnemonic(_("_User")); |
2254 | 613 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
614 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
615 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
616 entry = gtk_entry_new(); |
3427 | 617 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
3366 | 618 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
619 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
620 GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYUSER); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
621 gtk_entry_set_text(GTK_ENTRY(entry), proxyuser); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
622 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
623 hbox = gtk_hbox_new(TRUE, 5); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
624 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
625 |
3427 | 626 label = gtk_label_new_with_mnemonic(_("Pa_ssword")); |
2254 | 627 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
628 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
629 |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
630 entry = gtk_entry_new(); |
3427 | 631 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
3366 | 632 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
633 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
634 gtk_signal_connect(GTK_OBJECT(entry), "changed", |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
635 GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYPASS); |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
636 gtk_entry_set_text(GTK_ENTRY(entry), proxypass); |
3500 | 637 |
3427 | 638 gtk_widget_show_all(ret); |
3366 | 639 return ret; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
640 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
641 |
3432 | 642 static void browser_print_option(GtkEntry *entry, void *nullish) { |
643 g_snprintf(web_command_new, sizeof(web_command_new), "%s", gtk_entry_get_text(entry)); | |
644 } | |
645 | |
3366 | 646 GtkWidget *browser_page() { |
647 GtkWidget *ret; | |
648 GtkWidget *vbox, *hbox; | |
649 GtkWidget *label; | |
3427 | 650 GtkSizeGroup *sg; |
651 | |
652 ret = gtk_vbox_new(FALSE, 18); | |
653 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
654 | |
655 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1755
diff
changeset
|
656 |
3427 | 657 vbox = make_frame (ret, _("Browser Selection")); |
3500 | 658 label = gaim_dropdown(vbox, "_Browser", &web_browser_new, -1, |
3427 | 659 "Netscape", BROWSER_NETSCAPE, |
660 "Konqueror", BROWSER_KONQ, | |
661 "Mozilla", BROWSER_MOZILLA, | |
662 "Manual", BROWSER_MANUAL, | |
3472 | 663 /* fixme: GNOME binary helper |
664 "GNOME URL Handler", BROWSER_GNOME, */ | |
3427 | 665 "Galeon", BROWSER_GALEON, |
666 "Opera", BROWSER_OPERA, NULL); | |
667 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
668 gtk_size_group_add_widget(sg, label); | |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
910
diff
changeset
|
669 |
3366 | 670 hbox = gtk_hbox_new(FALSE, 5); |
671 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
3427 | 672 label = gtk_label_new_with_mnemonic("_Manual: "); |
3366 | 673 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
3427 | 674 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
675 gtk_size_group_add_widget(sg, label); | |
3366 | 676 browser_entry = gtk_entry_new(); |
3427 | 677 gtk_label_set_mnemonic_widget(GTK_LABEL(label), browser_entry); |
3366 | 678 if (web_browser_new != BROWSER_MANUAL) |
679 gtk_widget_set_sensitive(browser_entry, FALSE); | |
680 gtk_box_pack_start (GTK_BOX (hbox), browser_entry, FALSE, FALSE, 0); | |
1750
d2eca7a46cfd
[gaim-migrate @ 1760]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1711
diff
changeset
|
681 |
3432 | 682 gtk_entry_set_text(GTK_ENTRY(browser_entry), web_command_new); |
683 gtk_signal_connect(GTK_OBJECT(browser_entry), "changed", | |
684 GTK_SIGNAL_FUNC(browser_print_option), NULL); | |
685 | |
3427 | 686 vbox = make_frame (ret, _("Browser Options")); |
687 gaim_button(_("Open new _window by default"), &misc_options_new, OPT_MISC_BROWSER_POPUP, vbox); | |
3366 | 688 |
3427 | 689 gtk_widget_show_all(ret); |
3366 | 690 return ret; |
3500 | 691 } |
3366 | 692 |
693 GtkWidget *logging_page() { | |
694 GtkWidget *ret; | |
695 GtkWidget *vbox; | |
3427 | 696 ret = gtk_vbox_new(FALSE, 18); |
697 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
910
diff
changeset
|
698 |
3427 | 699 vbox = make_frame (ret, _("Message Logs")); |
3457 | 700 gaim_button(_("_Log all Instant Messages"), &logging_options_new, OPT_LOG_CONVOS, vbox); |
701 gaim_button(_("Log all c_hats"), &logging_options_new, OPT_LOG_CHATS, vbox); | |
3427 | 702 gaim_button(_("Strip _HTML from logs"), &logging_options_new, OPT_LOG_STRIP_HTML, vbox); |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
703 |
3427 | 704 vbox = make_frame (ret, _("System Logs")); |
705 gaim_button(_("Log when buddies _sign on/sign off"), &logging_options_new, OPT_LOG_BUDDY_SIGNON, | |
3366 | 706 vbox); |
3427 | 707 gaim_button(_("Log when buddies become _idle/un-idle"), &logging_options_new, OPT_LOG_BUDDY_IDLE, |
3366 | 708 vbox); |
3427 | 709 gaim_button(_("Log when buddies go away/come _back"), &logging_options_new, OPT_LOG_BUDDY_AWAY, vbox); |
710 gaim_button(_("Log your _own signons/idleness/awayness"), &logging_options_new, OPT_LOG_MY_SIGNON, | |
3366 | 711 vbox); |
3427 | 712 gaim_button(_("I_ndividual log file for each buddy's signons"), &logging_options_new, |
3366 | 713 OPT_LOG_INDIVIDUAL, vbox); |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1755
diff
changeset
|
714 |
3427 | 715 gtk_widget_show_all(ret); |
3366 | 716 return ret; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1755
diff
changeset
|
717 } |
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1755
diff
changeset
|
718 |
3366 | 719 static GtkWidget *sndcmd = NULL; |
1757
3dfe4aefd366
[gaim-migrate @ 1767]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1755
diff
changeset
|
720 |
3366 | 721 static gint sound_cmd_yeah(GtkEntry *entry, GdkEvent *event, gpointer d) |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
722 { |
3366 | 723 g_snprintf(sound_cmd_new, sizeof(sound_cmd_new), "%s", gtk_entry_get_text(GTK_ENTRY(sndcmd))); |
724 return TRUE; | |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
725 } |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
726 |
3366 | 727 GtkWidget *sound_page() { |
728 GtkWidget *ret; | |
1750
d2eca7a46cfd
[gaim-migrate @ 1760]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1711
diff
changeset
|
729 GtkWidget *label; |
3366 | 730 GtkWidget *vbox, *hbox; |
3427 | 731 GtkSizeGroup *sg; |
732 GtkWidget *dd; | |
3366 | 733 |
3427 | 734 ret = gtk_vbox_new(FALSE, 18); |
735 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
736 |
3427 | 737 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
738 |
3427 | 739 vbox = make_frame (ret, _("Sound Options")); |
3500 | 740 gaim_button(_("_No sounds when you log in"), &sound_options_new, OPT_SOUND_SILENT_SIGNON, vbox); |
741 gaim_button(_("_Sounds while away"), &sound_options_new, OPT_SOUND_WHEN_AWAY, vbox); | |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
742 |
3427 | 743 vbox = make_frame (ret, _("Sound Method")); |
744 dd = gaim_dropdown(vbox, "_Method", &sound_options_new, OPT_SOUND_BEEP | | |
3366 | 745 OPT_SOUND_ESD | OPT_SOUND_ARTSC | OPT_SOUND_NAS | OPT_SOUND_NORMAL | |
3500 | 746 OPT_SOUND_CMD, |
3366 | 747 "Console Beep", OPT_SOUND_BEEP, |
748 #ifdef ESD_SOUND | |
3500 | 749 "ESD", OPT_SOUND_ESD, |
3366 | 750 #endif /* ESD_SOUND */ |
751 #ifdef ARTSC_SOUND | |
752 "ArtsC", OPT_SOUND_ARTSC, | |
753 #endif /* ARTSC_SOUND */ | |
754 #ifdef NAS_SOUND | |
755 "NAS", OPT_SOUND_NAS, | |
3500 | 756 #endif /* NAS_SOUND */ |
3366 | 757 "Internal", OPT_SOUND_NORMAL, |
758 "Command", OPT_SOUND_CMD, NULL); | |
3427 | 759 gtk_size_group_add_widget(sg, dd); |
760 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
761 |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
762 hbox = gtk_hbox_new(FALSE, 5); |
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
763 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); |
3427 | 764 |
3366 | 765 hbox = gtk_hbox_new(FALSE, 5); |
766 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3500 | 767 label = gtk_label_new_with_mnemonic(_("Sound c_ommand\n(%s for filename)")); |
3427 | 768 gtk_size_group_add_widget(sg, label); |
769 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3366 | 770 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
910
diff
changeset
|
771 |
3366 | 772 sndcmd = gtk_entry_new(); |
3427 | 773 gtk_label_set_mnemonic_widget(GTK_LABEL(label), sndcmd); |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
774 |
3366 | 775 gtk_entry_set_editable(GTK_ENTRY(sndcmd), TRUE); |
776 gtk_entry_set_text(GTK_ENTRY(sndcmd), sound_cmd); | |
777 gtk_widget_set_size_request(sndcmd, 75, -1); | |
3427 | 778 |
3366 | 779 gtk_widget_set_sensitive(sndcmd, (sound_options_new & OPT_SOUND_CMD)); |
780 gtk_box_pack_start(GTK_BOX(hbox), sndcmd, TRUE, TRUE, 5); | |
781 gtk_signal_connect(GTK_OBJECT(sndcmd), "focus_out_event", GTK_SIGNAL_FUNC(sound_cmd_yeah), NULL); | |
2746
a0da8be3db45
[gaim-migrate @ 2759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2745
diff
changeset
|
782 |
3427 | 783 gtk_widget_show_all(ret); |
3366 | 784 return ret; |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
785 } |
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
786 |
3366 | 787 GtkWidget *away_page() { |
788 GtkWidget *ret; | |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
789 GtkWidget *vbox; |
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
790 GtkWidget *hbox; |
3366 | 791 GtkWidget *label; |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
792 GtkWidget *button; |
3366 | 793 GtkWidget *select; |
3427 | 794 GtkWidget *dd; |
795 GtkSizeGroup *sg; | |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
796 |
3427 | 797 ret = gtk_vbox_new(FALSE, 18); |
798 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
799 |
3427 | 800 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
801 |
3427 | 802 vbox = make_frame (ret, _("Away")); |
803 gaim_button(_("_Sending messages removes away status"), &away_options_new, OPT_AWAY_BACK_ON_IM, vbox); | |
804 gaim_button(_("_Queue new messages when away"), &away_options_new, OPT_AWAY_QUEUE, vbox); | |
805 gaim_button(_("_Ignore new conversations when away"), &away_options_new, OPT_AWAY_DISCARD, vbox); | |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
806 |
3427 | 807 vbox = make_frame (ret, _("Auto-response")); |
3366 | 808 hbox = gtk_hbox_new(FALSE, 0); |
809 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
3427 | 810 gaim_labeled_spin_button(hbox, _("Seconds before _resending:"), |
811 &away_resend_new, 1, 24 * 60 * 60, sg); | |
3500 | 812 gaim_button(_("_Don't send auto-response"), &away_options_new, OPT_AWAY_NO_AUTO_RESP, vbox); |
3427 | 813 gaim_button(_("_Only send auto-response when idle"), &away_options_new, OPT_AWAY_IDLE_RESP, vbox); |
1813
998a6a032874
[gaim-migrate @ 1823]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1805
diff
changeset
|
814 |
3366 | 815 if (away_options_new & OPT_AWAY_NO_AUTO_RESP) |
816 gtk_widget_set_sensitive(hbox, FALSE); | |
3500 | 817 |
3427 | 818 vbox = make_frame (ret, _("Idle")); |
3500 | 819 dd = gaim_dropdown(vbox, "Idle _Time Reporting:", &report_idle_new, -1, |
3427 | 820 "None", IDLE_NONE, |
3500 | 821 "Gaim Usage", IDLE_GAIM, |
3366 | 822 #ifdef USE_SCREENSAVER |
3500 | 823 "X Usage", IDLE_SCREENSAVER, |
3366 | 824 #endif |
3427 | 825 NULL); |
826 gtk_size_group_add_widget(sg, dd); | |
827 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
2385
bdc74764245c
[gaim-migrate @ 2398]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2372
diff
changeset
|
828 |
3427 | 829 vbox = make_frame (ret, _("Auto-away")); |
830 button = gaim_button(_("Set away _when idle"), &away_options_new, OPT_AWAY_AUTO, vbox); | |
831 select = gaim_labeled_spin_button(vbox, "_Minutes before setting away:", &auto_away_new, 1, 24 * 60, sg); | |
3366 | 832 if (!(away_options_new & OPT_AWAY_AUTO)) |
833 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); | |
834 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); | |
1 | 835 |
3427 | 836 label = gtk_label_new_with_mnemonic("Away m_essage:"); |
837 gtk_size_group_add_widget(sg, label); | |
838 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3366 | 839 hbox = gtk_hbox_new(FALSE, 0); |
840 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
841 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
842 prefs_away_menu = gtk_option_menu_new(); | |
3427 | 843 gtk_label_set_mnemonic_widget(GTK_LABEL(label), prefs_away_menu); |
3366 | 844 if (!(away_options_new & OPT_AWAY_AUTO)) |
845 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); | |
846 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), prefs_away_menu); | |
847 default_away_menu_init(prefs_away_menu); | |
848 gtk_widget_show(prefs_away_menu); | |
849 gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); | |
3500 | 850 |
3427 | 851 gtk_widget_show_all(ret); |
3366 | 852 return ret; |
873
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
853 } |
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
854 |
3551 | 855 #if USE_PLUGINS |
856 GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
857 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
858 { | |
859 gchar buf[1024]; | |
860 GtkTreeIter iter; | |
861 GValue val = { 0, }; | |
862 struct gaim_plugin *plug; | |
863 | |
864 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
865 return; | |
866 gtk_tree_model_get_value (model, &iter, 2, &val); | |
867 plug = g_value_get_pointer(&val); | |
868 | |
3563 | 869 if (plug->error[0]) |
870 g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" | |
871 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
872 "%s"), plug->desc.name, plug->desc.version, plug->error, plug->desc.description); | |
873 else | |
874 g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" | |
875 "%s"), plug->desc.name, plug->desc.version, plug->desc.description); | |
3551 | 876 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
877 g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" | |
878 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
879 "<span weight=\"bold\">URL:</span>\t%s\n" | |
880 "<span weight=\"bold\">File name:</span>\t %s"), | |
881 plug->desc.name, plug->desc.version, plug->desc.authors, plug->desc.url, plug->path); | |
882 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
883 g_value_unset (&val); | |
884 } | |
885 | |
886 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
887 { | |
888 GtkTreeModel *model = (GtkTreeModel *)data; | |
889 GtkTreeIter iter; | |
890 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
891 struct gaim_plugin *plug; | |
892 gchar buf[1024]; | |
3565 | 893 GtkWidget *(*config)(); |
894 | |
3551 | 895 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
896 gdk_window_set_cursor(prefs->window, wait); | |
897 gdk_cursor_unref(wait); | |
898 | |
899 gtk_tree_model_get_iter (model, &iter, path); | |
900 gtk_tree_model_get (model, &iter, 2, &plug, -1); | |
901 | |
902 if (!plug->handle) | |
903 | |
904 if (plug->type == plugin) | |
905 #ifdef GAIM_PLUGINS | |
3565 | 906 { |
907 load_plugin(plug->path); | |
908 if (g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) { | |
909 plug->iter = g_new0(GtkTreeIter, 1); | |
910 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++); | |
3567 | 911 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), &plugin_iter) == 1) { |
912 /* Expand the tree for the first plugin added */ | |
913 GtkTreePath *path2 = gtk_tree_model_get_path(prefstree, &plugin_iter); | |
914 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), path2, TRUE); | |
915 gtk_tree_path_free (path2); | |
916 } | |
3565 | 917 } |
918 } | |
3551 | 919 #else |
920 {} | |
921 #endif | |
922 else | |
923 #ifdef USE_PERL | |
924 perl_load_file(plug->path); | |
925 #else | |
926 {} | |
927 #endif | |
928 else | |
929 if (plug->type == plugin) | |
930 #ifdef GAIM_PLUGINS | |
3565 | 931 { |
932 unload_plugin(plug); | |
933 if (plug->iter) { | |
934 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), plug->iter); | |
935 g_free(plug->iter); | |
936 plug->iter = NULL; | |
937 } | |
938 } | |
3551 | 939 #else |
940 {} | |
941 #endif | |
942 else | |
943 #ifdef USE_PERL | |
944 perl_unload_file(plug); | |
945 #else | |
946 {} | |
947 #endif | |
948 gdk_window_set_cursor(prefs->window, NULL); | |
3563 | 949 if (plug->error[0]) |
950 g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" | |
951 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
952 "%s"), plug->desc.name, plug->desc.version, plug->error, plug->desc.description); | |
953 else | |
954 g_snprintf(buf, sizeof(buf), _("<span size=\"larger\">%s %s</span>\n\n" | |
955 "%s"), plug->desc.name, plug->desc.version, plug->desc.description); | |
956 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
3551 | 957 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, plug->handle, -1); |
3563 | 958 |
3551 | 959 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
960 gtk_tree_path_free(path); | |
961 } | |
962 | |
963 static GtkWidget *plugin_page () | |
964 { | |
965 GtkWidget *ret; | |
966 | |
967 GtkWidget *sw, *vp; | |
968 GtkTreeIter iter; | |
969 GtkWidget *event_view; | |
970 GtkListStore *ls; | |
971 GtkCellRenderer *rend, *rendt; | |
972 GtkTreeViewColumn *col; | |
973 GtkTreeSelection *sel; | |
974 GtkTreePath *path; | |
975 | |
976 GtkWidget *nb; | |
977 | |
978 GList *probes = probed_plugins; | |
979 struct gaim_plugin *plug; | |
980 | |
981 ret = gtk_vbox_new(FALSE, 18); | |
982 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
983 | |
984 sw = gtk_scrolled_window_new(NULL,NULL); | |
985 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
986 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
987 | |
988 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
989 | |
990 ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER); | |
991 while (probes) { | |
992 plug = probes->data; | |
993 gtk_list_store_append (ls, &iter); | |
994 gtk_list_store_set(ls, &iter, | |
995 0, plug->handle, | |
996 1, plug->desc.name ? plug->desc.name : plug->path, | |
997 2, plug, -1); | |
998 probes = probes->next; | |
999 } | |
1000 | |
1001 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
1002 | |
1003 rend = gtk_cell_renderer_toggle_new(); | |
1004 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1005 | |
1006 | |
1007 col = gtk_tree_view_column_new_with_attributes ("Load", | |
1008 rend, | |
1009 "active", 0, | |
1010 NULL); | |
1011 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1012 | |
1013 rendt = gtk_cell_renderer_text_new(); | |
1014 col = gtk_tree_view_column_new_with_attributes ("Name", | |
1015 rendt, | |
1016 "text", 1, | |
1017 NULL); | |
1018 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1019 g_object_unref(G_OBJECT(ls)); | |
1020 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1021 | |
1022 | |
1023 nb = gtk_notebook_new(); | |
1024 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
1025 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
1026 | |
1027 /* Description */ | |
1028 sw = gtk_scrolled_window_new(NULL, NULL); | |
1029 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1030 plugin_description = gtk_label_new(NULL); | |
1031 | |
1032 vp = gtk_viewport_new(NULL, NULL); | |
1033 gtk_viewport_set_shadow_type(vp, GTK_SHADOW_NONE); | |
1034 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1035 | |
1036 gtk_container_add(vp, plugin_description); | |
1037 gtk_container_add(sw, vp); | |
1038 | |
1039 gtk_label_set_selectable(plugin_description, TRUE); | |
1040 gtk_label_set_line_wrap(plugin_description, TRUE); | |
1041 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
1042 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
1043 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
1044 | |
1045 /* Details */ | |
1046 sw = gtk_scrolled_window_new(NULL, NULL); | |
1047 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1048 plugin_details = gtk_label_new(NULL); | |
1049 | |
1050 vp = gtk_viewport_new(NULL, NULL); | |
1051 gtk_viewport_set_shadow_type(vp, GTK_SHADOW_NONE); | |
1052 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1053 | |
1054 gtk_container_add(vp, plugin_details); | |
1055 gtk_container_add(sw, vp); | |
1056 | |
1057 gtk_label_set_selectable(plugin_details, TRUE); | |
1058 gtk_label_set_line_wrap(plugin_details, TRUE); | |
1059 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
1060 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); | |
1061 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); | |
1062 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
1063 | |
1064 g_signal_connect (G_OBJECT (sel), "changed", | |
1065 G_CALLBACK (prefs_plugin_sel), | |
1066 NULL); | |
1067 g_signal_connect (G_OBJECT(rend), "toggled", | |
1068 G_CALLBACK(plugin_load), ls); | |
1069 | |
1070 path = gtk_tree_path_new_first(); | |
1071 gtk_tree_selection_select_path(sel, path); | |
1072 gtk_tree_path_free(path); | |
1073 | |
1074 gtk_widget_show_all(ret); | |
1075 return ret; | |
1076 } | |
1077 #endif | |
1078 | |
3366 | 1079 static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
873
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
1080 { |
3366 | 1081 GtkTreeModel *model = (GtkTreeModel *)data; |
1082 GtkTreeIter iter; | |
1083 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
3500 | 1084 gint soundnum; |
3366 | 1085 |
1086 gtk_tree_model_get_iter (model, &iter, path); | |
1087 gtk_tree_model_get (model, &iter, 2, &soundnum, -1); | |
873
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
1088 |
3500 | 1089 sound_options_new ^= sounds[soundnum].opt; |
3366 | 1090 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, sound_options_new & sounds[soundnum].opt, -1); |
3522 | 1091 |
1092 gtk_tree_path_free(path); | |
3366 | 1093 } |
1094 | |
1095 static void test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1096 { | |
1097 guint32 tmp_sound = sound_options; | |
3401 | 1098 char *save_me=NULL; |
3366 | 1099 if (!(sound_options & OPT_SOUND_WHEN_AWAY)) |
1100 sound_options ^= OPT_SOUND_WHEN_AWAY; | |
1101 if (!(sound_options & sounds[sound_row_sel].opt)) | |
1102 sound_options ^= sounds[sound_row_sel].opt; | |
3401 | 1103 save_me = sound_file[sound_row_sel]; |
1104 sound_file[sound_row_sel] = sound_file_new[sound_row_sel]; | |
3366 | 1105 play_sound(sound_row_sel); |
3500 | 1106 |
3401 | 1107 sound_file[sound_row_sel] = save_me; |
3366 | 1108 sound_options = tmp_sound; |
873
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
1109 } |
789df4b47508
[gaim-migrate @ 883]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
864
diff
changeset
|
1110 |
3366 | 1111 static void reset_sound(GtkWidget *button, gpointer i_am_also_NULL) |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1112 { |
3366 | 1113 /* This just resets a sound file back to default */ |
3485 | 1114 if (sound_file_new[sound_row_sel]) { |
1115 g_free(sound_file_new[sound_row_sel]); | |
1116 sound_file_new[sound_row_sel] = NULL; | |
1117 } | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1118 |
3366 | 1119 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1120 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1121 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1122 void close_sounddialog(GtkWidget *w, GtkWidget *w2) |
1170 | 1123 { |
1124 | |
1125 GtkWidget *dest; | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1126 |
1170 | 1127 if (!GTK_IS_WIDGET(w2)) |
1128 dest = w; | |
1129 else | |
1130 dest = w2; | |
1131 | |
1132 sounddialog = NULL; | |
1133 | |
1134 gtk_widget_destroy(dest); | |
1135 } | |
1136 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1137 void do_select_sound(GtkWidget *w, int snd) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1138 { |
1953
f0ff0b367e3d
[gaim-migrate @ 1963]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1930
diff
changeset
|
1139 const char *file; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1140 |
1170 | 1141 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); |
1142 | |
1143 /* If they type in a directory, change there */ | |
1144 if (file_is_dir(file, sounddialog)) | |
1145 return; | |
1146 | |
1147 /* Let's just be safe */ | |
3366 | 1148 if (sound_file_new[snd]) |
3485 | 1149 g_free(sound_file_new[snd]); |
1170 | 1150 |
1151 /* Set it -- and forget it */ | |
3366 | 1152 sound_file_new[snd] = g_strdup(file); |
3500 | 1153 |
1175 | 1154 /* Set our text entry */ |
3366 | 1155 gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[snd]); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1156 |
1170 | 1157 /* Close the window! It's getting cold in here! */ |
1158 close_sounddialog(NULL, sounddialog); | |
2471
612efbf62c35
[gaim-migrate @ 2484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2385
diff
changeset
|
1159 |
612efbf62c35
[gaim-migrate @ 2484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2385
diff
changeset
|
1160 if (last_sound_dir) |
612efbf62c35
[gaim-migrate @ 2484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2385
diff
changeset
|
1161 g_free(last_sound_dir); |
3429 | 1162 last_sound_dir = g_dirname(sound_file_new[snd]); |
1170 | 1163 } |
1164 | |
3366 | 1165 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1166 { |
1170 | 1167 char *buf = g_malloc(BUF_LEN); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1168 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1169 if (!sounddialog) { |
1170 | 1170 sounddialog = gtk_file_selection_new(_("Gaim - Sound Configuration")); |
1171 | |
1172 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
1173 | |
2471
612efbf62c35
[gaim-migrate @ 2484]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2385
diff
changeset
|
1174 g_snprintf(buf, BUF_LEN - 1, "%s/", last_sound_dir ? last_sound_dir : g_get_home_dir()); |
1170 | 1175 |
1176 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
1177 | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1178 gtk_signal_connect(GTK_OBJECT(sounddialog), "destroy", |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1179 GTK_SIGNAL_FUNC(close_sounddialog), sounddialog); |
1170 | 1180 |
1181 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
3366 | 1182 "clicked", GTK_SIGNAL_FUNC(do_select_sound), (int *)sound_row_sel); |
1170 | 1183 |
1184 gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1185 "clicked", GTK_SIGNAL_FUNC(close_sounddialog), sounddialog); |
1170 | 1186 } |
1187 | |
1188 g_free(buf); | |
1189 gtk_widget_show(sounddialog); | |
1190 gdk_window_raise(sounddialog->window); | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1191 } |
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1192 |
3366 | 1193 |
1194 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
1195 GtkTreeIter iter; | |
1196 GValue val = { 0, }; | |
3500 | 1197 |
3366 | 1198 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
1199 return; | |
1200 gtk_tree_model_get_value (model, &iter, 2, &val); | |
1201 sound_row_sel = g_value_get_uint(&val); | |
1202 if (sound_entry) | |
3374 | 1203 gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)"); |
3366 | 1204 g_value_unset (&val); |
1205 if (sounddialog) | |
1206 gtk_widget_destroy(sounddialog); | |
1207 } | |
1208 | |
1209 GtkWidget *sound_events_page() { | |
1210 | |
1211 GtkWidget *ret; | |
1212 GtkWidget *sw; | |
1213 GtkWidget *button, *hbox; | |
1214 GtkTreeIter iter; | |
1215 GtkWidget *event_view; | |
1216 GtkListStore *event_store; | |
1217 GtkCellRenderer *rend; | |
1218 GtkTreeViewColumn *col; | |
1219 GtkTreeSelection *sel; | |
1220 GtkTreePath *path; | |
1221 int j; | |
1222 | |
3427 | 1223 ret = gtk_vbox_new(FALSE, 18); |
1224 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
3366 | 1225 |
1226 sw = gtk_scrolled_window_new(NULL,NULL); | |
1227 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
3427 | 1228 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
3366 | 1229 event_store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT); |
1230 | |
1231 for (j=0; j < NUM_SOUNDS; j++) { | |
1232 if (sounds[j].opt == 0) | |
1233 continue; | |
3500 | 1234 |
3366 | 1235 gtk_list_store_append (event_store, &iter); |
1236 gtk_list_store_set(event_store, &iter, | |
1237 0, sound_options & sounds[j].opt, | |
3500 | 1238 1, sounds[j].label, |
3366 | 1239 2, j, -1); |
1240 } | |
1241 | |
1242 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
3500 | 1243 |
3366 | 1244 rend = gtk_cell_renderer_toggle_new(); |
1245 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1246 g_signal_connect (G_OBJECT (sel), "changed", | |
1247 G_CALLBACK (prefs_sound_sel), | |
1248 NULL); | |
1249 g_signal_connect (G_OBJECT(rend), "toggled", | |
1250 G_CALLBACK(event_toggled), event_store); | |
1251 path = gtk_tree_path_new_first(); | |
1252 gtk_tree_selection_select_path(sel, path); | |
3522 | 1253 gtk_tree_path_free(path); |
3500 | 1254 |
3366 | 1255 col = gtk_tree_view_column_new_with_attributes ("Play", |
1256 rend, | |
1257 "active", 0, | |
1258 NULL); | |
1259 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1260 | |
1261 rend = gtk_cell_renderer_text_new(); | |
1262 col = gtk_tree_view_column_new_with_attributes ("Event", | |
1263 rend, | |
1264 "text", 1, | |
1265 NULL); | |
1266 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
3500 | 1267 g_object_unref(G_OBJECT(event_store)); |
3366 | 1268 gtk_container_add(GTK_CONTAINER(sw), event_view); |
1269 | |
3427 | 1270 hbox = gtk_hbox_new(FALSE, 6); |
1271 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
3366 | 1272 sound_entry = gtk_entry_new(); |
1273 gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[0] ? sound_file_new[0] : "(default)"); | |
1274 gtk_entry_set_editable(GTK_ENTRY(sound_entry), FALSE); | |
1275 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1276 |
3025 | 1277 button = gtk_button_new_with_label(_("Test")); |
3366 | 1278 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(test_sound), NULL); |
1279 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2759
f26f1d139615
[gaim-migrate @ 2772]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2746
diff
changeset
|
1280 |
1175 | 1281 button = gtk_button_new_with_label(_("Reset")); |
3366 | 1282 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(reset_sound), NULL); |
1283 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1175 | 1284 |
1381 | 1285 button = gtk_button_new_with_label(_("Choose...")); |
3366 | 1286 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(sel_sound), NULL); |
1287 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
3500 | 1288 |
3427 | 1289 gtk_widget_show_all (ret); |
1006
0a4d0ed65e17
[gaim-migrate @ 1016]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1002
diff
changeset
|
1290 |
3366 | 1291 return ret; |
2580
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2566
diff
changeset
|
1292 } |
86eaeb064e82
[gaim-migrate @ 2593]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2566
diff
changeset
|
1293 |
3366 | 1294 void away_message_sel(GtkTreeSelection *sel, GtkTreeModel *model) |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1295 { |
3366 | 1296 GtkTreeIter iter; |
1297 GValue val = { 0, }; | |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1298 gchar buffer[BUF_LONG]; |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1299 char *tmp; |
3374 | 1300 struct away_message *am; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1301 |
3366 | 1302 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
1303 return; | |
1304 gtk_tree_model_get_value (model, &iter, 1, &val); | |
3374 | 1305 am = g_value_get_pointer(&val); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1306 gtk_imhtml_clear(GTK_IMHTML(away_text)); |
3374 | 1307 strncpy(buffer, am->message, BUF_LONG); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1308 tmp = stylize(buffer, BUF_LONG); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2843
diff
changeset
|
1309 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
1310 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2843
diff
changeset
|
1311 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | |
2372
2927c2c26fe6
[gaim-migrate @ 2385]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2323
diff
changeset
|
1312 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1313 g_free(tmp); |
3366 | 1314 g_value_unset (&val); |
3500 | 1315 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1316 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1317 |
3500 | 1318 void remove_away_message(GtkWidget *widget, GtkTreeView *tv) { |
3366 | 1319 struct away_message *am; |
1320 GtkTreeIter iter; | |
1321 GtkTreePath *path; | |
1322 GtkTreeStore *ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv)); | |
1323 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); | |
3379 | 1324 GtkTreeModel *model = GTK_TREE_MODEL(prefs_away_store); |
3366 | 1325 GValue val = { 0, }; |
3500 | 1326 |
3379 | 1327 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
3366 | 1328 return; |
3379 | 1329 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store), &iter, 1, &val); |
3366 | 1330 am = g_value_get_pointer (&val); |
1331 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
1332 rem_away_mess(NULL, am); | |
3379 | 1333 gtk_list_store_remove(GTK_LIST_STORE(ts), &iter); |
1334 path = gtk_tree_path_new_first(); | |
3366 | 1335 gtk_tree_selection_select_path(sel, path); |
3522 | 1336 gtk_tree_path_free(path); |
1109
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1087
diff
changeset
|
1337 } |
c73736fa0b7c
[gaim-migrate @ 1119]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1087
diff
changeset
|
1338 |
3366 | 1339 GtkWidget *away_message_page() { |
1340 GtkWidget *ret; | |
3427 | 1341 GtkWidget *hbox; |
3379 | 1342 GtkWidget *button; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1343 GtkWidget *sw; |
3366 | 1344 GtkTreeIter iter; |
1345 GtkWidget *event_view; | |
1346 GtkCellRenderer *rend; | |
1347 GtkTreeViewColumn *col; | |
1348 GtkTreeSelection *sel; | |
940 | 1349 GSList *awy = away_messages; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1350 struct away_message *a; |
3366 | 1351 GtkWidget *sw2; |
3427 | 1352 GtkSizeGroup *sg; |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1353 |
3427 | 1354 ret = gtk_vbox_new(FALSE, 18); |
1355 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1356 | |
1357 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
3500 | 1358 |
3366 | 1359 sw = gtk_scrolled_window_new(NULL,NULL); |
1360 away_text = gtk_imhtml_new(NULL, NULL); | |
3427 | 1361 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); |
3379 | 1362 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), |
1363 GTK_SHADOW_IN); | |
3427 | 1364 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
3500 | 1365 |
3374 | 1366 prefs_away_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); |
3366 | 1367 while (awy) { |
1368 a = (struct away_message *)awy->data; | |
1369 gtk_list_store_append (prefs_away_store, &iter); | |
1370 gtk_list_store_set(prefs_away_store, &iter, | |
3374 | 1371 0, a->name, |
1372 1, a, -1); | |
3366 | 1373 awy = awy->next; |
1374 } | |
1375 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store)); | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1376 |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1377 |
3366 | 1378 rend = gtk_cell_renderer_text_new(); |
1379 col = gtk_tree_view_column_new_with_attributes ("NULL", | |
1380 rend, | |
1381 "text", 0, | |
1382 NULL); | |
1383 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1384 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); | |
1385 gtk_widget_show(event_view); | |
3427 | 1386 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), event_view); |
3374 | 1387 |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1388 sw2 = gtk_scrolled_window_new(NULL, NULL); |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1389 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), |
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1390 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
3427 | 1391 gtk_box_pack_start(GTK_BOX(ret), sw2, TRUE, TRUE, 0); |
3500 | 1392 |
3427 | 1393 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), away_text); |
2906
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1394 GTK_LAYOUT(away_text)->hadjustment->step_increment = 10.0; |
538c58b43eff
[gaim-migrate @ 2919]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2856
diff
changeset
|
1395 GTK_LAYOUT(away_text)->vadjustment->step_increment = 10.0; |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1813
diff
changeset
|
1396 gaim_setup_imhtml(away_text); |
3366 | 1397 gtk_imhtml_set_defaults(GTK_IMHTML(away_text), NULL, NULL, NULL); |
1398 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1399 g_signal_connect (G_OBJECT (sel), "changed", | |
1400 G_CALLBACK (away_message_sel), | |
1401 NULL); | |
1402 hbox = gtk_hbox_new(TRUE, 5); | |
3427 | 1403 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); |
3366 | 1404 button = gtk_button_new_from_stock (GTK_STOCK_ADD); |
1405 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
3427 | 1406 gtk_size_group_add_widget(sg, button); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1407 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), NULL); |
3472 | 1408 |
3366 | 1409 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); |
3427 | 1410 gtk_size_group_add_widget(sg, button); |
3366 | 1411 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), event_view); |
3472 | 1412 |
3366 | 1413 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
3472 | 1414 |
3366 | 1415 button = pixbuf_button(_("_Edit"), "edit.png"); |
3427 | 1416 gtk_size_group_add_widget(sg, button); |
3374 | 1417 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view); |
3366 | 1418 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
3500 | 1419 |
3427 | 1420 gtk_widget_show_all(ret); |
3366 | 1421 return ret; |
1422 } | |
3472 | 1423 |
3500 | 1424 GtkTreeIter *prefs_notebook_add_page(char *text, |
1425 GdkPixbuf *pixbuf, | |
1426 GtkWidget *page, | |
3366 | 1427 GtkTreeIter *iter, |
3500 | 1428 GtkTreeIter *parent, |
3366 | 1429 int ind) { |
1430 GdkPixbuf *icon = NULL; | |
3500 | 1431 |
3366 | 1432 if (pixbuf) |
3500 | 1433 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); |
1780
d7cbedd1d651
[gaim-migrate @ 1790]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1773
diff
changeset
|
1434 |
3366 | 1435 gtk_tree_store_append (prefstree, iter, parent); |
1436 gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1); | |
3500 | 1437 |
3366 | 1438 if (pixbuf) |
1439 g_object_unref(pixbuf); | |
1440 if (icon) | |
1441 g_object_unref(icon); | |
1442 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
1443 return iter; | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1444 } |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1445 |
3366 | 1446 void prefs_notebook_init() { |
1447 GtkTreeIter p, c; | |
3565 | 1448 #if USE_PLUGINS |
1449 GtkWidget *(*config)(); | |
1450 GList *l = plugins; | |
1451 struct gaim_plugin *plug; | |
1452 #endif | |
1453 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | |
1454 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++); | |
1455 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | |
1456 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | |
1457 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
1458 prefs_notebook_add_page(_("IM Window"), NULL, im_page(), &c, &p, notebook_page++); | |
1459 prefs_notebook_add_page(_("Chat Window"), NULL, chat_page(), &c, &p, notebook_page++); | |
1460 prefs_notebook_add_page(_("Tabs"), NULL, tab_page(), &c, &p, notebook_page++); | |
1461 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++); | |
1462 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | |
1130
d31fad9abb32
[gaim-migrate @ 1140]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1125
diff
changeset
|
1463 |
3565 | 1464 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); |
1465 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); | |
1466 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); | |
1467 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
1468 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | |
3551 | 1469 #if USE_PLUGINS |
3565 | 1470 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); |
1471 while (l) { | |
1472 plug = l->data; | |
1473 if (plug->type == plugin && g_module_symbol(plug->handle, "gaim_plugin_config_gtk", (gpointer *)&config)) { | |
1474 plug->iter = g_new0(GtkTreeIter, 1); | |
1475 prefs_notebook_add_page(plug->desc.name, NULL, config(), plug->iter, &plugin_iter, notebook_page++); | |
1476 } | |
1477 l = l->next; | |
1478 } | |
3551 | 1479 #endif |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1480 } |
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1481 |
3500 | 1482 void show_prefs() |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1483 { |
3366 | 1484 GtkWidget *vbox, *vbox2; |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1485 GtkWidget *hbox; |
3366 | 1486 GtkWidget *frame; |
1487 GtkTreeViewColumn *column; | |
1488 GtkCellRenderer *cell; | |
1489 GtkTreeSelection *sel; | |
1490 GtkWidget *notebook; | |
1491 GtkWidget *sep; | |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
1492 GtkWidget *button; |
3515 | 1493 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
3500 | 1494 |
3366 | 1495 int r; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1496 |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1497 if (prefs) { |
3472 | 1498 gtk_window_present(GTK_WINDOW(prefs)); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1499 return; |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1500 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1501 |
3366 | 1502 /* copy the preferences to tmp values... |
1503 * I liked "take affect immediately" Oh well :-( */ | |
1504 misc_options_new = misc_options; | |
1505 logging_options_new = logging_options; | |
1506 blist_options_new = blist_options; | |
1507 convo_options_new = convo_options; | |
1508 im_options_new = im_options; | |
1509 chat_options_new = chat_options; | |
1510 font_options_new = font_options; | |
1511 sound_options_new = sound_options; | |
1512 for (r = 0; r < NUM_SOUNDS; r++) | |
1513 sound_file_new[r] = g_strdup(sound_file[r]); | |
1514 away_options_new = away_options; | |
1515 away_resend_new = away_resend; | |
1516 report_idle_new = report_idle; | |
1517 auto_away_new = auto_away; | |
1518 default_away_new = default_away; | |
1519 fontsize_new = fontsize; | |
1520 web_browser_new = web_browser; | |
1521 proxytype_new = proxytype; | |
1522 g_snprintf(sound_cmd_new, sizeof(sound_cmd_new), "%s", sound_cmd); | |
3500 | 1523 g_snprintf(web_command_new, sizeof(web_command_new), "%s", |
3434 | 1524 web_command ? web_command : "xterm -e lynx %%s"); |
3366 | 1525 g_snprintf(fontface_new, sizeof(fontface_new), fontface); |
1526 memcpy(&conv_size_new, &conv_size, sizeof(struct window_size)); | |
3500 | 1527 memcpy(&buddy_chat_size_new, &buddy_chat_size, sizeof(struct window_size)); |
3366 | 1528 memcpy(&fgcolor_new, &fgcolor, sizeof(GdkColor)); |
1529 memcpy(&bgcolor_new, &bgcolor, sizeof(GdkColor)); | |
3500 | 1530 |
3366 | 1531 /* Create the window */ |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1532 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
905 | 1533 gtk_window_set_wmclass(GTK_WINDOW(prefs), "preferences", "Gaim"); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1534 gtk_widget_realize(prefs); |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1535 gtk_window_set_title(GTK_WINDOW(prefs), _("Gaim - Preferences")); |
3366 | 1536 gtk_window_set_policy (GTK_WINDOW(prefs), FALSE, FALSE, TRUE); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1537 gtk_signal_connect(GTK_OBJECT(prefs), "destroy", GTK_SIGNAL_FUNC(delete_prefs), NULL); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1538 |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1539 vbox = gtk_vbox_new(FALSE, 5); |
1185 | 1540 gtk_container_border_width(GTK_CONTAINER(vbox), 5); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1541 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1542 gtk_widget_show(vbox); |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1543 |
3366 | 1544 hbox = gtk_hbox_new (FALSE, 6); |
1545 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1546 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
1547 gtk_widget_show (hbox); | |
1548 | |
1549 frame = gtk_frame_new (NULL); | |
1550 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
1551 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); | |
1552 gtk_widget_show (frame); | |
3500 | 1553 |
3366 | 1554 /* The tree -- much inspired by the Gimp */ |
1555 prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
1556 tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree)); | |
1557 gtk_container_add (GTK_CONTAINER (frame), tree_v); | |
1558 | |
1559 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE); | |
1560 gtk_widget_show(tree_v); | |
1561 /* icons */ | |
1562 cell = gtk_cell_renderer_pixbuf_new (); | |
1563 column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL); | |
3500 | 1564 |
3366 | 1565 /* text */ |
1566 cell = gtk_cell_renderer_text_new (); | |
1567 column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL); | |
3500 | 1568 |
3366 | 1569 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1570 |
3472 | 1571 /* The right side */ |
1572 frame = gtk_frame_new (NULL); | |
1573 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
1574 gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); | |
1575 gtk_widget_show (frame); | |
3500 | 1576 |
3472 | 1577 vbox2 = gtk_vbox_new (FALSE, 4); |
1578 gtk_container_add (GTK_CONTAINER (frame), vbox2); | |
1579 gtk_widget_show (vbox2); | |
3500 | 1580 |
3472 | 1581 frame = gtk_frame_new (NULL); |
1582 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); | |
1583 gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0); | |
1584 gtk_widget_show (frame); | |
3500 | 1585 |
3472 | 1586 hbox = gtk_hbox_new (FALSE, 4); |
1587 gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); | |
1588 gtk_container_add (GTK_CONTAINER (frame), hbox); | |
1589 gtk_widget_show (hbox); | |
3500 | 1590 |
3472 | 1591 preflabel = gtk_label_new(NULL); |
1592 gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0); | |
1593 gtk_widget_show (preflabel); | |
3500 | 1594 |
3472 | 1595 /* The notebook */ |
1596 prefsnotebook = notebook = gtk_notebook_new (); | |
1597 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); | |
1598 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); | |
1599 gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0); | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1600 |
3472 | 1601 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v)); |
1602 g_signal_connect (G_OBJECT (sel), "changed", | |
1603 G_CALLBACK (pref_nb_select), | |
1604 notebook); | |
3500 | 1605 gtk_widget_show(notebook); |
3472 | 1606 sep = gtk_hseparator_new(); |
1607 gtk_widget_show(sep); | |
1608 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); | |
3500 | 1609 |
3472 | 1610 /* The buttons to press! */ |
1611 hbox = gtk_hbox_new (FALSE, 6); | |
1612 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
1613 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
3500 | 1614 gtk_widget_show (hbox); |
3377 | 1615 |
3509 | 1616 button = gtk_button_new_from_stock (GTK_STOCK_OK); |
3515 | 1617 gtk_size_group_add_widget(sg, button); |
3509 | 1618 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_cb), prefs); |
1619 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1620 gtk_widget_show(button); | |
1621 | |
3515 | 1622 button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); |
1623 gtk_size_group_add_widget(sg, button); | |
1624 gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), prefs); | |
1625 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
1626 gtk_widget_show(button); | |
1627 | |
3472 | 1628 button = gtk_button_new_from_stock (GTK_STOCK_APPLY); |
3515 | 1629 gtk_size_group_add_widget(sg, button); |
3500 | 1630 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(apply_cb), prefs); |
3472 | 1631 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
1632 gtk_widget_show(button); | |
3500 | 1633 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1634 |
3500 | 1635 prefs_notebook_init(); |
3427 | 1636 |
3472 | 1637 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); |
1638 gtk_widget_show(prefs); | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1639 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1640 |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1641 static gint debug_delete(GtkWidget *w, GdkEvent *event, void *dummy) |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1642 { |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1643 if (debugbutton) |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1644 gtk_button_clicked(GTK_BUTTON(debugbutton)); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1645 if (misc_options & OPT_MISC_DEBUG) { |
3500 | 1646 misc_options_new ^= OPT_MISC_DEBUG; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1647 misc_options ^= OPT_MISC_DEBUG; |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1648 save_prefs(); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1649 } |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1650 g_free(dw); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1651 dw = NULL; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1652 return FALSE; |
1 | 1653 |
1654 } | |
1655 | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1656 static void build_debug() |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1657 { |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1658 GtkWidget *scroll; |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1659 GtkWidget *box; |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1660 if (!dw) |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1661 dw = g_new0(struct debug_window, 1); |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1662 |
2725
f3c094e78609
[gaim-migrate @ 2738]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2676
diff
changeset
|
1663 GAIM_DIALOG(dw->window); |
2536
0e0a54e5819a
[gaim-migrate @ 2549]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2471
diff
changeset
|
1664 gtk_window_set_title(GTK_WINDOW(dw->window), _("Gaim debug output window")); |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1665 gtk_window_set_wmclass(GTK_WINDOW(dw->window), "debug_out", "Gaim"); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1666 gtk_signal_connect(GTK_OBJECT(dw->window), "delete_event", GTK_SIGNAL_FUNC(debug_delete), NULL); |
2547
ab55ac6234b8
[gaim-migrate @ 2560]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2536
diff
changeset
|
1667 gtk_widget_realize(dw->window); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1668 |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1669 box = gtk_hbox_new(FALSE, 0); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1670 gtk_container_add(GTK_CONTAINER(dw->window), box); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1671 gtk_widget_show(box); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1672 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1673 dw->entry = gtk_text_new(NULL, NULL); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1674 gtk_text_set_word_wrap(GTK_TEXT(dw->entry), TRUE); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1675 gtk_text_set_editable(GTK_TEXT(dw->entry), FALSE); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1676 gtk_container_add(GTK_CONTAINER(box), dw->entry); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1677 gtk_widget_set_usize(dw->entry, 500, 200); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1678 gtk_widget_show(dw->entry); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1679 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1680 scroll = gtk_vscrollbar_new(GTK_TEXT(dw->entry)->vadj); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1681 gtk_box_pack_start(GTK_BOX(box), scroll, FALSE, FALSE, 0); |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1682 gtk_widget_show(scroll); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1683 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1684 gtk_widget_show(dw->window); |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1685 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1686 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1687 void show_debug() |
1 | 1688 { |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1689 if ((misc_options & OPT_MISC_DEBUG)) { |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1690 if (!dw || !dw->window) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1691 build_debug(); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1692 gtk_widget_show(dw->window); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1693 } else { |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1694 if (!dw) |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1695 return; |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1696 gtk_widget_destroy(dw->window); |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1697 dw->window = NULL; |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1698 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1699 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1700 |
970 | 1701 void debug_printf(char *fmt, ...) |
1702 { | |
1703 va_list ap; | |
1704 gchar *s; | |
1705 | |
1366
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1706 va_start(ap, fmt); |
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1707 s = g_strdup_vprintf(fmt, ap); |
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1708 va_end(ap); |
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1709 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1710 if (misc_options & OPT_MISC_DEBUG && dw) { |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1711 GtkAdjustment *adj = GTK_TEXT(dw->entry)->vadj; |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1712 gboolean scroll = (adj->value == adj->upper - adj->lower - adj->page_size); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1713 |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1714 gtk_text_freeze(GTK_TEXT(dw->entry)); |
970 | 1715 gtk_text_insert(GTK_TEXT(dw->entry), NULL, NULL, NULL, s, -1); |
2282
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1716 gtk_text_thaw(GTK_TEXT(dw->entry)); |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1717 |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1718 if (scroll) |
0dea5214d63f
[gaim-migrate @ 2292]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2269
diff
changeset
|
1719 gtk_adjustment_set_value(adj, adj->upper - adj->lower - adj->page_size); |
1366
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1720 } |
2823
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2794
diff
changeset
|
1721 if (opt_debug) |
cd23279122ed
[gaim-migrate @ 2836]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2794
diff
changeset
|
1722 g_print("%s", s); |
1366
155db3303ebb
[gaim-migrate @ 1376]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1357
diff
changeset
|
1723 g_free(s); |
970 | 1724 } |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1725 |
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1726 |
915
378c862a2381
[gaim-migrate @ 925]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
910
diff
changeset
|
1727 |
3500 | 1728 |
1729 | |
1730 | |
1 | 1731 void set_option(GtkWidget *w, int *option) |
1732 { | |
1733 *option = !(*option); | |
1734 } | |
1735 | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1736 static void set_misc_option(GtkWidget *w, int option) |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1737 { |
3500 | 1738 misc_options_new ^= option; |
1739 | |
1740 /* gross hack because we don't want to save all prefs just because | |
1741 * we enabled the debug window. then again, what about the debug | |
1742 * window _isn't_ an ugly hack? */ | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1743 |
3500 | 1744 if (option == OPT_MISC_DEBUG) { |
1745 misc_options ^= option; | |
1746 save_prefs(); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1747 show_debug(); |
3500 | 1748 } |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1749 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1750 |
3366 | 1751 |
1752 /* Functions for each _options variable that sees what's changed, and makes | |
1753 * effective those changes that take place immediately (UI stuff) */ | |
1754 static void set_misc_options() | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1755 { |
3500 | 1756 |
1757 /* int option = misc_options ^ misc_options_new; */ | |
3366 | 1758 misc_options = misc_options_new; |
3500 | 1759 |
3366 | 1760 } |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1761 |
3366 | 1762 static void set_logging_options() |
1763 { | |
1764 int option = logging_options ^ logging_options_new; | |
1765 logging_options = logging_options_new; | |
3500 | 1766 |
3457 | 1767 if (option & OPT_LOG_CONVOS || option & OPT_LOG_CHATS) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1768 update_log_convs(); |
1773 | 1769 |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1770 } |
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
1771 |
3366 | 1772 static void set_blist_options() |
1 | 1773 { |
3366 | 1774 int option = blist_options ^ blist_options_new; |
1775 blist_options = blist_options_new; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1776 |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1777 if (!blist) |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1778 return; |
3500 | 1779 |
3366 | 1780 if (option & OPT_BLIST_BOTTOM_TAB) |
1781 set_blist_tab(); | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1782 |
3366 | 1783 if (option & OPT_BLIST_NO_BUTTONS) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1784 build_imchat_box(!(blist_options & OPT_BLIST_NO_BUTTONS)); |
696
97b75ed155b0
[gaim-migrate @ 706]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
683
diff
changeset
|
1785 |
3366 | 1786 if (option & OPT_BLIST_SHOW_GRPNUM) |
1070
b288f17c2fb2
[gaim-migrate @ 1080]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1030
diff
changeset
|
1787 update_num_groups(); |
9 | 1788 |
3366 | 1789 if (option & OPT_BLIST_NO_MT_GRP) |
1072
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1790 toggle_show_empty_groups(); |
81d19577285a
[gaim-migrate @ 1082]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1070
diff
changeset
|
1791 |
3366 | 1792 if ((option & OPT_BLIST_SHOW_BUTTON_XPM) || (option & OPT_BLIST_NO_BUTTONS)) |
1296
11e5b1220028
[gaim-migrate @ 1306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1269
diff
changeset
|
1793 update_button_pix(); |
11e5b1220028
[gaim-migrate @ 1306]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1269
diff
changeset
|
1794 |
3366 | 1795 if (option & OPT_BLIST_SHOW_PIXMAPS) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1796 toggle_buddy_pixmaps(); |
2593
5ba9ef368b8e
[gaim-migrate @ 2606]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2592
diff
changeset
|
1797 |
3366 | 1798 if ((option & OPT_BLIST_GREY_IDLERS) || (option & OPT_BLIST_SHOW_IDLETIME)) |
2594 | 1799 update_idle_times(); |
3032 | 1800 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1801 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1802 |
3366 | 1803 static void set_convo_options() |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1804 { |
3366 | 1805 int option = convo_options ^ convo_options_new; |
1806 convo_options = convo_options_new; | |
3500 | 1807 |
1808 if (option & OPT_CONVO_SHOW_SMILEY) | |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1411
diff
changeset
|
1809 toggle_smileys(); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1411
diff
changeset
|
1810 |
3366 | 1811 if (option & OPT_CONVO_SHOW_TIME) |
1428
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1411
diff
changeset
|
1812 toggle_timestamps(); |
00b3d02a2168
[gaim-migrate @ 1438]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1411
diff
changeset
|
1813 |
3366 | 1814 if (option & OPT_CONVO_CHECK_SPELLING) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1815 toggle_spellchk(); |
572
faca21605e1b
[gaim-migrate @ 582]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
570
diff
changeset
|
1816 |
3366 | 1817 if (option & OPT_CONVO_COMBINE) { |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
1818 /* (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB) == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB) */ |
3500 | 1819 |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
1820 } |
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
1821 |
1 | 1822 } |
1823 | |
3366 | 1824 static void set_im_options() |
1 | 1825 { |
3366 | 1826 int option = im_options ^ im_options_new; |
1827 im_options = im_options_new; | |
3500 | 1828 |
3366 | 1829 if (option & OPT_IM_ONE_WINDOW) |
2843
87d11d2a7d59
[gaim-migrate @ 2856]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2839
diff
changeset
|
1830 im_tabize(); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1831 |
3366 | 1832 if (option & OPT_IM_SIDE_TAB || option & OPT_IM_BR_TAB) |
1833 update_im_tabs(); | |
1834 | |
1835 if (option & OPT_IM_HIDE_ICONS) | |
2323
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2322
diff
changeset
|
1836 set_hide_icons(); |
bde2481bb4db
[gaim-migrate @ 2333]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2322
diff
changeset
|
1837 |
3366 | 1838 if (option & OPT_IM_ALIAS_TAB) |
2787
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2760
diff
changeset
|
1839 set_convo_titles(); |
feea7103a235
[gaim-migrate @ 2800]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2760
diff
changeset
|
1840 |
3366 | 1841 if (option & OPT_IM_NO_ANIMATION) |
3013 | 1842 set_anim(); |
3500 | 1843 |
3366 | 1844 if (option & OPT_IM_BUTTON_TEXT || option & OPT_IM_BUTTON_XPM) |
3500 | 1845 update_im_button_pix(); |
1 | 1846 } |
1847 | |
3366 | 1848 static void set_chat_options() |
1 | 1849 { |
3366 | 1850 int option = chat_options ^ chat_options_new; |
1851 chat_options = chat_options_new; | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1852 |
3366 | 1853 if (option & OPT_CHAT_ONE_WINDOW) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1854 chat_tabize(); |
3500 | 1855 |
3366 | 1856 if (option & OPT_CHAT_BUTTON_TEXT || option & OPT_CHAT_BUTTON_XPM) |
3500 | 1857 update_chat_button_pix(); |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1858 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1859 |
3366 | 1860 void set_sound_options() |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1861 { |
3366 | 1862 /* int option = sound_options ^ sound_options_new; */ |
1863 sound_options = sound_options_new; | |
3500 | 1864 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1865 } |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1866 |
3366 | 1867 static void set_font_options() |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1868 { |
3366 | 1869 /* int option = font_options ^ font_options_new; */ |
1870 font_options = font_options_new; | |
3500 | 1871 |
1253
8342d3aab1f1
[gaim-migrate @ 1263]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1250
diff
changeset
|
1872 update_font_buttons(); |
1 | 1873 } |
1874 | |
3366 | 1875 static void set_away_options() |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
1876 { |
3500 | 1877 int option = away_options ^ away_options_new; |
3366 | 1878 away_options = away_options_new; |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1879 |
3366 | 1880 if (option & OPT_AWAY_QUEUE) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1881 toggle_away_queue(); |
3366 | 1882 } |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
1883 |
3366 | 1884 static void toggle_option(GtkWidget *w, int option) { |
1885 int *o = gtk_object_get_user_data(GTK_OBJECT(w)); | |
1886 *o ^= option; | |
1525
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
1887 } |
ba8e6e211af5
[gaim-migrate @ 1535]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1455
diff
changeset
|
1888 |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1889 GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) |
1 | 1890 { |
1891 GtkWidget *button; | |
3427 | 1892 button = gtk_check_button_new_with_mnemonic(text); |
1 | 1893 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (*options & option)); |
1894 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); | |
3366 | 1895 gtk_object_set_user_data(GTK_OBJECT(button), options); |
1 | 1896 |
3391 | 1897 /* So that the debug window happens immediately |
1898 * I don't think it should be "preferences," anyway. */ | |
3500 | 1899 if (options == &misc_options_new && option == OPT_MISC_DEBUG) |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1900 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_misc_option), |
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1901 (int *)option); |
3366 | 1902 else |
1903 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_option), | |
2313
bd9d403fb15b
[gaim-migrate @ 2323]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2282
diff
changeset
|
1904 (int *)option); |
3500 | 1905 |
1 | 1906 gtk_widget_show(button); |
1907 | |
1908 return button; | |
1909 } | |
1910 | |
3366 | 1911 void away_list_clicked(GtkWidget *widget, struct away_message *a) |
1912 {} | |
1913 void default_away_menu_init(GtkWidget *omenu) | |
3032 | 1914 { |
3366 | 1915 GtkWidget *menu, *opt; |
1916 int index = 0; | |
1917 GSList *awy = away_messages; | |
1918 struct away_message *a; | |
1919 | |
1920 menu = gtk_menu_new(); | |
1921 | |
1922 while (awy) { | |
1923 a = (struct away_message *)awy->data; | |
1924 opt = gtk_menu_item_new_with_label(a->name); | |
1925 gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_default_away), | |
1926 (gpointer)index); | |
1927 gtk_widget_show(opt); | |
1928 gtk_menu_append(GTK_MENU(menu), opt); | |
1929 | |
1930 awy = awy->next; | |
1931 index++; | |
1932 } | |
1933 | |
1934 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); | |
1935 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); | |
1936 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), g_slist_index(away_messages, default_away)); | |
1937 } | |
1938 | |
1939 GtkWidget *pref_fg_picture = NULL; | |
1940 GtkWidget *pref_bg_picture = NULL; | |
1941 | |
1942 void destroy_colorsel(GtkWidget *w, gpointer d) | |
1943 { | |
1944 if (d) { | |
1945 gtk_widget_destroy(fgcseld); | |
1946 fgcseld = NULL; | |
1947 } else { | |
1948 gtk_widget_destroy(bgcseld); | |
1949 bgcseld = NULL; | |
1950 } | |
3032 | 1951 } |
1952 | |
3366 | 1953 void apply_color_dlg(GtkWidget *w, gpointer d) |
3032 | 1954 { |
3366 | 1955 if ((int)d == 1) { |
1956 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION | |
3500 | 1957 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), |
3366 | 1958 &fgcolor_new); |
1959 destroy_colorsel(NULL, (void *)1); | |
1960 update_color(NULL, pref_fg_picture); | |
1961 } else { | |
1962 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION | |
3500 | 1963 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), |
3366 | 1964 &bgcolor_new); |
1965 destroy_colorsel(NULL, (void *)0); | |
1966 update_color(NULL, pref_bg_picture); | |
1967 } | |
3032 | 1968 } |
1969 | |
3366 | 1970 void update_color(GtkWidget *w, GtkWidget *pic) |
1 | 1971 { |
3366 | 1972 GdkColor c; |
1973 GtkStyle *style; | |
1974 c.pixel = 0; | |
3500 | 1975 |
3366 | 1976 if (pic == pref_fg_picture) { |
1977 if (font_options_new & OPT_FONT_FGCOL) { | |
1978 c.red = fgcolor_new.red; | |
1979 c.blue = fgcolor_new.blue; | |
1980 c.green = fgcolor_new.green; | |
1981 } else { | |
1982 c.red = 0; | |
1983 c.blue = 0; | |
1984 c.green = 0; | |
1985 } | |
1986 } else { | |
1987 if (font_options_new & OPT_FONT_BGCOL) { | |
1988 c.red = bgcolor_new.red; | |
1989 c.blue = bgcolor_new.blue; | |
1990 c.green = bgcolor_new.green; | |
1991 } else { | |
1992 c.red = 0xffff; | |
1993 c.blue = 0xffff; | |
1994 c.green = 0xffff; | |
1995 } | |
1996 } | |
1997 | |
1998 style = gtk_style_new(); | |
1999 style->bg[0] = c; | |
2000 gtk_widget_set_style(pic, style); | |
2001 gtk_style_unref(style); | |
2002 } | |
2003 void set_default_away(GtkWidget *w, gpointer i) | |
2004 { | |
2005 | |
2006 int length = g_slist_length(away_messages); | |
338
9d258a0aa560
[gaim-migrate @ 348]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
337
diff
changeset
|
2007 |
3366 | 2008 if (away_messages == NULL) |
2009 default_away_new = NULL; | |
2010 else if ((int)i >= length) | |
2011 default_away_new = g_slist_nth_data(away_messages, length - 1); | |
2012 else | |
2013 default_away_new = g_slist_nth_data(away_messages, (int)i); | |
2014 } | |
3500 | 2015 |
3366 | 2016 static void update_spin_value(GtkWidget *w, GtkWidget *spin) |
2017 { | |
2018 int *value = gtk_object_get_user_data(GTK_OBJECT(spin)); | |
2019 *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); | |
2020 } | |
3427 | 2021 GtkWidget *gaim_labeled_spin_button(GtkWidget *box, const gchar *title, int *val, int min, int max, GtkSizeGroup *sg) |
3366 | 2022 { |
2023 GtkWidget *hbox; | |
2024 GtkWidget *label; | |
2025 GtkWidget *spin; | |
2026 GtkObject *adjust; | |
901
f168f2c7b357
[gaim-migrate @ 911]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
893
diff
changeset
|
2027 |
3366 | 2028 hbox = gtk_hbox_new(FALSE, 5); |
2029 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); | |
2030 gtk_widget_show(hbox); | |
2031 | |
3427 | 2032 label = gtk_label_new_with_mnemonic(title); |
3366 | 2033 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2034 gtk_widget_show(label); | |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1840
diff
changeset
|
2035 |
3366 | 2036 adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); |
2037 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); | |
2038 gtk_object_set_user_data(GTK_OBJECT(spin), val); | |
2039 gtk_widget_set_usize(spin, 50, -1); | |
2040 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); | |
2041 gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", | |
2042 GTK_SIGNAL_FUNC(update_spin_value), GTK_WIDGET(spin)); | |
2043 gtk_widget_show(spin); | |
3500 | 2044 |
3427 | 2045 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); |
2046 | |
2047 if (sg) { | |
2048 gtk_size_group_add_widget(sg, label); | |
2049 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
3500 | 2050 |
3427 | 2051 } |
2052 return label; | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
2053 } |
1 | 2054 |
3366 | 2055 void dropdown_set(GtkObject *w, int *option) |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
2056 { |
3366 | 2057 int opt = (int)gtk_object_get_user_data(w); |
2058 int clear = (int)gtk_object_get_data(w, "clear"); | |
3500 | 2059 |
3366 | 2060 if (clear != -1) { |
2061 *option = *option & ~clear; | |
2062 *option = *option | opt; | |
2063 } else { | |
2064 debug_printf("HELLO %d\n", opt); | |
2065 *option = opt; | |
2066 } | |
3500 | 2067 |
3366 | 2068 if (option == &proxytype_new) { |
2069 if (opt == PROXY_NONE) | |
2070 gtk_widget_set_sensitive(prefs_proxy_frame, FALSE); | |
2071 else | |
2072 gtk_widget_set_sensitive(prefs_proxy_frame, TRUE); | |
2073 } else if (option == &web_browser_new) { | |
2074 if (opt == BROWSER_MANUAL) | |
2075 gtk_widget_set_sensitive(browser_entry, TRUE); | |
2076 else | |
2077 gtk_widget_set_sensitive(browser_entry, FALSE); | |
3379 | 2078 } else if (*option == sound_options_new) { |
3366 | 2079 if (opt == OPT_SOUND_CMD) |
2080 gtk_widget_set_sensitive(sndcmd, TRUE); | |
2081 else | |
2082 gtk_widget_set_sensitive(sndcmd, FALSE); | |
2083 } | |
3500 | 2084 |
1 | 2085 } |
2086 | |
3500 | 2087 static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) |
1 | 2088 { |
3366 | 2089 va_list menuitems; |
2090 GtkWidget *dropdown, *opt, *menu; | |
2091 GtkWidget *label; | |
2092 gchar *text; | |
2093 int value; | |
2094 int o = 0; | |
2095 GtkWidget *hbox; | |
1 | 2096 |
3366 | 2097 hbox = gtk_hbox_new(FALSE, 5); |
2098 gtk_container_add (GTK_CONTAINER (box), hbox); | |
2099 gtk_widget_show(hbox); | |
2100 | |
3427 | 2101 label = gtk_label_new_with_mnemonic(title); |
3366 | 2102 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
2103 gtk_widget_show(label); | |
2104 | |
2105 va_start(menuitems, clear); | |
2106 text = va_arg(menuitems, gchar *); | |
2107 | |
2108 if (!text) | |
2109 return NULL; | |
3500 | 2110 |
3366 | 2111 dropdown = gtk_option_menu_new(); |
2112 menu = gtk_menu_new(); | |
3500 | 2113 |
3427 | 2114 gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); |
3500 | 2115 |
3366 | 2116 while (text) { |
2117 value = va_arg(menuitems, int); | |
2118 opt = gtk_menu_item_new_with_label(text); | |
2119 gtk_object_set_user_data(GTK_OBJECT(opt), (void *)value); | |
2120 gtk_object_set_data(GTK_OBJECT(opt), "clear", (void *)clear); | |
2121 gtk_signal_connect(GTK_OBJECT(opt), "activate", | |
2122 GTK_SIGNAL_FUNC(dropdown_set), (void *)option); | |
2123 gtk_widget_show(opt); | |
2124 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
1 | 2125 |
3366 | 2126 if (((clear > -1) && ((*option & value) == value)) || *option == value) { |
2127 gtk_menu_set_active(GTK_MENU(menu), o); | |
2128 } | |
2129 text = va_arg(menuitems, gchar *); | |
2130 o++; | |
2131 } | |
2262
9c8f353331e7
[gaim-migrate @ 2272]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2254
diff
changeset
|
2132 |
3366 | 2133 va_end(menuitems); |
1 | 2134 |
3500 | 2135 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); |
3366 | 2136 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); |
2137 gtk_widget_show(dropdown); | |
3427 | 2138 return label; |
3500 | 2139 } |
2140 | |
3366 | 2141 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) |
1 | 2142 { |
3366 | 2143 /* more stuff stolen from X-Chat */ |
2144 GtkWidget *swid; | |
2145 GdkColor c; | |
2146 GtkStyle *style; | |
2147 c.pixel = 0; | |
2148 if (fgc) { | |
2149 if (font_options_new & OPT_FONT_FGCOL) { | |
2150 c.red = fgcolor_new.red; | |
2151 c.blue = fgcolor_new.blue; | |
2152 c.green = fgcolor_new.green; | |
2153 } else { | |
2154 c.red = 0; | |
2155 c.blue = 0; | |
2156 c.green = 0; | |
2157 } | |
2158 } else { | |
2159 if (font_options_new & OPT_FONT_BGCOL) { | |
2160 c.red = bgcolor_new.red; | |
2161 c.blue = bgcolor_new.blue; | |
2162 c.green = bgcolor_new.green; | |
2163 } else { | |
2164 c.red = 0xffff; | |
2165 c.blue = 0xffff; | |
2166 c.green = 0xffff; | |
2167 } | |
2168 } | |
1 | 2169 |
3366 | 2170 style = gtk_style_new(); |
2171 style->bg[0] = c; | |
652
4d3285caa191
[gaim-migrate @ 662]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
619
diff
changeset
|
2172 |
3366 | 2173 swid = gtk_event_box_new(); |
2174 gtk_widget_set_style(GTK_WIDGET(swid), style); | |
2175 gtk_style_unref(style); | |
2176 gtk_widget_set_usize(GTK_WIDGET(swid), 40, -1); | |
2177 gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5); | |
2178 gtk_widget_show(swid); | |
2179 return swid; | |
1 | 2180 } |
3366 | 2181 void apply_font_dlg(GtkWidget *w, GtkWidget *f) |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
2182 { |
3366 | 2183 int i = 0; |
2184 char *fontname; | |
2185 | |
3473 | 2186 fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f))); |
3366 | 2187 destroy_fontsel(0, 0); |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
2188 |
3500 | 2189 while(fontname[i] && !isdigit(fontname[i]) && i < sizeof(fontface_new)) { |
3366 | 2190 fontface_new[i] = fontname[i]; |
2191 i++; | |
2192 } | |
3473 | 2193 fontface_new[i] = 0; |
2194 debug_printf("fontface_new: %s\n", fontface_new); | |
3366 | 2195 g_free(fontname); |
1124
a70d5200edde
[gaim-migrate @ 1134]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1123
diff
changeset
|
2196 } |
3500 | 2197 |