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