Mercurial > pidgin.yaz
annotate src/gtkprefs.c @ 8193:e0a70b763872
[gaim-migrate @ 8915]
ok, this should all work now
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 31 Jan 2004 22:30:29 +0000 |
parents | cd9ea20cd8ed |
children | f50c059b6384 |
rev | line source |
---|---|
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1 /** |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2 * @file gtkprefs.c GTK+ Preferences |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
3 * @ingroup gtkui |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
4 * |
5440 | 5 * gaim |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
5440 | 10 * |
11 * This program is free software; you can redistribute it and/or modify | |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 * | |
25 */ | |
6371
8f94cce8faa5
[gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents:
6216
diff
changeset
|
26 #include "gtkinternal.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
27 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
28 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
29 #include "notify.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
30 #include "prefs.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
31 #include "proxy.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
32 #include "prpl.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
33 #include "sound.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
34 #include "util.h" |
8170 | 35 #include "multi.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
36 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
37 #include "gtkblist.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
38 #include "gtkconv.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
39 #include "gtkdebug.h" |
5440 | 40 #include "gtkimhtml.h" |
41 #include "gtkplugin.h" | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
42 #include "gtkprefs.h" |
5684 | 43 #include "gtksound.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
44 #include "gtkutils.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
45 #include "stock.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
46 |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
47 #include "ui.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5870
diff
changeset
|
48 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
49 #define PROXYHOST 0 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
50 #define PROXYPORT 1 |
6005 | 51 #define PROXYUSER 2 |
52 #define PROXYPASS 3 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
53 |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
54 /* XXX This needs to be made static after we solve the away.c mess. */ |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
55 GtkListStore *prefs_away_store = NULL; |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
56 GtkWidget *prefs_away_menu = NULL; |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
57 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
58 static GtkWidget *tree_v = NULL; |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
59 |
5440 | 60 |
61 static int sound_row_sel = 0; | |
62 static char *last_sound_dir = NULL; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
63 static GtkWidget *preflabel; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
64 static GtkWidget *prefsnotebook; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
65 static GtkTreeStore *prefstree; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
66 |
5440 | 67 |
68 static GtkWidget *sounddialog = NULL; | |
69 static GtkWidget *sound_entry = NULL; | |
70 static GtkWidget *away_text = NULL; | |
71 static GtkListStore *smiley_theme_store = NULL; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
72 static GtkWidget *prefs_proxy_frame = NULL; |
5440 | 73 |
74 static GtkWidget *prefs = NULL; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
75 static GtkWidget *debugbutton = NULL; |
5440 | 76 static int notebook_page = 0; |
77 static GtkTreeIter plugin_iter; | |
78 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
79 static guint browser_pref_id = 0; |
6001 | 80 static guint proxy_pref_id = 0; |
6005 | 81 static guint sound_pref_id = 0; |
6142 | 82 static guint auto_resp_pref_id = 0; |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
83 |
5440 | 84 /* |
85 * PROTOTYPES | |
86 */ | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
87 static GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
88 GtkWidget*, GtkTreeIter*, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
89 GtkTreeIter*, int); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
90 static GtkWidget *show_color_pref(GtkWidget *, gboolean); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
91 static void delete_prefs(GtkWidget *, void *); |
5440 | 92 static void update_plugin_list(void *data); |
93 | |
7931 | 94 static void set_default_away(GtkWidget *, gpointer); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
95 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
96 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
97 update_spin_value(GtkWidget *w, GtkWidget *spin) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
98 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
99 const char *key = g_object_get_data(G_OBJECT(spin), "val"); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
100 int value; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
101 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
102 value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
103 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
104 gaim_prefs_set_int(key, value); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
105 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
106 |
7976 | 107 GtkWidget * |
7987 | 108 gaim_gtk_prefs_labeled_spin_button(GtkWidget *box, const gchar *title, |
109 char *key, int min, int max, GtkSizeGroup *sg) | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
110 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
111 GtkWidget *hbox; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
112 GtkWidget *label; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
113 GtkWidget *spin; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
114 GtkObject *adjust; |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
115 int val; |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
116 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
117 val = gaim_prefs_get_int(key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
118 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
119 hbox = gtk_hbox_new(FALSE, 5); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
120 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
121 gtk_widget_show(hbox); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
122 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
123 label = gtk_label_new_with_mnemonic(title); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
124 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
125 gtk_widget_show(label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
126 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
127 adjust = gtk_adjustment_new(val, min, max, 1, 1, 1); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
128 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
129 g_object_set_data(G_OBJECT(spin), "val", key); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
130 gtk_widget_set_size_request(spin, 50, -1); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
131 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
132 g_signal_connect(G_OBJECT(adjust), "value-changed", |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
133 G_CALLBACK(update_spin_value), GTK_WIDGET(spin)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
134 gtk_widget_show(spin); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
135 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
136 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
137 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
138 if (sg) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
139 gtk_size_group_add_widget(sg, label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
140 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
141 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
142 |
8137 | 143 gaim_set_accessible_label (spin, label); |
144 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
145 return label; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
146 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
147 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
148 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
149 dropdown_set(GObject *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
150 { |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
151 const char *bool_key; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
152 const char *str_value; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
153 int int_value; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
154 GaimPrefType type; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
155 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
156 type = GPOINTER_TO_INT(g_object_get_data(w, "type")); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
157 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
158 if (type == GAIM_PREF_INT) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
159 int_value = GPOINTER_TO_INT(g_object_get_data(w, "value")); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
160 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
161 gaim_prefs_set_int(key, int_value); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
162 } |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
163 else if (type == GAIM_PREF_STRING) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
164 str_value = (const char *)g_object_get_data(w, "value"); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
165 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
166 gaim_prefs_set_string(key, str_value); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
167 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
168 else if (type == GAIM_PREF_BOOLEAN) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
169 bool_key = (const char *)g_object_get_data(w, "value"); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
170 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
171 if (!strcmp(key, bool_key)) |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
172 return; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
173 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
174 gaim_prefs_set_bool(key, FALSE); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
175 gaim_prefs_set_bool(bool_key, TRUE); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
176 } |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
177 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
178 |
7976 | 179 GtkWidget * |
7987 | 180 gaim_gtk_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, |
181 GaimPrefType type, const char *key, GList *menuitems) | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
182 { |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
183 GtkWidget *dropdown, *opt, *menu; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
184 GtkWidget *label; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
185 GtkWidget *hbox; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
186 gchar *text; |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
187 const char *bool_key = NULL; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
188 const char *stored_str = NULL; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
189 int stored_int = 0; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
190 int int_value = 0; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
191 const char *str_value = NULL; |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
192 int o = 0; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
193 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
194 g_return_val_if_fail(menuitems != NULL, NULL); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
195 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
196 hbox = gtk_hbox_new(FALSE, 5); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
197 gtk_container_add (GTK_CONTAINER (box), hbox); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
198 gtk_widget_show(hbox); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
199 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
200 label = gtk_label_new_with_mnemonic(title); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
201 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
202 gtk_widget_show(label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
203 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
204 dropdown = gtk_option_menu_new(); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
205 menu = gtk_menu_new(); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
206 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
207 gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
208 |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
209 if (type == GAIM_PREF_INT) |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
210 stored_int = gaim_prefs_get_int(key); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
211 else if (type == GAIM_PREF_STRING) |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
212 stored_str = gaim_prefs_get_string(key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
213 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
214 while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
215 menuitems = g_list_next(menuitems); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
216 g_return_val_if_fail(menuitems != NULL, NULL); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
217 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
218 opt = gtk_menu_item_new_with_label(text); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
219 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
220 g_object_set_data(G_OBJECT(opt), "type", GINT_TO_POINTER(type)); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
221 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
222 if (type == GAIM_PREF_INT) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
223 int_value = GPOINTER_TO_INT(menuitems->data); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
224 g_object_set_data(G_OBJECT(opt), "value", |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
225 GINT_TO_POINTER(int_value)); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
226 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
227 else if (type == GAIM_PREF_STRING) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
228 str_value = (const char *)menuitems->data; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
229 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
230 g_object_set_data(G_OBJECT(opt), "value", (char *)str_value); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
231 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
232 else if (type == GAIM_PREF_BOOLEAN) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
233 bool_key = (const char *)menuitems->data; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
234 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
235 g_object_set_data(G_OBJECT(opt), "value", (char *)bool_key); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
236 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
237 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
238 g_signal_connect(G_OBJECT(opt), "activate", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
239 G_CALLBACK(dropdown_set), (char *)key); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
240 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
241 gtk_widget_show(opt); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
242 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
243 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
244 if ((type == GAIM_PREF_INT && stored_int == int_value) || |
5753
96214f5de47c
[gaim-migrate @ 6178]
Christian Hammond <chipx86@chipx86.com>
parents:
5716
diff
changeset
|
245 (type == GAIM_PREF_STRING && stored_str != NULL && |
96214f5de47c
[gaim-migrate @ 6178]
Christian Hammond <chipx86@chipx86.com>
parents:
5716
diff
changeset
|
246 !strcmp(stored_str, str_value)) || |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
247 (type == GAIM_PREF_BOOLEAN && gaim_prefs_get_bool(bool_key))) { |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
248 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
249 gtk_menu_set_active(GTK_MENU(menu), o); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
250 } |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
251 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
252 menuitems = g_list_next(menuitems); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
253 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
254 o++; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
255 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
256 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
257 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
258 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
259 gtk_widget_show(dropdown); |
8137 | 260 gaim_set_accessible_label (dropdown, label); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
261 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
262 return label; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
263 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
264 |
7976 | 265 GtkWidget * |
7987 | 266 gaim_gtk_prefs_dropdown(GtkWidget *box, const gchar *title, GaimPrefType type, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
267 const char *key, ...) |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
268 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
269 va_list ap; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
270 GList *menuitems = NULL; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
271 GtkWidget *dropdown = NULL; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
272 char *name; |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
273 int int_value; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
274 const char *str_value; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
275 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
276 va_start(ap, key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
277 while ((name = va_arg(ap, char *)) != NULL) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
278 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
279 menuitems = g_list_prepend(menuitems, name); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
280 |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
281 if (type == GAIM_PREF_INT) { |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
282 int_value = va_arg(ap, int); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
283 menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(int_value)); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
284 } |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
285 else { |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
286 str_value = va_arg(ap, const char *); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
287 menuitems = g_list_prepend(menuitems, (char *)str_value); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
288 } |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
289 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
290 va_end(ap); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
291 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
292 g_return_val_if_fail(menuitems != NULL, NULL); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
293 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
294 menuitems = g_list_reverse(menuitems); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
295 |
7987 | 296 dropdown = gaim_gtk_prefs_dropdown_from_list(box, title, type, key, |
297 menuitems); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
298 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
299 g_list_free(menuitems); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
300 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
301 return dropdown; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
302 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
303 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
304 static void |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
305 delete_prefs(GtkWidget *asdf, void *gdsa) |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
306 { |
5440 | 307 GList *l; |
308 GaimPlugin *plug; | |
309 | |
310 gaim_plugins_unregister_probe_notify_cb(update_plugin_list); | |
311 | |
312 prefs = NULL; | |
313 tree_v = NULL; | |
314 sound_entry = NULL; | |
315 debugbutton = NULL; | |
316 prefs_away_menu = NULL; | |
317 notebook_page = 0; | |
318 smiley_theme_store = NULL; | |
319 if(sounddialog) | |
320 gtk_widget_destroy(sounddialog); | |
321 g_object_unref(G_OBJECT(prefs_away_store)); | |
322 prefs_away_store = NULL; | |
323 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
324 /* Unregister callbacks. */ |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
325 gaim_prefs_disconnect_callback(browser_pref_id); |
6001 | 326 gaim_prefs_disconnect_callback(proxy_pref_id); |
6005 | 327 gaim_prefs_disconnect_callback(sound_pref_id); |
6142 | 328 gaim_prefs_disconnect_callback(auto_resp_pref_id); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
329 |
5440 | 330 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { |
331 plug = l->data; | |
332 | |
333 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
334 GaimGtkPluginUiInfo *ui_info; | |
335 | |
336 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
337 | |
338 if (ui_info->iter != NULL) { | |
339 g_free(ui_info->iter); | |
340 ui_info->iter = NULL; | |
341 } | |
342 } | |
343 } | |
344 } | |
345 | |
346 static void pref_nb_select(GtkTreeSelection *sel, GtkNotebook *nb) { | |
347 GtkTreeIter iter; | |
348 char text[128]; | |
349 GValue val = { 0, }; | |
350 GtkTreeModel *model = GTK_TREE_MODEL(prefstree); | |
351 | |
352 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
353 return; | |
354 gtk_tree_model_get_value (model, &iter, 1, &val); | |
355 g_snprintf(text, sizeof(text), "<span weight=\"bold\" size=\"larger\">%s</span>", | |
356 g_value_get_string(&val)); | |
357 gtk_label_set_markup (GTK_LABEL(preflabel), text); | |
358 g_value_unset (&val); | |
359 gtk_tree_model_get_value (model, &iter, 2, &val); | |
360 gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook), g_value_get_int (&val)); | |
361 | |
362 } | |
363 | |
364 /* These are the pages in the preferences notebook */ | |
365 GtkWidget *interface_page() { | |
366 GtkWidget *ret; | |
367 GtkWidget *vbox; | |
368 ret = gtk_vbox_new(FALSE, 18); | |
369 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
370 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
371 vbox = gaim_gtk_make_frame(ret, _("Interface Options")); |
5440 | 372 |
7987 | 373 gaim_gtk_prefs_checkbox(_("D_isplay remote nicknames if no alias is set"), |
374 "/core/buddies/use_server_alias", vbox); | |
5440 | 375 |
376 | |
377 gtk_widget_show_all(ret); | |
378 return ret; | |
379 } | |
380 | |
381 static void smiley_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
382 GtkTreeIter iter; | |
383 const char *filename; | |
384 GValue val = { 0, }; | |
5841 | 385 |
5440 | 386 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
387 return; | |
388 gtk_tree_model_get_value (model, &iter, 2, &val); | |
389 filename = g_value_get_string(&val); | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
390 gaim_prefs_set_string("/gaim/gtk/smileys/theme", filename); |
5440 | 391 g_value_unset (&val); |
392 } | |
393 | |
394 GtkTreePath *theme_refresh_theme_list() | |
395 { | |
396 GdkPixbuf *pixbuf; | |
397 GSList *themes; | |
398 GtkTreeIter iter; | |
399 GtkTreePath *path = NULL; | |
400 int ind = 0; | |
401 | |
402 | |
403 smiley_theme_probe(); | |
404 | |
405 if (!smiley_themes) | |
406 return NULL; | |
407 | |
408 themes = smiley_themes; | |
409 | |
410 gtk_list_store_clear(smiley_theme_store); | |
411 | |
412 while (themes) { | |
413 struct smiley_theme *theme = themes->data; | |
414 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" | |
415 "<span size='smaller' foreground='dim grey'>%s</span>", | |
416 theme->name, theme->author, theme->desc); | |
417 gtk_list_store_append (smiley_theme_store, &iter); | |
418 pixbuf = gdk_pixbuf_new_from_file(theme->icon, NULL); | |
419 | |
420 gtk_list_store_set(smiley_theme_store, &iter, | |
421 0, pixbuf, | |
422 1, description, | |
423 2, theme->path, | |
424 -1); | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
425 |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
426 if (pixbuf != NULL) |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
427 g_object_unref(G_OBJECT(pixbuf)); |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
428 |
5440 | 429 g_free(description); |
430 themes = themes->next; | |
431 if (current_smiley_theme && !strcmp(theme->path, current_smiley_theme->path)) { | |
432 /* path = gtk_tree_path_new_from_indices(ind); */ | |
433 char *iwishihadgtk2_2 = g_strdup_printf("%d", ind); | |
434 path = gtk_tree_path_new_from_string(iwishihadgtk2_2); | |
435 g_free(iwishihadgtk2_2); | |
436 } | |
437 ind++; | |
438 } | |
439 | |
440 return path; | |
441 } | |
442 | |
443 void theme_install_theme(char *path, char *extn) { | |
444 #ifndef _WIN32 | |
445 gchar *command; | |
446 #endif | |
447 gchar *destdir; | |
448 gchar *tail; | |
449 | |
450 /* Just to be safe */ | |
451 g_strchomp(path); | |
452 | |
453 /* I dont know what you are, get out of here */ | |
454 if (extn != NULL) | |
455 tail = extn; | |
456 else if ((tail = strrchr(path, '.')) == NULL) | |
457 return; | |
458 | |
459 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); | |
460 | |
461 /* We'll check this just to make sure. This also lets us do something different on | |
462 * other platforms, if need be */ | |
463 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { | |
464 #ifndef _WIN32 | |
465 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir); | |
466 #else | |
467 if(!wgaim_gz_untar(path, destdir)) { | |
468 g_free(destdir); | |
469 return; | |
470 } | |
471 #endif | |
472 } | |
473 else { | |
474 g_free(destdir); | |
475 return; | |
476 } | |
477 | |
478 #ifndef _WIN32 | |
479 /* Fire! */ | |
480 system(command); | |
481 | |
482 g_free(command); | |
483 #endif | |
484 g_free(destdir); | |
485 | |
486 theme_refresh_theme_list(); | |
487 } | |
488 | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
489 static void |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
490 theme_got_url(void *data, const char *themedata, size_t len) |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
491 { |
5440 | 492 FILE *f; |
493 gchar *path; | |
494 | |
495 f = gaim_mkstemp(&path); | |
496 fwrite(themedata, len, 1, f); | |
497 fclose(f); | |
498 | |
499 theme_install_theme(path, data); | |
500 | |
501 unlink(path); | |
502 g_free(path); | |
503 } | |
504 | |
505 void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, | |
506 guint info, guint t, gpointer data) { | |
507 gchar *name = sd->data; | |
508 | |
509 if ((sd->length >= 0) && (sd->format == 8)) { | |
510 /* Well, it looks like the drag event was cool. | |
511 * Let's do something with it */ | |
512 | |
513 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
514 GError *converr = NULL; | |
515 gchar *tmp; | |
516 /* It looks like we're dealing with a local file. Let's | |
517 * just untar it in the right place */ | |
518 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { | |
519 gaim_debug(GAIM_DEBUG_ERROR, "theme dnd", "%s\n", | |
520 (converr ? converr->message : | |
521 "g_filename_from_uri error")); | |
522 return; | |
523 } | |
524 theme_install_theme(tmp, NULL); | |
525 g_free(tmp); | |
526 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { | |
527 /* Oo, a web drag and drop. This is where things | |
528 * will start to get interesting */ | |
529 gchar *tail; | |
530 | |
531 if ((tail = strrchr(name, '.')) == NULL) | |
532 return; | |
533 | |
534 /* We'll check this just to make sure. This also lets us do something different on | |
535 * other platforms, if need be */ | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
536 gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); |
5440 | 537 } |
538 | |
539 gtk_drag_finish(dc, TRUE, FALSE, t); | |
540 } | |
541 | |
542 gtk_drag_finish(dc, FALSE, FALSE, t); | |
543 } | |
544 | |
545 GtkWidget *theme_page() { | |
546 GtkWidget *ret; | |
547 GtkWidget *sw; | |
548 GtkWidget *view; | |
549 GtkCellRenderer *rend; | |
550 GtkTreeViewColumn *col; | |
551 GtkTreeSelection *sel; | |
552 GtkTreePath *path = NULL; | |
553 GtkWidget *label; | |
554 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}}; | |
555 | |
556 ret = gtk_vbox_new(FALSE, 18); | |
557 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
558 | |
559 label = gtk_label_new(_("Select a smiley theme that you would like to use from the list below. New themes can be installed by dragging and dropping them onto the theme list.")); | |
560 | |
561 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
562 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
563 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
564 | |
565 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, TRUE, 0); | |
566 gtk_widget_show(label); | |
567 | |
568 sw = gtk_scrolled_window_new(NULL,NULL); | |
7939 | 569 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
7931 | 570 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
5440 | 571 |
572 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
573 smiley_theme_store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); | |
574 | |
575 path = theme_refresh_theme_list(); | |
8075 | 576 |
5440 | 577 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store)); |
578 | |
579 gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, | |
580 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); | |
581 | |
582 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store); | |
583 | |
584 rend = gtk_cell_renderer_pixbuf_new(); | |
585 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); | |
586 | |
587 if(path) { | |
588 gtk_tree_selection_select_path(sel, path); | |
589 gtk_tree_path_free(path); | |
590 } | |
8075 | 591 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(smiley_theme_store), |
592 1, GTK_SORT_ASCENDING); | |
5440 | 593 |
594 col = gtk_tree_view_column_new_with_attributes (_("Icon"), | |
595 rend, | |
596 "pixbuf", 0, | |
597 NULL); | |
598 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
599 | |
600 rend = gtk_cell_renderer_text_new(); | |
601 col = gtk_tree_view_column_new_with_attributes (_("Description"), | |
602 rend, | |
603 "markup", 1, | |
604 NULL); | |
605 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
606 g_object_unref(G_OBJECT(smiley_theme_store)); | |
607 gtk_container_add(GTK_CONTAINER(sw), view); | |
608 | |
8075 | 609 g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smiley_sel), NULL); |
5440 | 610 |
611 gtk_widget_show_all(ret); | |
8137 | 612 |
613 gaim_set_accessible_label (view, label); | |
614 | |
5440 | 615 return ret; |
616 } | |
617 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
618 static void update_color(GtkWidget *w, GtkWidget *pic) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
619 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
620 GdkColor c; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
621 GtkStyle *style; |
5627 | 622 GdkColor color; |
623 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
624 c.pixel = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
625 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
626 if (pic == pref_fg_picture) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
627 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
628 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
629 &color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
630 c.red = color.red; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
631 c.blue = color.blue; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
632 c.green = color.green; |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
633 } else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
634 c.red = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
635 c.blue = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
636 c.green = 0; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
637 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
638 } else { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
639 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
640 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
641 &color); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
642 c.red = color.red; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
643 c.blue = color.blue; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
644 c.green = color.green; |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
645 } else { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
646 c.red = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
647 c.blue = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
648 c.green = 0xffff; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
649 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
650 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
651 |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
652 style = gtk_style_new(); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
653 style->bg[0] = c; |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
654 gtk_widget_set_style(pic, style); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
655 g_object_unref(style); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
656 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
657 |
5440 | 658 GtkWidget *font_page() { |
659 GtkWidget *ret; | |
660 GtkWidget *button; | |
661 GtkWidget *vbox, *hbox; | |
662 GtkWidget *select = NULL; | |
663 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
664 | |
665 ret = gtk_vbox_new(FALSE, 18); | |
666 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
667 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
668 vbox = gaim_gtk_make_frame(ret, _("Style")); |
7987 | 669 gaim_gtk_prefs_checkbox(_("_Bold"), |
670 "/gaim/gtk/conversations/send_bold", vbox); | |
671 gaim_gtk_prefs_checkbox(_("_Italics"), | |
672 "/gaim/gtk/conversations/send_italic", vbox); | |
673 gaim_gtk_prefs_checkbox(_("_Underline"), | |
674 "/gaim/gtk/conversations/send_underline", vbox); | |
675 gaim_gtk_prefs_checkbox(_("_Strikethrough"), | |
676 "/gaim/gtk/conversations/send_strikethrough", vbox); | |
5440 | 677 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
678 vbox = gaim_gtk_make_frame(ret, _("Face")); |
5440 | 679 hbox = gtk_hbox_new(FALSE, 6); |
680 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
7987 | 681 button = gaim_gtk_prefs_checkbox(_("Use custo_m face"), |
682 "/gaim/gtk/conversations/use_custom_font", hbox); | |
5440 | 683 gtk_size_group_add_widget(sg, button); |
684 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); | |
685 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
686 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) |
5440 | 687 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
688 |
5440 | 689 g_signal_connect(G_OBJECT(button), "clicked", |
690 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
691 g_signal_connect(G_OBJECT(select), "clicked", | |
692 G_CALLBACK(show_font_dialog), NULL); | |
693 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
694 | |
695 hbox = gtk_hbox_new(FALSE, 5); | |
696 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
697 |
7987 | 698 button = gaim_gtk_prefs_checkbox(_("Use custom si_ze"), |
699 "/gaim/gtk/conversations/use_custom_size", hbox); | |
5440 | 700 gtk_size_group_add_widget(sg, button); |
7987 | 701 select = gaim_gtk_prefs_labeled_spin_button(hbox, NULL, |
702 "/gaim/gtk/conversations/font_size", 1, 7, NULL); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
703 |
6384
6e5dbdaf33f2
[gaim-migrate @ 6889]
Christian Hammond <chipx86@chipx86.com>
parents:
6371
diff
changeset
|
704 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) |
5440 | 705 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
706 |
5440 | 707 g_signal_connect(G_OBJECT(button), "clicked", |
708 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
709 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
710 vbox = gaim_gtk_make_frame(ret, _("Color")); |
5440 | 711 hbox = gtk_hbox_new(FALSE, 5); |
712 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
713 | |
7987 | 714 button = gaim_gtk_prefs_checkbox(_("_Text color"), |
715 "/gaim/gtk/conversations/use_custom_fgcolor", hbox); | |
5440 | 716 gtk_size_group_add_widget(sg, button); |
717 | |
718 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
719 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
720 pref_fg_picture = show_color_pref(hbox, TRUE); | |
721 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_color), | |
722 pref_fg_picture); | |
723 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
724 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) |
5440 | 725 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
726 |
5440 | 727 g_signal_connect(G_OBJECT(button), "clicked", |
728 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
729 g_signal_connect(G_OBJECT(select), "clicked", G_CALLBACK(show_fgcolor_dialog), NULL); | |
730 hbox = gtk_hbox_new(FALSE, 5); | |
731 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
732 | |
7987 | 733 button = gaim_gtk_prefs_checkbox(_("Bac_kground color"), |
734 "/gaim/gtk/conversations/use_custom_bgcolor", hbox); | |
5440 | 735 gtk_size_group_add_widget(sg, button); |
736 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); | |
737 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); | |
738 pref_bg_picture = show_color_pref(hbox, FALSE); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
739 g_signal_connect(G_OBJECT(button), "clicked", |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
740 G_CALLBACK(update_color), pref_bg_picture); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
741 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
742 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) |
5440 | 743 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
744 |
5440 | 745 g_signal_connect(G_OBJECT(select), "clicked", |
746 G_CALLBACK(show_bgcolor_dialog), NULL); | |
747 g_signal_connect(G_OBJECT(button), "clicked", | |
748 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
749 | |
750 gtk_widget_show_all(ret); | |
751 return ret; | |
752 } | |
753 | |
754 | |
755 GtkWidget *messages_page() { | |
756 GtkWidget *ret; | |
757 GtkWidget *vbox; | |
758 ret = gtk_vbox_new(FALSE, 18); | |
759 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
760 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
761 vbox = gaim_gtk_make_frame (ret, _("Display")); |
7987 | 762 gaim_gtk_prefs_checkbox(_("Show graphical _smileys"), |
763 "/gaim/gtk/conversations/show_smileys", vbox); | |
764 gaim_gtk_prefs_checkbox(_("Show _timestamp on messages"), | |
765 "/gaim/gtk/conversations/show_timestamps", vbox); | |
766 gaim_gtk_prefs_checkbox(_("Show _URLs as links"), | |
767 "/gaim/gtk/conversations/show_urls_as_links", vbox); | |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
768 |
5440 | 769 #ifdef USE_GTKSPELL |
7987 | 770 gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"), |
771 "/gaim/gtk/conversations/spellcheck", vbox); | |
5440 | 772 #endif |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
773 vbox = gaim_gtk_make_frame (ret, _("Ignore")); |
7987 | 774 gaim_gtk_prefs_checkbox(_("Ignore c_olors"), |
775 "/gaim/gtk/conversations/ignore_colors", vbox); | |
776 gaim_gtk_prefs_checkbox(_("Ignore font _faces"), | |
777 "/gaim/gtk/conversations/ignore_fonts", vbox); | |
778 gaim_gtk_prefs_checkbox(_("Ignore font si_zes"), | |
779 "/gaim/gtk/conversations/ignore_font_sizes", vbox); | |
5440 | 780 |
781 gtk_widget_show_all(ret); | |
782 return ret; | |
783 } | |
784 | |
785 GtkWidget *hotkeys_page() { | |
786 GtkWidget *ret; | |
787 GtkWidget *vbox; | |
788 ret = gtk_vbox_new(FALSE, 18); | |
789 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
790 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
791 vbox = gaim_gtk_make_frame(ret, _("Send Message")); |
7987 | 792 gaim_gtk_prefs_checkbox(_("Enter _sends message"), |
793 "/gaim/gtk/conversations/enter_sends", vbox); | |
794 gaim_gtk_prefs_checkbox(_("C_ontrol-Enter sends message"), | |
795 "/gaim/gtk/conversations/ctrl_enter_sends", vbox); | |
5440 | 796 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
797 vbox = gaim_gtk_make_frame (ret, _("Window Closing")); |
7987 | 798 gaim_gtk_prefs_checkbox(_("_Escape closes window"), |
799 "/gaim/gtk/conversations/escape_closes", vbox); | |
5440 | 800 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
801 vbox = gaim_gtk_make_frame(ret, _("Insertions")); |
7987 | 802 gaim_gtk_prefs_checkbox(_("Control-{B/I/U} inserts _HTML tags"), |
803 "/gaim/gtk/conversations/html_shortcuts", vbox); | |
804 gaim_gtk_prefs_checkbox(_("Control-(number) _inserts smileys"), | |
805 "/gaim/gtk/conversations/smiley_shortcuts", vbox); | |
5440 | 806 |
807 gtk_widget_show_all(ret); | |
808 return ret; | |
809 } | |
810 | |
811 GtkWidget *list_page() { | |
812 GtkWidget *ret; | |
813 GtkWidget *vbox; | |
814 GList *l= NULL; | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
815 GSList *sl; |
5440 | 816 ret = gtk_vbox_new(FALSE, 18); |
817 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
7305 | 818 |
819 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
820 vbox = gaim_gtk_make_frame (ret, _("Buddy List Sorting")); |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
821 |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
822 for (sl = gaim_gtk_blist_sort_methods; sl != NULL; sl = sl->next) { |
5631 | 823 struct gaim_gtk_blist_sort_method *method = sl->data; |
824 | |
825 l = g_list_append(l, method->name); | |
826 l = g_list_append(l, method->id); | |
5440 | 827 } |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
828 |
8063 | 829 gaim_gtk_prefs_dropdown_from_list(vbox, _("_Sorting:"), GAIM_PREF_STRING, |
7987 | 830 "/gaim/gtk/blist/sort_type", l); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
831 |
5440 | 832 g_list_free(l); |
833 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
834 vbox = gaim_gtk_make_frame (ret, _("Buddy List Toolbar")); |
7987 | 835 gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, |
836 "/gaim/gtk/blist/button_style", | |
837 _("Pictures"), GAIM_BUTTON_IMAGE, | |
838 _("Text"), GAIM_BUTTON_TEXT, | |
839 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
840 _("None"), GAIM_BUTTON_NONE, | |
841 NULL); | |
5440 | 842 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
843 vbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); |
7987 | 844 gaim_gtk_prefs_checkbox(_("_Raise window on events"), |
845 "/gaim/gtk/blist/raise_on_events", vbox); | |
5440 | 846 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
847 vbox = gaim_gtk_make_frame (ret, _("Group Display")); |
7987 | 848 gaim_gtk_prefs_checkbox(_("Show _numbers in groups"), |
849 "/gaim/gtk/blist/show_group_count", vbox); | |
5440 | 850 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
851 vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); |
7987 | 852 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
7305 | 853 "/gaim/gtk/blist/show_buddy_icons", vbox); |
7987 | 854 gaim_gtk_prefs_checkbox(_("Show _warning levels"), |
7305 | 855 "/gaim/gtk/blist/show_warning_level", vbox); |
7987 | 856 gaim_gtk_prefs_checkbox(_("Show idle _times"), |
7305 | 857 "/gaim/gtk/blist/show_idle_time", vbox); |
7987 | 858 gaim_gtk_prefs_checkbox(_("Dim i_dle buddies"), |
7305 | 859 "/gaim/gtk/blist/grey_idle_buddies", vbox); |
7987 | 860 gaim_gtk_prefs_checkbox(_("_Automatically expand contacts"), |
7731 | 861 "/gaim/gtk/blist/auto_expand_contacts", vbox); |
5440 | 862 |
863 gtk_widget_show_all(ret); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
864 |
5440 | 865 return ret; |
866 } | |
867 | |
868 GtkWidget *conv_page() { | |
869 GtkWidget *ret; | |
870 GtkWidget *vbox; | |
871 GtkWidget *label; | |
7128 | 872 GtkWidget *close_checkbox, *icons_checkbox; |
873 GtkWidget *tabs_checkbox, *same_checkbox; | |
5440 | 874 GtkSizeGroup *sg; |
875 GList *names = NULL; | |
876 | |
877 ret = gtk_vbox_new(FALSE, 18); | |
878 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
879 | |
880 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
881 vbox = gaim_gtk_make_frame(ret, _("Conversations")); |
5440 | 882 |
5858 | 883 names = gaim_conv_placement_get_options(); |
5440 | 884 |
7987 | 885 label = gaim_gtk_prefs_dropdown_from_list(vbox, _("_Placement:"), |
7561
cdfdbabd3266
[gaim-migrate @ 8175]
Christian Hammond <chipx86@chipx86.com>
parents:
7553
diff
changeset
|
886 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
5440 | 887 g_list_free(names); |
888 | |
889 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
890 gtk_size_group_add_widget(sg, label); | |
891 | |
7987 | 892 gaim_gtk_prefs_checkbox(_("Send _URLs as Links"), |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
893 "/core/conversations/send_urls_as_links", vbox); |
5440 | 894 |
8063 | 895 gaim_gtk_prefs_checkbox(_("Show _Formatting Toolbar"), |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7305
diff
changeset
|
896 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); |
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7305
diff
changeset
|
897 |
8015 | 898 gaim_gtk_prefs_checkbox(_("Show a_liases in tabs/titles"), |
899 "/core/conversations/use_alias_for_title", vbox); | |
900 | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
901 vbox = gaim_gtk_make_frame (ret, _("Tab Options")); |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
902 |
7987 | 903 label = gaim_gtk_prefs_dropdown(vbox, _("_Tab Placement:"), GAIM_PREF_INT, |
904 "/gaim/gtk/conversations/tab_side", | |
905 _("Top"), GTK_POS_TOP, | |
906 _("Bottom"), GTK_POS_BOTTOM, | |
907 _("Left"), GTK_POS_LEFT, | |
908 _("Right"), GTK_POS_RIGHT, | |
909 NULL); | |
5667 | 910 |
911 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
912 gtk_size_group_add_widget(sg, label); | |
913 | |
7987 | 914 tabs_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _tabbed windows"), |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
915 "/gaim/gtk/conversations/tabs", vbox); |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
916 |
7987 | 917 same_checkbox = gaim_gtk_prefs_checkbox(_("Show IMs and chats in _same tabbed window"), |
6799 | 918 "/core/conversations/combine_chat_im", vbox); |
919 | |
7128 | 920 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { |
921 gtk_widget_set_sensitive(GTK_WIDGET(same_checkbox), FALSE); | |
922 } | |
923 | |
924 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", | |
925 G_CALLBACK(gaim_gtk_toggle_sensitive), same_checkbox); | |
926 | |
7987 | 927 close_checkbox = gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
928 "/gaim/gtk/conversations/close_on_tabs", |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
929 vbox); |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
930 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
931 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
932 gtk_widget_set_sensitive(GTK_WIDGET(close_checkbox), FALSE); |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
933 } |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
934 |
7128 | 935 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
936 G_CALLBACK(gaim_gtk_toggle_sensitive), close_checkbox); |
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
937 |
7987 | 938 icons_checkbox = gaim_gtk_prefs_checkbox(_("Show status _icons on tabs"), |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
939 "/gaim/gtk/conversations/icons_on_tabs", |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
940 vbox); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
941 |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
942 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
943 gtk_widget_set_sensitive(GTK_WIDGET(icons_checkbox), FALSE); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
944 } |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
945 |
7128 | 946 g_signal_connect(G_OBJECT(tabs_checkbox), "clicked", |
6392
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
947 G_CALLBACK(gaim_gtk_toggle_sensitive), icons_checkbox); |
e9974608b319
[gaim-migrate @ 6897]
Christian Hammond <chipx86@chipx86.com>
parents:
6384
diff
changeset
|
948 |
5440 | 949 gtk_widget_show_all(ret); |
950 | |
951 return ret; | |
952 } | |
953 | |
954 GtkWidget *im_page() { | |
955 GtkWidget *ret; | |
956 GtkWidget *vbox; | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
957 GtkWidget *widge; |
5440 | 958 GtkSizeGroup *sg; |
959 | |
960 ret = gtk_vbox_new(FALSE, 18); | |
961 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
962 | |
963 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
964 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
965 vbox = gaim_gtk_make_frame (ret, _("Window")); |
7987 | 966 widge = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, |
967 "/gaim/gtk/conversations/im/button_type", | |
968 _("Pictures"), GAIM_BUTTON_IMAGE, | |
969 _("Text"), GAIM_BUTTON_TEXT, | |
970 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
971 NULL); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
972 |
5440 | 973 gtk_size_group_add_widget(sg, widge); |
974 gtk_misc_set_alignment(GTK_MISC(widge), 0, 0); | |
7987 | 975 gaim_gtk_prefs_labeled_spin_button(vbox, _("New window _width:"), |
976 "/gaim/gtk/conversations/im/default_width", 25, 9999, sg); | |
977 gaim_gtk_prefs_labeled_spin_button(vbox, _("New window _height:"), | |
978 "/gaim/gtk/conversations/im/default_height", 25, 9999, sg); | |
979 gaim_gtk_prefs_labeled_spin_button(vbox, _("_Entry field height:"), | |
980 "/gaim/gtk/conversations/im/entry_height", 25, 9999, sg); | |
981 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
982 "/gaim/gtk/conversations/im/raise_on_events", vbox); | |
983 gaim_gtk_prefs_checkbox(_("Hide window on _send"), | |
984 "/gaim/gtk/conversations/im/hide_on_send", vbox); | |
5440 | 985 gtk_widget_show (vbox); |
986 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
987 vbox = gaim_gtk_make_frame (ret, _("Buddy Icons")); |
7987 | 988 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
989 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
990 gaim_gtk_prefs_checkbox(_("Enable buddy icon a_nimation"), | |
991 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); | |
5440 | 992 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
993 vbox = gaim_gtk_make_frame (ret, _("Display")); |
7987 | 994 gaim_gtk_prefs_checkbox(_("Show _logins in window"), |
995 "/core/conversations/im/show_login", vbox); | |
5440 | 996 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
997 vbox = gaim_gtk_make_frame (ret, _("Typing Notification")); |
7987 | 998 gaim_gtk_prefs_checkbox(_("Notify buddies that you are _typing to them"), |
999 "/core/conversations/im/send_typing", vbox); | |
5440 | 1000 |
1001 gtk_widget_show_all(ret); | |
1002 return ret; | |
1003 } | |
1004 | |
1005 GtkWidget *chat_page() { | |
1006 GtkWidget *ret; | |
1007 GtkWidget *vbox; | |
1008 GtkWidget *dd; | |
1009 GtkSizeGroup *sg; | |
1010 | |
1011 ret = gtk_vbox_new(FALSE, 18); | |
1012 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1013 | |
1014 sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); | |
1015 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1016 vbox = gaim_gtk_make_frame (ret, _("Window")); |
7987 | 1017 dd = gaim_gtk_prefs_dropdown(vbox, _("Show _buttons as:"), GAIM_PREF_INT, |
1018 "/gaim/gtk/conversations/chat/button_type", | |
1019 _("Pictures"), GAIM_BUTTON_IMAGE, | |
1020 _("Text"), GAIM_BUTTON_TEXT, | |
1021 _("Pictures and text"), GAIM_BUTTON_TEXT_IMAGE, | |
1022 NULL); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
1023 |
5440 | 1024 gtk_size_group_add_widget(sg, dd); |
1025 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
7987 | 1026 gaim_gtk_prefs_labeled_spin_button(vbox, _("New window _width:"), |
1027 "/gaim/gtk/conversations/chat/default_width", 25, 9999, sg); | |
1028 gaim_gtk_prefs_labeled_spin_button(vbox, _("New window _height:"), | |
1029 "/gaim/gtk/conversations/chat/default_height", 25, 9999, sg); | |
1030 gaim_gtk_prefs_labeled_spin_button(vbox, _("_Entry field height:"), | |
1031 "/gaim/gtk/conversations/chat/entry_height", 25, 9999, sg); | |
1032 gaim_gtk_prefs_checkbox(_("_Raise window on events"), | |
1033 "/gaim/gtk/conversations/chat/raise_on_events", vbox); | |
5440 | 1034 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1035 vbox = gaim_gtk_make_frame (ret, _("Tab Completion")); |
7987 | 1036 gaim_gtk_prefs_checkbox(_("_Tab-complete nicks"), |
1037 "/gaim/gtk/conversations/chat/tab_completion", vbox); | |
1038 gaim_gtk_prefs_checkbox(_("_Old-style tab completion"), | |
1039 "/gaim/gtk/conversations/chat/old_tab_complete", vbox); | |
5440 | 1040 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1041 vbox = gaim_gtk_make_frame (ret, _("Display")); |
7987 | 1042 gaim_gtk_prefs_checkbox(_("_Show people joining in window"), |
1043 "/core/conversations/chat/show_join", vbox); | |
1044 gaim_gtk_prefs_checkbox(_("_Show people leaving in window"), | |
1045 "/core/conversations/chat/show_leave", vbox); | |
8152 | 1046 gaim_gtk_prefs_checkbox(_("Co_lorize screen names"), |
7987 | 1047 "/gaim/gtk/conversations/chat/color_nicks", vbox); |
5440 | 1048 |
1049 gtk_widget_show_all(ret); | |
1050 return ret; | |
1051 } | |
1052 | |
6001 | 1053 static void |
1054 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
7987 | 1055 gpointer data) |
6001 | 1056 { |
1057 GtkWidget *frame = data; | |
1058 const char *proxy = value; | |
1059 | |
6621 | 1060 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) |
1061 gtk_widget_set_sensitive(frame, TRUE); | |
1062 else | |
1063 gtk_widget_set_sensitive(frame, FALSE); | |
6001 | 1064 } |
1065 | |
6006 | 1066 static void proxy_print_option(GtkEntry *entry, int entrynum) |
1067 { | |
1068 if (entrynum == PROXYHOST) | |
1069 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
1070 else if (entrynum == PROXYPORT) | |
1071 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
1072 else if (entrynum == PROXYUSER) | |
1073 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
1074 else if (entrynum == PROXYPASS) | |
1075 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
1076 } | |
1077 | |
5440 | 1078 GtkWidget *proxy_page() { |
1079 GtkWidget *ret; | |
1080 GtkWidget *vbox; | |
1081 GtkWidget *entry; | |
1082 GtkWidget *label; | |
1083 GtkWidget *hbox; | |
1084 GtkWidget *table; | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1085 GaimProxyInfo *proxy_info; |
5440 | 1086 |
1087 ret = gtk_vbox_new(FALSE, 18); | |
1088 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1089 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1090 vbox = gaim_gtk_make_frame (ret, _("Proxy Type")); |
7987 | 1091 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
1092 "/core/proxy/type", | |
1093 _("No proxy"), "none", | |
1094 "SOCKS 4", "socks4", | |
1095 "SOCKS 5", "socks5", | |
1096 "HTTP", "http", | |
1097 _("Use Environmental Settings"), "envvar", | |
1098 NULL); | |
5440 | 1099 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1100 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
5440 | 1101 prefs_proxy_frame = vbox; |
1102 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1103 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1104 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1105 if (proxy_info == NULL || |
6621 | 1106 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1107 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_USE_ENVVAR) { | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1108 |
6001 | 1109 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1110 } |
6001 | 1111 proxy_pref_id = gaim_prefs_connect_callback("/core/proxy/type", |
1112 proxy_changed_cb, prefs_proxy_frame); | |
1113 | |
5440 | 1114 table = gtk_table_new(2, 4, FALSE); |
1115 gtk_container_set_border_width(GTK_CONTAINER(table), 5); | |
1116 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1117 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
1118 gtk_container_add(GTK_CONTAINER(vbox), table); | |
1119 | |
1120 | |
7797 | 1121 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1122 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1123 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1124 | |
1125 entry = gtk_entry_new(); | |
1126 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1127 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1128 g_signal_connect(G_OBJECT(entry), "changed", | |
1129 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1130 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1131 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1132 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1133 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1134 |
1135 hbox = gtk_hbox_new(TRUE, 5); | |
1136 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1137 gaim_set_accessible_label (entry, label); |
5440 | 1138 |
7870 | 1139 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1140 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1141 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); | |
1142 | |
1143 entry = gtk_entry_new(); | |
1144 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1145 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); | |
1146 g_signal_connect(G_OBJECT(entry), "changed", | |
1147 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1148 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1149 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1150 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1151 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1152 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1153 |
5440 | 1154 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1155 } | |
8137 | 1156 gaim_set_accessible_label (entry, label); |
5440 | 1157 |
7797 | 1158 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1159 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1160 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); | |
1161 | |
1162 entry = gtk_entry_new(); | |
1163 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1164 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); | |
1165 g_signal_connect(G_OBJECT(entry), "changed", | |
1166 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1167 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1168 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1169 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1170 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1171 |
1172 hbox = gtk_hbox_new(TRUE, 5); | |
1173 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1174 gaim_set_accessible_label (entry, label); |
5440 | 1175 |
7797 | 1176 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1177 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1178 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); | |
1179 | |
1180 entry = gtk_entry_new(); | |
1181 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1182 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); | |
1183 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
1184 g_signal_connect(G_OBJECT(entry), "changed", | |
1185 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1186 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1187 if (proxy_info != NULL && gaim_proxy_info_get_password(proxy_info) != NULL) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1188 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1189 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1190 gaim_set_accessible_label (entry, label); |
5440 | 1191 |
1192 gtk_widget_show_all(ret); | |
1193 return ret; | |
1194 } | |
1195 | |
1196 #ifndef _WIN32 | |
1197 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1198 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1199 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1200 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1201 |
1202 /* carry on normally */ | |
1203 return FALSE; | |
1204 } | |
1205 | |
5633 | 1206 static GList *get_available_browsers() |
5440 | 1207 { |
1208 struct browser { | |
1209 char *name; | |
1210 char *command; | |
1211 }; | |
1212 | |
1213 static struct browser possible_browsers[] = { | |
5633 | 1214 {N_("Opera"), "opera"}, |
1215 {N_("Netscape"), "netscape"}, | |
1216 {N_("Mozilla"), "mozilla"}, | |
6070 | 1217 {N_("Konqueror"), "kfmclient"}, |
7916 | 1218 {N_("Galeon"), "galeon"}, |
1219 {N_("Firebird"), "mozilla-firebird"} | |
5440 | 1220 }; |
7916 | 1221 static const int num_possible_browsers = 6; |
5440 | 1222 |
1223 GList *browsers = NULL; | |
1224 int i = 0; | |
5819 | 1225 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1226 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1227 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1228 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1229 |
5440 | 1230 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1231 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1232 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1233 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1234 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1235 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1236 browser_setting = NULL; |
5440 | 1237 } |
1238 } | |
1239 | |
5819 | 1240 if(browser_setting) |
1241 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1242 | |
5440 | 1243 return browsers; |
1244 } | |
1245 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1246 static void |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1247 browser_changed_cb(const char *name, GaimPrefType type, gpointer value, |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1248 gpointer data) |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1249 { |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1250 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1251 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1252 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1253 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1254 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1255 |
5440 | 1256 GtkWidget *browser_page() { |
1257 GtkWidget *ret; | |
1258 GtkWidget *vbox; | |
1259 GtkWidget *hbox; | |
1260 GtkWidget *label; | |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1261 GtkWidget *checkbox; |
6007 | 1262 GtkWidget *entry; |
5440 | 1263 GtkSizeGroup *sg; |
1264 GList *browsers = NULL; | |
1265 | |
1266 ret = gtk_vbox_new(FALSE, 18); | |
1267 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1268 | |
1269 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1270 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1271 |
1272 browsers = get_available_browsers(); | |
1273 if (browsers != NULL) { | |
7987 | 1274 label = gaim_gtk_prefs_dropdown_from_list(vbox,_("_Browser:"), GAIM_PREF_STRING, |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1275 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1276 browsers); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1277 |
5440 | 1278 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1279 gtk_size_group_add_widget(sg, label); | |
1280 } | |
1281 | |
1282 hbox = gtk_hbox_new(FALSE, 5); | |
1283 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1284 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1285 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1286 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1287 gtk_size_group_add_widget(sg, label); | |
1288 | |
6007 | 1289 entry = gtk_entry_new(); |
1290 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1291 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1292 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1293 gtk_widget_set_sensitive(hbox, FALSE); |
6005 | 1294 browser_pref_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser", |
1295 browser_changed_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1296 |
6007 | 1297 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1298 | |
1299 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1300 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1301 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1302 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1303 gaim_set_accessible_label (entry, label); |
5440 | 1304 |
1305 if (browsers != NULL) { | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1306 vbox = gaim_gtk_make_frame (ret, _("Browser Options")); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1307 checkbox = gaim_gtk_prefs_checkbox(_("Open new _window by default"), |
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1308 "/gaim/gtk/browsers/new_window", |
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1309 vbox); |
5440 | 1310 } |
1311 | |
1312 gtk_widget_show_all(ret); | |
1313 return ret; | |
1314 } | |
1315 #endif /*_WIN32*/ | |
1316 | |
1317 GtkWidget *logging_page() { | |
1318 GtkWidget *ret; | |
1319 GtkWidget *vbox; | |
7431 | 1320 GList *names; |
5440 | 1321 ret = gtk_vbox_new(FALSE, 18); |
1322 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1323 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1324 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1325 names = gaim_log_logger_get_options(); |
1326 | |
7987 | 1327 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1328 "/core/logging/format", names); | |
1329 | |
1330 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1331 "/core/logging/log_ims", vbox); |
7987 | 1332 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1333 "/core/logging/log_chats", vbox); |
7553 | 1334 /* |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1335 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
7987 | 1336 gaim_gtk_prefs_checkbox(_("Log when buddies _sign on/sign off"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1337 "/gaim/gtk/logging/log_signon_signoff", vbox); |
7987 | 1338 gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1339 "/gaim/gtk/logging/log_idle_state", vbox); |
7987 | 1340 gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1341 "/gaim/gtk/logging/log_away_state", vbox); |
7987 | 1342 gaim_gtk_prefs_checkbox(_("Log your _own signons/idleness/awayness"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1343 "/gaim/gtk/logging/log_own_states", vbox); |
7987 | 1344 gaim_gtk_prefs_checkbox(_("I_ndividual log file for each buddy's signons"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1345 "/gaim/gtk/logging/individual_logs", vbox); |
7553 | 1346 */ |
5440 | 1347 gtk_widget_show_all(ret); |
1348 return ret; | |
1349 } | |
1350 | |
1351 #ifndef _WIN32 | |
1352 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1353 { | |
5684 | 1354 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1355 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1356 return TRUE; |
1357 } | |
6005 | 1358 |
1359 static void | |
1360 sound_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
1361 gpointer data) | |
1362 { | |
1363 GtkWidget *hbox = data; | |
1364 const char *method = value; | |
1365 | |
1366 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1367 } | |
5440 | 1368 #endif |
1369 | |
1370 GtkWidget *sound_page() { | |
1371 GtkWidget *ret; | |
1372 GtkWidget *vbox; | |
1373 GtkSizeGroup *sg; | |
1374 #ifndef _WIN32 | |
1375 GtkWidget *dd; | |
1376 GtkWidget *hbox; | |
1377 GtkWidget *label; | |
6007 | 1378 GtkWidget *entry; |
5684 | 1379 const char *cmd; |
5440 | 1380 #endif |
1381 | |
1382 ret = gtk_vbox_new(FALSE, 18); | |
1383 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1384 | |
1385 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1386 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1387 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
7987 | 1388 gaim_gtk_prefs_checkbox(_("_No sounds when you log in"), |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1389 "/gaim/gtk/sound/silent_signon", vbox); |
7987 | 1390 gaim_gtk_prefs_checkbox(_("_Sounds while away"), |
5684 | 1391 "/core/sound/while_away", vbox); |
5440 | 1392 |
1393 #ifndef _WIN32 | |
6033 | 1394 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1395 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1396 "/gaim/gtk/sound/method", | |
1397 _("Console beep"), "beep", | |
5440 | 1398 #ifdef USE_AO |
7987 | 1399 _("Automatic"), "automatic", |
1400 "ESD", "esd", | |
1401 "Arts", "arts", | |
5440 | 1402 #endif |
1403 #ifdef USE_NAS_AUDIO | |
7987 | 1404 "NAS", "nas", |
5440 | 1405 #endif |
7987 | 1406 _("Command"), "custom", |
1407 NULL); | |
5440 | 1408 gtk_size_group_add_widget(sg, dd); |
1409 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1410 | |
1411 hbox = gtk_hbox_new(FALSE, 5); | |
1412 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1413 | |
1414 hbox = gtk_hbox_new(FALSE, 5); | |
1415 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
6031 | 1416 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1417 gtk_size_group_add_widget(sg, label); |
1418 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1419 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1420 | |
6007 | 1421 entry = gtk_entry_new(); |
1422 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1423 | |
1424 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1425 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1426 if(cmd) |
6007 | 1427 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1428 gtk_widget_set_size_request(entry, 75, -1); | |
1429 | |
1430 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1431 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1432 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1433 |
1434 gtk_widget_set_sensitive(hbox, | |
1435 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1436 "custom")); | |
1437 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", | |
1438 sound_changed_cb, hbox); | |
1439 | |
8141 | 1440 gaim_set_accessible_label (entry, label); |
5440 | 1441 #endif /* _WIN32 */ |
1442 gtk_widget_show_all(ret); | |
8137 | 1443 |
5440 | 1444 return ret; |
1445 } | |
1446 | |
6146
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1447 static void |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1448 auto_resp_changed_cb(const char *name, GaimPrefType type, gpointer value, |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1449 gpointer data) |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1450 { |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1451 GtkWidget *hbox = data; |
6196 | 1452 gboolean enabled = GPOINTER_TO_INT(value); |
6146
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1453 |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1454 gtk_widget_set_sensitive(hbox, enabled); |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1455 } |
aef34b0c175f
[gaim-migrate @ 6620]
Christian Hammond <chipx86@chipx86.com>
parents:
6142
diff
changeset
|
1456 |
5440 | 1457 GtkWidget *away_page() { |
1458 GtkWidget *ret; | |
1459 GtkWidget *vbox; | |
1460 GtkWidget *hbox; | |
1461 GtkWidget *label; | |
1462 GtkWidget *button; | |
1463 GtkWidget *select; | |
1464 GtkWidget *dd; | |
1465 GtkSizeGroup *sg; | |
1466 | |
1467 ret = gtk_vbox_new(FALSE, 18); | |
1468 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1469 | |
1470 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1471 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1472 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1473 gaim_gtk_prefs_checkbox(_("_Sending messages removes away status"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1474 "/core/conversations/away_back_on_send", vbox); |
7987 | 1475 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1476 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1477 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1478 vbox = gaim_gtk_make_frame (ret, _("Auto-response")); |
5440 | 1479 hbox = gtk_hbox_new(FALSE, 0); |
1480 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
7987 | 1481 gaim_gtk_prefs_labeled_spin_button(hbox, _("Seconds before _resending:"), |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1482 "/core/away/auto_response/sec_before_resend", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1483 1, 24 * 60 * 60, sg); |
7987 | 1484 gaim_gtk_prefs_checkbox(_("_Send auto-response"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1485 "/core/away/auto_response/enabled", vbox); |
7987 | 1486 gaim_gtk_prefs_checkbox(_("_Only send auto-response when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1487 "/core/away/auto_response/idle_only", vbox); |
7987 | 1488 gaim_gtk_prefs_checkbox(_("Send auto-response in _active conversations"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1489 "/core/away/auto_response/in_active_conv", vbox); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1490 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1491 if (!gaim_prefs_get_bool("/core/away/auto_response/enabled")) |
5440 | 1492 gtk_widget_set_sensitive(hbox, FALSE); |
1493 | |
6142 | 1494 auto_resp_pref_id = gaim_prefs_connect_callback("/core/away/auto_response/enabled", |
1495 auto_resp_changed_cb, hbox); | |
1496 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1497 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1498 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1499 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1500 _("None"), "none", | |
1501 _("Gaim usage"), "gaim", | |
5440 | 1502 #ifdef USE_SCREENSAVER |
1503 #ifndef _WIN32 | |
7987 | 1504 _("X usage"), "system", |
5440 | 1505 #else |
7987 | 1506 _("Windows usage"), "system", |
5440 | 1507 #endif |
1508 #endif | |
7987 | 1509 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1510 |
5440 | 1511 gtk_size_group_add_widget(sg, dd); |
1512 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1513 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1514 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1515 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1516 "/core/away/away_when_idle", vbox); |
7987 | 1517 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1518 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1519 1, 24 * 60, sg); | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1520 |
5440 | 1521 g_signal_connect(G_OBJECT(button), "clicked", |
1522 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1523 | |
1524 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); | |
1525 gtk_size_group_add_widget(sg, label); | |
1526 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1527 hbox = gtk_hbox_new(FALSE, 0); | |
1528 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1529 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1530 prefs_away_menu = gtk_option_menu_new(); | |
1531 gtk_label_set_mnemonic_widget(GTK_LABEL(label), prefs_away_menu); | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1532 |
5440 | 1533 g_signal_connect(G_OBJECT(button), "clicked", |
1534 G_CALLBACK(gaim_gtk_toggle_sensitive), prefs_away_menu); | |
1535 default_away_menu_init(prefs_away_menu); | |
1536 gtk_widget_show(prefs_away_menu); | |
1537 gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); | |
1538 | |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1539 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1540 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1541 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1542 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1543 |
8137 | 1544 gaim_set_accessible_label (prefs_away_menu, label); |
1545 | |
5440 | 1546 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1547 |
5440 | 1548 return ret; |
1549 } | |
1550 | |
8170 | 1551 static GtkWidget * |
1552 protocol_page() { | |
1553 GtkWidget *ret; | |
1554 | |
1555 ret = gtk_label_new(NULL); | |
1556 gtk_widget_show(ret); | |
1557 | |
1558 return ret; | |
1559 } | |
1560 | |
1561 static gboolean | |
1562 protocol_pref_entry_cb(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1563 char *pref = data; | |
1564 | |
1565 gaim_prefs_set_string(pref, gtk_entry_get_text(GTK_ENTRY(entry))); | |
1566 | |
1567 return FALSE; | |
1568 } | |
1569 | |
1570 static GtkWidget * | |
1571 protocol_pref_page(GaimPluginProtocolInfo *prpl_info) { | |
1572 GtkWidget *ret, *parent, *frame, *hbox, *label, *misc; | |
1573 GtkSizeGroup *sg; | |
1574 GList *pp = NULL; | |
1575 | |
1576 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1577 | |
1578 ret = gtk_vbox_new(FALSE, 18); | |
1579 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1580 gtk_widget_show(ret); | |
1581 | |
1582 parent = ret; | |
1583 | |
1584 for(pp = prpl_info->protocol_prefs; pp != NULL; pp = pp->next) { | |
1585 struct proto_pref *pref = pp->data; | |
1586 | |
1587 if(pref->key != NULL) { | |
1588 switch(gaim_prefs_get_type(pref->key)) { | |
1589 case GAIM_PREF_BOOLEAN: | |
1590 misc = gaim_gtk_prefs_checkbox(pref->label, | |
1591 pref->key, | |
1592 parent); | |
1593 break; | |
1594 case GAIM_PREF_INT: | |
1595 misc = gaim_gtk_prefs_labeled_spin_button(parent, | |
1596 pref->label, | |
1597 pref->key, | |
1598 pref->min, | |
1599 pref->max, | |
1600 sg); | |
1601 break; | |
1602 case GAIM_PREF_STRING: | |
1603 hbox = gtk_hbox_new(FALSE, 6); | |
1604 gtk_widget_show(hbox); | |
1605 gtk_box_pack_start(GTK_BOX(parent), hbox, FALSE, FALSE, 0); | |
1606 | |
1607 label = gtk_label_new_with_mnemonic(pref->label); | |
1608 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1609 gtk_size_group_add_widget(sg, label); | |
1610 gtk_widget_show(label); | |
1611 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
1612 | |
1613 misc = gtk_entry_new(); | |
1614 gtk_entry_set_text(GTK_ENTRY(misc), | |
1615 gaim_prefs_get_string(pref->key)); | |
1616 g_signal_connect(G_OBJECT(misc), "focus-out-event", | |
1617 G_CALLBACK(protocol_pref_entry_cb), | |
1618 (gpointer)pref->key); | |
1619 gtk_label_set_mnemonic_widget(GTK_LABEL(label), misc); | |
1620 gtk_widget_show(misc); | |
1621 gtk_box_pack_start(GTK_BOX(hbox), misc, FALSE, FALSE, 0); | |
1622 | |
1623 break; | |
1624 case GAIM_PREF_NONE: /* XXX No use for this, if you want a | |
1625 frame, set key to NULL */ | |
1626 case GAIM_PREF_STRING_LIST: /*XXX No one should need this */ | |
1627 default: | |
1628 break; | |
1629 } | |
1630 } else { | |
1631 frame = gaim_gtk_make_frame(ret, pref->label); | |
1632 gtk_widget_show(frame); | |
1633 | |
1634 parent = frame; | |
1635 } | |
1636 } | |
1637 | |
1638 return ret; | |
1639 } | |
1640 | |
5440 | 1641 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; |
1642 | |
1643 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1644 { | |
1645 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1646 GtkTreeIter iter; | |
1647 GValue val = { 0, }; | |
1648 GaimPlugin *plug; | |
1649 | |
1650 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1651 return; | |
8104 | 1652 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1653 plug = g_value_get_pointer(&val); |
1654 | |
1655 pname = g_markup_escape_text(_(plug->info->name), -1); | |
1656 pdesc = g_markup_escape_text(_(plug->info->description), -1); | |
1657 pauth = g_markup_escape_text(_(plug->info->author), -1); | |
1658 pweb = g_markup_escape_text(_(plug->info->homepage), -1); | |
1659 if (plug->error != NULL) { | |
1660 perr = g_markup_escape_text(_(plug->error), -1); | |
1661 buf = g_strdup_printf( | |
1662 "<span size=\"larger\">%s %s</span>\n\n" | |
1663 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1664 "%s", | |
1665 pname, plug->info->version, perr, pdesc); | |
1666 g_free(perr); | |
1667 } | |
1668 else { | |
1669 buf = g_strdup_printf( | |
1670 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1671 pname, plug->info->version, pdesc); | |
1672 } | |
1673 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1674 g_free(buf); | |
1675 | |
1676 buf = g_strdup_printf( | |
1677 #ifndef _WIN32 | |
1678 _("<span size=\"larger\">%s %s</span>\n\n" | |
1679 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1680 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1681 "<span weight=\"bold\">File name:</span>\t%s"), | |
1682 #else | |
1683 _("<span size=\"larger\">%s %s</span>\n\n" | |
1684 "<span weight=\"bold\">Written by:</span> %s\n" | |
1685 "<span weight=\"bold\">URL:</span> %s\n" | |
1686 "<span weight=\"bold\">File name:</span> %s"), | |
1687 #endif | |
1688 pname, plug->info->version, pauth, pweb, plug->path); | |
1689 | |
1690 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1691 g_value_unset(&val); | |
1692 g_free(buf); | |
1693 g_free(pname); | |
1694 g_free(pdesc); | |
1695 g_free(pauth); | |
1696 g_free(pweb); | |
1697 } | |
1698 | |
1699 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1700 { | |
1701 GtkTreeModel *model = (GtkTreeModel *)data; | |
1702 GtkTreeIter iter; | |
1703 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1704 GaimPlugin *plug; | |
1705 gchar buf[1024]; | |
6040 | 1706 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1707 |
5440 | 1708 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1709 gdk_window_set_cursor(prefs->window, wait); | |
1710 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1711 |
5440 | 1712 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1713 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1714 |
5440 | 1715 if (!gaim_plugin_is_loaded(plug)) { |
1716 gaim_plugin_load(plug); | |
1717 | |
1718 /* | |
1719 * NOTE: This is basically the same check as before | |
1720 * (plug->type == plugin), but now there aren't plugin types. | |
1721 * Not yet, anyway. I want to do a V2 of the plugin API. | |
1722 * The thing is, we should have a flag specifying the UI type, | |
1723 * or just whether it's a general plugin or a UI-specific | |
1724 * plugin. We should only load this if it's UI-specific. | |
1725 * | |
1726 * -- ChipX86 | |
1727 */ | |
1728 if (GAIM_IS_GTK_PLUGIN(plug)) | |
1729 { | |
1730 GtkWidget *config_frame; | |
1731 GaimGtkPluginUiInfo *ui_info; | |
1732 | |
1733 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1734 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1735 | |
1736 if (config_frame != NULL) { | |
1737 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1738 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1739 config_frame, ui_info->iter, | |
1740 &plugin_iter, notebook_page++); | |
1741 | |
1742 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), | |
1743 &plugin_iter) == 1) { | |
1744 | |
1745 /* Expand the tree for the first plugin added */ | |
1746 GtkTreePath *path2; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1747 |
5440 | 1748 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), |
1749 &plugin_iter); | |
1750 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), | |
1751 path2, TRUE); | |
1752 gtk_tree_path_free(path2); | |
1753 } | |
1754 } | |
1755 } | |
1756 } | |
1757 else { | |
1758 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1759 GaimGtkPluginUiInfo *ui_info; | |
1760 | |
1761 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1762 | |
1763 if (ui_info != NULL && ui_info->iter != NULL) { | |
1764 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), ui_info->iter); | |
1765 g_free(ui_info->iter); | |
1766 ui_info->iter = NULL; | |
1767 } | |
1768 } | |
1769 | |
1770 gaim_plugin_unload(plug); | |
1771 } | |
1772 | |
1773 gdk_window_set_cursor(prefs->window, NULL); | |
1774 | |
6040 | 1775 name = g_markup_escape_text(_(plug->info->name), -1); |
1776 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 1777 if (plug->error != NULL) { |
6040 | 1778 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 1779 g_snprintf(buf, sizeof(buf), |
1780 "<span size=\"larger\">%s %s</span>\n\n" | |
1781 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1782 "%s", | |
6040 | 1783 name, plug->info->version, error, description); |
1784 g_free(error); | |
1785 } else { | |
5440 | 1786 g_snprintf(buf, sizeof(buf), |
1787 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 1788 name, plug->info->version, description); |
5440 | 1789 } |
6040 | 1790 g_free(name); |
1791 g_free(description); | |
5440 | 1792 |
1793 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1794 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1795 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1796 |
5440 | 1797 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1798 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1799 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1800 gaim_gtk_plugins_save(); |
5440 | 1801 } |
1802 | |
1803 static void | |
1804 update_plugin_list(void *data) | |
1805 { | |
1806 GtkListStore *ls = GTK_LIST_STORE(data); | |
1807 GtkTreeIter iter; | |
1808 GList *probes; | |
1809 GaimPlugin *plug; | |
1810 | |
1811 gtk_list_store_clear(ls); | |
1812 | |
1813 for (probes = gaim_plugins_get_all(); | |
1814 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1815 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1816 { |
5440 | 1817 plug = probes->data; |
1818 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1819 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
1820 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1821 { |
5440 | 1822 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1823 } |
5440 | 1824 |
1825 gtk_list_store_append (ls, &iter); | |
1826 gtk_list_store_set(ls, &iter, | |
1827 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1828 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 1829 2, _(plug->info->summary), |
8104 | 1830 3, plug, -1); |
5440 | 1831 } |
1832 } | |
1833 | |
1834 static GtkWidget *plugin_page () | |
1835 { | |
1836 GtkWidget *ret; | |
1837 GtkWidget *sw, *vp; | |
1838 GtkWidget *event_view; | |
1839 GtkListStore *ls; | |
1840 GtkCellRenderer *rend, *rendt; | |
1841 GtkTreeViewColumn *col; | |
1842 GtkTreeSelection *sel; | |
1843 GtkTreePath *path; | |
1844 GtkWidget *nb; | |
1845 | |
1846 ret = gtk_vbox_new(FALSE, 18); | |
1847 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1848 | |
1849 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 1850 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 1851 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1852 | |
1853 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
1854 | |
8104 | 1855 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 1856 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
1857 1, GTK_SORT_ASCENDING); | |
5440 | 1858 |
1859 update_plugin_list(ls); | |
1860 | |
1861 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
1862 | |
1863 rend = gtk_cell_renderer_toggle_new(); | |
1864 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1865 | |
1866 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
1867 rend, | |
1868 "active", 0, | |
1869 NULL); | |
1870 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1871 | |
1872 rendt = gtk_cell_renderer_text_new(); | |
1873 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
1874 rendt, | |
1875 "text", 1, | |
1876 NULL); | |
1877 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8104 | 1878 |
1879 rendt = gtk_cell_renderer_text_new(); | |
1880 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
1881 rendt, | |
1882 "text", 2, | |
1883 NULL); | |
1884 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
1885 | |
5440 | 1886 g_object_unref(G_OBJECT(ls)); |
1887 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1888 | |
1889 | |
1890 nb = gtk_notebook_new(); | |
1891 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
1892 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
1893 | |
1894 /* Description */ | |
1895 sw = gtk_scrolled_window_new(NULL, NULL); | |
1896 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1897 plugin_description = gtk_label_new(NULL); | |
1898 | |
1899 vp = gtk_viewport_new(NULL, NULL); | |
1900 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
1901 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1902 | |
1903 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
1904 gtk_container_add(GTK_CONTAINER(sw), vp); | |
1905 | |
1906 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); | |
1907 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); | |
1908 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
1909 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
1910 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
1911 | |
1912 /* Details */ | |
1913 sw = gtk_scrolled_window_new(NULL, NULL); | |
1914 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
1915 plugin_details = gtk_label_new(NULL); | |
1916 | |
1917 vp = gtk_viewport_new(NULL, NULL); | |
1918 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
1919 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
1920 | |
1921 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
1922 gtk_container_add(GTK_CONTAINER(sw), vp); | |
1923 | |
1924 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); | |
1925 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); | |
1926 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
1927 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); | |
1928 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); | |
1929 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
1930 | |
1931 g_signal_connect (G_OBJECT (sel), "changed", | |
1932 G_CALLBACK (prefs_plugin_sel), | |
1933 NULL); | |
1934 g_signal_connect (G_OBJECT(rend), "toggled", | |
1935 G_CALLBACK(plugin_load), ls); | |
1936 | |
1937 path = gtk_tree_path_new_first(); | |
1938 gtk_tree_selection_select_path(sel, path); | |
1939 gtk_tree_path_free(path); | |
1940 | |
1941 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
1942 | |
1943 gtk_widget_show_all(ret); | |
1944 return ret; | |
1945 } | |
1946 | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1947 static void |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1948 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) |
5440 | 1949 { |
1950 GtkTreeModel *model = (GtkTreeModel *)data; | |
1951 GtkTreeIter iter; | |
1952 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1953 const char *pref; |
5440 | 1954 |
1955 gtk_tree_model_get_iter (model, &iter, path); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1956 gtk_tree_model_get (model, &iter, |
5612 | 1957 2, &pref, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1958 -1); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1959 |
5684 | 1960 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1961 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1962 gtk_list_store_set(GTK_LIST_STORE (model), &iter, |
5612 | 1963 0, !gtk_cell_renderer_toggle_get_active(cell), |
1964 -1); | |
5440 | 1965 |
1966 gtk_tree_path_free(path); | |
1967 } | |
1968 | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1969 static void |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1970 test_sound(GtkWidget *button, gpointer i_am_NULL) |
5440 | 1971 { |
5684 | 1972 char *pref; |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1973 gboolean temp_value1, temp_value2; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1974 |
5684 | 1975 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", |
1976 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1977 |
5821 | 1978 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1979 temp_value2 = gaim_prefs_get_bool(pref); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1980 |
5821 | 1981 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1982 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1983 |
5440 | 1984 gaim_sound_play_event(sound_row_sel); |
1985 | |
5821 | 1986 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1987 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); |
5684 | 1988 |
1989 g_free(pref); | |
5440 | 1990 } |
1991 | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1992 static void |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1993 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) |
5440 | 1994 { |
5684 | 1995 char *pref = g_strdup_printf("/gaim/gtk/sound/file/%s", |
1996 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1997 | |
5440 | 1998 /* This just resets a sound file back to default */ |
5684 | 1999 gaim_prefs_set_string(pref, ""); |
2000 g_free(pref); | |
5440 | 2001 |
2002 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
2003 } | |
2004 | |
2005 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
2006 { | |
2007 | |
2008 GtkWidget *dest; | |
2009 | |
2010 if (!GTK_IS_WIDGET(w2)) | |
2011 dest = w; | |
2012 else | |
2013 dest = w2; | |
2014 | |
2015 sounddialog = NULL; | |
2016 | |
2017 gtk_widget_destroy(dest); | |
2018 } | |
2019 | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2020 void do_select_sound(GtkWidget *w, gpointer data) |
5440 | 2021 { |
2022 const char *file; | |
5684 | 2023 char *pref; |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2024 int snd; |
5440 | 2025 |
2026 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2027 snd = GPOINTER_TO_INT(data); |
5440 | 2028 |
2029 /* If they type in a directory, change there */ | |
5966 | 2030 if (gaim_gtk_check_if_dir(file, GTK_FILE_SELECTION(sounddialog))) |
5440 | 2031 return; |
2032 | |
2033 /* Set it -- and forget it */ | |
5684 | 2034 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", |
2035 gaim_gtk_sound_get_event_option(snd)); | |
2036 gaim_prefs_set_string(pref, file); | |
2037 g_free(pref); | |
5440 | 2038 |
2039 /* Set our text entry */ | |
2040 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
2041 | |
2042 /* Close the window! It's getting cold in here! */ | |
2043 close_sounddialog(NULL, sounddialog); | |
2044 | |
2045 if (last_sound_dir) | |
2046 g_free(last_sound_dir); | |
2047 last_sound_dir = g_path_get_dirname(file); | |
2048 } | |
2049 | |
2050 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
2051 { | |
2052 char *buf = g_malloc(BUF_LEN); | |
2053 | |
2054 if (!sounddialog) { | |
2055 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
2056 | |
2057 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
2058 | |
2059 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
2060 | |
2061 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
2062 | |
2063 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
2064 G_CALLBACK(close_sounddialog), sounddialog); | |
2065 | |
2066 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
2067 "clicked", | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2068 G_CALLBACK(do_select_sound), GINT_TO_POINTER(sound_row_sel)); |
5440 | 2069 |
2070 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
2071 "clicked", | |
2072 G_CALLBACK(close_sounddialog), sounddialog); | |
2073 } | |
2074 | |
2075 g_free(buf); | |
2076 gtk_widget_show(sounddialog); | |
2077 gdk_window_raise(sounddialog->window); | |
2078 } | |
2079 | |
2080 | |
2081 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
2082 GtkTreeIter iter; | |
2083 GValue val = { 0, }; | |
5684 | 2084 const char *file; |
2085 char *pref; | |
5440 | 2086 |
2087 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2088 return; | |
5612 | 2089 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 2090 sound_row_sel = g_value_get_uint(&val); |
5684 | 2091 |
2092 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
2093 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
2094 file = gaim_prefs_get_string(pref); | |
2095 g_free(pref); | |
5440 | 2096 if (sound_entry) |
6088 | 2097 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); |
5440 | 2098 g_value_unset (&val); |
2099 if (sounddialog) | |
2100 gtk_widget_destroy(sounddialog); | |
2101 } | |
2102 | |
2103 GtkWidget *sound_events_page() { | |
2104 | |
2105 GtkWidget *ret; | |
2106 GtkWidget *sw; | |
2107 GtkWidget *button, *hbox; | |
2108 GtkTreeIter iter; | |
2109 GtkWidget *event_view; | |
2110 GtkListStore *event_store; | |
2111 GtkCellRenderer *rend; | |
2112 GtkTreeViewColumn *col; | |
2113 GtkTreeSelection *sel; | |
2114 GtkTreePath *path; | |
2115 int j; | |
5684 | 2116 const char *file; |
2117 char *pref; | |
5440 | 2118 |
2119 ret = gtk_vbox_new(FALSE, 18); | |
2120 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2121 | |
2122 sw = gtk_scrolled_window_new(NULL,NULL); | |
2123 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
2124 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
2125 | |
2126 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
5612 | 2127 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); |
5440 | 2128 |
2129 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
5684 | 2130 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", |
2131 gaim_gtk_sound_get_event_option(j)); | |
2132 const char *label = gaim_gtk_sound_get_event_label(j); | |
2133 | |
5870 | 2134 if (label == NULL) { |
2135 g_free(pref); | |
5440 | 2136 continue; |
5870 | 2137 } |
5440 | 2138 |
2139 gtk_list_store_append (event_store, &iter); | |
2140 gtk_list_store_set(event_store, &iter, | |
5612 | 2141 0, gaim_prefs_get_bool(pref), |
5684 | 2142 1, _(label), |
5612 | 2143 2, pref, |
2144 3, j, | |
2145 -1); | |
5684 | 2146 g_free(pref); |
5440 | 2147 } |
2148 | |
2149 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
2150 | |
2151 rend = gtk_cell_renderer_toggle_new(); | |
2152 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2153 g_signal_connect (G_OBJECT (sel), "changed", | |
2154 G_CALLBACK (prefs_sound_sel), | |
2155 NULL); | |
2156 g_signal_connect (G_OBJECT(rend), "toggled", | |
2157 G_CALLBACK(event_toggled), event_store); | |
2158 path = gtk_tree_path_new_first(); | |
2159 gtk_tree_selection_select_path(sel, path); | |
2160 gtk_tree_path_free(path); | |
2161 | |
2162 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
2163 rend, | |
2164 "active", 0, | |
2165 NULL); | |
2166 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2167 | |
2168 rend = gtk_cell_renderer_text_new(); | |
2169 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
2170 rend, | |
2171 "text", 1, | |
2172 NULL); | |
2173 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2174 g_object_unref(G_OBJECT(event_store)); | |
2175 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
2176 | |
2177 hbox = gtk_hbox_new(FALSE, 6); | |
2178 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
2179 sound_entry = gtk_entry_new(); | |
5684 | 2180 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", |
2181 gaim_gtk_sound_get_event_option(0)); | |
2182 file = gaim_prefs_get_string(pref); | |
2183 g_free(pref); | |
6088 | 2184 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); |
5440 | 2185 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); |
2186 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
2187 | |
2188 button = gtk_button_new_with_label(_("Test")); | |
2189 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
2190 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2191 | |
2192 button = gtk_button_new_with_label(_("Reset")); | |
2193 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
2194 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2195 | |
2196 button = gtk_button_new_with_label(_("Choose...")); | |
2197 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
2198 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
2199 | |
2200 gtk_widget_show_all (ret); | |
2201 | |
2202 return ret; | |
2203 } | |
2204 | |
6979 | 2205 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) |
5440 | 2206 { |
2207 GtkTreeIter iter; | |
2208 GValue val = { 0, }; | |
2209 gchar buffer[BUF_LONG]; | |
2210 char *tmp; | |
2211 struct away_message *am; | |
2212 | |
2213 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2214 return; | |
2215 gtk_tree_model_get_value (model, &iter, 1, &val); | |
2216 am = g_value_get_pointer(&val); | |
2217 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
2218 strncpy(buffer, am->message, BUF_LONG); | |
2219 tmp = stylize(buffer, BUF_LONG); | |
6982 | 2220 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, GTK_IMHTML_NO_TITLE | |
5440 | 2221 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
6982 | 2222 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", GTK_IMHTML_NO_TITLE | |
5440 | 2223 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
2224 g_free(tmp); | |
2225 g_value_unset (&val); | |
2226 | |
2227 } | |
2228 | |
6979 | 2229 static gboolean away_message_click_cb(GtkWidget *tv, GdkEventButton *event, gpointer null) |
2230 { | |
2231 /* Only respond to double click on button 1 */ | |
2232 if ((event->button != 1) || (event->type != GDK_2BUTTON_PRESS)) | |
2233 return FALSE; | |
2234 | |
2235 /* Show the edit away message dialog */ | |
2236 create_away_mess(NULL, tv); | |
2237 | |
2238 return FALSE; | |
2239 } | |
2240 | |
5440 | 2241 void remove_away_message(GtkWidget *widget, GtkTreeView *tv) { |
6016 | 2242 struct away_message *am; |
5440 | 2243 GtkTreeIter iter; |
2244 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); | |
2245 GtkTreeModel *model = GTK_TREE_MODEL(prefs_away_store); | |
2246 GValue val = { 0, }; | |
2247 | |
2248 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2249 return; | |
2250 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store), &iter, 1, &val); | |
2251 am = g_value_get_pointer (&val); | |
2252 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
2253 rem_away_mess(NULL, am); | |
2254 } | |
2255 | |
2256 GtkWidget *away_message_page() { | |
2257 GtkWidget *ret; | |
2258 GtkWidget *hbox; | |
2259 GtkWidget *button; | |
2260 GtkWidget *sw; | |
2261 GtkTreeIter iter; | |
2262 GtkWidget *event_view; | |
2263 GtkCellRenderer *rend; | |
2264 GtkTreeViewColumn *col; | |
2265 GtkTreeSelection *sel; | |
2266 GSList *awy = away_messages; | |
2267 struct away_message *a; | |
2268 GtkSizeGroup *sg; | |
2269 | |
2270 ret = gtk_vbox_new(FALSE, 18); | |
2271 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2272 | |
2273 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2274 | |
2275 sw = gtk_scrolled_window_new(NULL,NULL); | |
7931 | 2276 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
7929 | 2277 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 2278 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
2279 | |
7940 | 2280 prefs_away_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); |
5440 | 2281 while (awy) { |
2282 a = (struct away_message *)awy->data; | |
2283 gtk_list_store_append (prefs_away_store, &iter); | |
2284 gtk_list_store_set(prefs_away_store, &iter, | |
2285 0, a->name, | |
2286 1, a, -1); | |
2287 awy = awy->next; | |
2288 } | |
7939 | 2289 event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(prefs_away_store)); |
5440 | 2290 |
2291 rend = gtk_cell_renderer_text_new(); | |
2292 col = gtk_tree_view_column_new_with_attributes ("NULL", | |
2293 rend, | |
2294 "text", 0, | |
2295 NULL); | |
2296 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2297 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); | |
2298 gtk_widget_show(event_view); | |
7931 | 2299 gtk_container_add(GTK_CONTAINER(sw), event_view); |
5440 | 2300 |
7929 | 2301 sw = gtk_scrolled_window_new(NULL, NULL); |
7931 | 2302 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
7929 | 2303 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5440 | 2304 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
7929 | 2305 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
2306 | |
2307 away_text = gtk_imhtml_new(NULL, NULL); | |
7931 | 2308 gtk_container_add(GTK_CONTAINER(sw), away_text); |
2309 | |
5440 | 2310 gaim_setup_imhtml(away_text); |
2311 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
6979 | 2312 g_signal_connect(G_OBJECT(sel), "changed", |
2313 G_CALLBACK(away_message_sel_cb), NULL); | |
2314 g_signal_connect(G_OBJECT(event_view), "button-press-event", | |
2315 G_CALLBACK(away_message_click_cb), NULL); | |
5440 | 2316 hbox = gtk_hbox_new(TRUE, 5); |
2317 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
2318 button = gtk_button_new_from_stock (GTK_STOCK_ADD); | |
2319 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2320 gtk_size_group_add_widget(sg, button); | |
2321 g_signal_connect(G_OBJECT(button), "clicked", | |
2322 G_CALLBACK(create_away_mess), NULL); | |
2323 | |
2324 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); | |
2325 gtk_size_group_add_widget(sg, button); | |
2326 g_signal_connect(G_OBJECT(button), "clicked", | |
2327 G_CALLBACK(remove_away_message), event_view); | |
2328 | |
2329 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2330 | |
2331 button = gaim_pixbuf_button_from_stock(_("_Edit"), GAIM_STOCK_EDIT, GAIM_BUTTON_HORIZONTAL); | |
2332 gtk_size_group_add_widget(sg, button); | |
2333 g_signal_connect(G_OBJECT(button), "clicked", | |
2334 G_CALLBACK(create_away_mess), event_view); | |
2335 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2336 | |
2337 gtk_widget_show_all(ret); | |
2338 return ret; | |
2339 } | |
2340 | |
2341 GtkTreeIter *prefs_notebook_add_page(const char *text, | |
2342 GdkPixbuf *pixbuf, | |
2343 GtkWidget *page, | |
2344 GtkTreeIter *iter, | |
2345 GtkTreeIter *parent, | |
2346 int ind) { | |
2347 GdkPixbuf *icon = NULL; | |
2348 | |
2349 if (pixbuf) | |
2350 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2351 | |
2352 gtk_tree_store_append (prefstree, iter, parent); | |
2353 gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1); | |
2354 | |
2355 if (pixbuf) | |
2356 g_object_unref(pixbuf); | |
2357 if (icon) | |
2358 g_object_unref(icon); | |
2359 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
2360 return iter; | |
2361 } | |
2362 | |
2363 void prefs_notebook_init() { | |
2364 GtkTreeIter p, p2, c; | |
2365 GList *l; | |
2366 GaimPlugin *plug; | |
2367 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | |
2368 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++); | |
2369 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++); | |
2370 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++); | |
2371 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++); | |
2372 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
2373 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++); | |
2374 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++); | |
2375 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++); | |
2376 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++); | |
2377 #ifndef _WIN32 | |
2378 /* We use the registered default browser in windows */ | |
2379 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | |
2380 #endif | |
2381 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2382 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++); | |
2383 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++); | |
2384 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2385 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | |
2386 | |
8170 | 2387 prefs_notebook_add_page(_("Protocols"), NULL, protocol_page(), &p, NULL, notebook_page++); |
2388 for (l = gaim_plugins_get_protocols(); l != NULL; l = l->next) { | |
2389 plug = l->data; | |
2390 | |
2391 if (GAIM_IS_PROTOCOL_PLUGIN(plug)) { | |
2392 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(plug); | |
2393 | |
2394 if (prpl_info->protocol_prefs != NULL) { | |
2395 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2396 protocol_pref_page(prpl_info), &c, | |
2397 &p, notebook_page++); | |
2398 } | |
2399 } | |
2400 } | |
2401 | |
5440 | 2402 if (gaim_plugins_enabled()) { |
2403 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2404 | |
2405 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
2406 plug = l->data; | |
2407 | |
2408 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
2409 GtkWidget *config_frame; | |
2410 GaimGtkPluginUiInfo *ui_info; | |
2411 | |
2412 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
2413 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
2414 | |
2415 if (config_frame != NULL) { | |
2416 ui_info->iter = g_new0(GtkTreeIter, 1); | |
2417 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2418 config_frame, ui_info->iter, | |
2419 &plugin_iter, notebook_page++); | |
2420 } | |
2421 } | |
2422 } | |
2423 } | |
2424 } | |
2425 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2426 void gaim_gtk_prefs_show(void) |
5440 | 2427 { |
2428 GtkWidget *vbox, *vbox2; | |
2429 GtkWidget *hbox; | |
2430 GtkWidget *frame; | |
2431 GtkTreeViewColumn *column; | |
2432 GtkCellRenderer *cell; | |
2433 GtkTreeSelection *sel; | |
2434 GtkWidget *notebook; | |
2435 GtkWidget *sep; | |
2436 GtkWidget *button; | |
2437 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2438 | |
2439 if (prefs) { | |
2440 gtk_window_present(GTK_WINDOW(prefs)); | |
2441 return; | |
2442 } | |
2443 | |
2444 /* copy the preferences to tmp values... | |
2445 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2446 /* (that should have been "effect," right?) */ |
2447 | |
5440 | 2448 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2449 | |
2450 /* Create the window */ | |
2451 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2452 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2453 gtk_widget_realize(prefs); | |
2454 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2455 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
2456 g_signal_connect(G_OBJECT(prefs), "destroy", | |
2457 G_CALLBACK(delete_prefs), NULL); | |
2458 | |
2459 vbox = gtk_vbox_new(FALSE, 5); | |
2460 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); | |
2461 gtk_container_add(GTK_CONTAINER(prefs), vbox); | |
2462 gtk_widget_show(vbox); | |
2463 | |
2464 hbox = gtk_hbox_new (FALSE, 6); | |
2465 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
2466 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
2467 gtk_widget_show (hbox); | |
2468 | |
2469 frame = gtk_frame_new (NULL); | |
2470 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
2471 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); | |
2472 gtk_widget_show (frame); | |
2473 | |
2474 /* The tree -- much inspired by the Gimp */ | |
2475 prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
2476 tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree)); | |
2477 gtk_container_add (GTK_CONTAINER (frame), tree_v); | |
2478 | |
2479 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE); | |
2480 gtk_widget_show(tree_v); | |
2481 /* icons */ | |
2482 /* XXX: to be used at a later date | |
2483 cell = gtk_cell_renderer_pixbuf_new (); | |
2484 column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL); | |
2485 */ | |
2486 | |
2487 /* text */ | |
2488 cell = gtk_cell_renderer_text_new (); | |
2489 column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL); | |
2490 | |
2491 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column); | |
2492 | |
2493 /* The right side */ | |
2494 frame = gtk_frame_new (NULL); | |
2495 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
2496 gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); | |
2497 gtk_widget_show (frame); | |
2498 | |
2499 vbox2 = gtk_vbox_new (FALSE, 4); | |
2500 gtk_container_add (GTK_CONTAINER (frame), vbox2); | |
2501 gtk_widget_show (vbox2); | |
2502 | |
2503 frame = gtk_frame_new (NULL); | |
2504 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); | |
2505 gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0); | |
2506 gtk_widget_show (frame); | |
2507 | |
2508 hbox = gtk_hbox_new (FALSE, 4); | |
2509 gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); | |
2510 gtk_container_add (GTK_CONTAINER (frame), hbox); | |
2511 gtk_widget_show (hbox); | |
2512 | |
2513 preflabel = gtk_label_new(NULL); | |
2514 gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0); | |
2515 gtk_widget_show (preflabel); | |
2516 | |
2517 /* The notebook */ | |
2518 prefsnotebook = notebook = gtk_notebook_new (); | |
2519 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); | |
2520 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); | |
2521 gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0); | |
2522 | |
2523 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v)); | |
2524 g_signal_connect (G_OBJECT (sel), "changed", | |
2525 G_CALLBACK (pref_nb_select), | |
2526 notebook); | |
2527 gtk_widget_show(notebook); | |
2528 sep = gtk_hseparator_new(); | |
2529 gtk_widget_show(sep); | |
2530 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); | |
2531 | |
2532 /* The buttons^H to press! */ | |
2533 hbox = gtk_hbox_new (FALSE, 6); | |
2534 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); | |
2535 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
2536 gtk_widget_show (hbox); | |
2537 | |
2538 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2539 gtk_size_group_add_widget(sg, button); | |
2540 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2541 G_CALLBACK(gtk_widget_destroy), prefs); | |
2542 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2543 gtk_widget_show(button); | |
2544 | |
2545 prefs_notebook_init(); | |
2546 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2547 /* Show everything. */ |
5440 | 2548 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); |
2549 gtk_widget_show(prefs); | |
2550 } | |
2551 | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2552 #if 0 |
5440 | 2553 static void set_logging_option(GtkWidget *w, int option) |
2554 { | |
2555 logging_options ^= option; | |
2556 | |
2557 if (option == OPT_LOG_CONVOS || option == OPT_LOG_CHATS) | |
2558 update_log_convs(); | |
2559 } | |
2560 | |
2561 static void set_convo_option(GtkWidget *w, int option) | |
2562 { | |
2563 convo_options ^= option; | |
2564 | |
2565 if (option == OPT_CONVO_SHOW_SMILEY) | |
2566 gaim_gtkconv_toggle_smileys(); | |
2567 | |
2568 if (option == OPT_CONVO_SHOW_TIME) | |
2569 gaim_gtkconv_toggle_timestamps(); | |
2570 } | |
2571 | |
2572 static void set_im_option(GtkWidget *w, int option) | |
2573 { | |
2574 im_options ^= option; | |
2575 | |
2576 #if 0 | |
2577 if (option == OPT_IM_ONE_WINDOW) | |
2578 im_tabize(); | |
2579 #endif | |
2580 } | |
2581 | |
2582 static void set_chat_option(GtkWidget *w, int option) | |
2583 { | |
2584 chat_options ^= option; | |
2585 | |
2586 #if 0 | |
2587 if (option == OPT_CHAT_ONE_WINDOW) | |
2588 chat_tabize(); | |
2589 #endif | |
2590 } | |
2591 | |
2592 static void set_away_option(GtkWidget *w, int option) | |
2593 { | |
2594 away_options ^= option; | |
2595 | |
2596 if (option == OPT_AWAY_QUEUE) | |
2597 toggle_away_queue(); | |
2598 } | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2599 #endif |
5440 | 2600 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2601 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2602 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2603 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2604 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2605 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2606 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2607 |
7976 | 2608 GtkWidget * |
7987 | 2609 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2610 { |
2611 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2612 |
5440 | 2613 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2614 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2615 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2616 |
5440 | 2617 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2618 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2619 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2620 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2621 |
5440 | 2622 gtk_widget_show(button); |
2623 | |
2624 return button; | |
2625 } | |
2626 | |
2627 void default_away_menu_init(GtkWidget *omenu) | |
2628 { | |
2629 GtkWidget *menu, *opt; | |
6216 | 2630 int index = 0, default_index = 0; |
5440 | 2631 GSList *awy = away_messages; |
2632 struct away_message *a; | |
6216 | 2633 const char *default_name; |
5440 | 2634 |
2635 menu = gtk_menu_new(); | |
2636 | |
6216 | 2637 default_name = gaim_prefs_get_string("/core/away/default_message"); |
2638 | |
5440 | 2639 while (awy) { |
2640 a = (struct away_message *)awy->data; | |
2641 opt = gtk_menu_item_new_with_label(a->name); | |
2642 g_signal_connect(G_OBJECT(opt), "activate", | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2643 G_CALLBACK(set_default_away), GINT_TO_POINTER(index)); |
5440 | 2644 gtk_widget_show(opt); |
2645 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
2646 | |
6216 | 2647 if(!strcmp(default_name, a->name)) |
2648 default_index = index; | |
2649 | |
5440 | 2650 awy = awy->next; |
2651 index++; | |
2652 } | |
2653 | |
2654 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); | |
2655 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); | |
6216 | 2656 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), default_index); |
5440 | 2657 } |
2658 | |
2659 GtkWidget *pref_fg_picture = NULL; | |
2660 GtkWidget *pref_bg_picture = NULL; | |
2661 | |
2662 void destroy_colorsel(GtkWidget *w, gpointer d) | |
2663 { | |
2664 if (d) { | |
2665 gtk_widget_destroy(fgcseld); | |
2666 fgcseld = NULL; | |
2667 } else { | |
2668 gtk_widget_destroy(bgcseld); | |
2669 bgcseld = NULL; | |
2670 } | |
2671 } | |
2672 | |
2673 void apply_color_dlg(GtkWidget *w, gpointer d) | |
2674 { | |
5671 | 2675 char buf[14]; |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2676 |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2677 if (GPOINTER_TO_INT(d) == 1) { |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2678 GdkColor fgcolor; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2679 |
5440 | 2680 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION |
2681 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), | |
2682 &fgcolor); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2683 |
5671 | 2684 g_snprintf(buf, sizeof(buf), "#%04x%04x%04x", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2685 fgcolor.red, fgcolor.green, fgcolor.blue); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2686 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2687 gaim_prefs_set_string("/gaim/gtk/conversations/fgcolor", buf); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2688 |
5440 | 2689 destroy_colorsel(NULL, (void *)1); |
2690 update_color(NULL, pref_fg_picture); | |
2691 } else { | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2692 GdkColor bgcolor; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2693 |
5440 | 2694 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION |
2695 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), | |
2696 &bgcolor); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2697 |
5671 | 2698 g_snprintf(buf, sizeof(buf), "#%04x%04x%04x", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2699 bgcolor.red, bgcolor.green, bgcolor.blue); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2700 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2701 gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", buf); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2702 |
5440 | 2703 destroy_colorsel(NULL, (void *)0); |
2704 update_color(NULL, pref_bg_picture); | |
2705 } | |
2706 gaim_conversation_foreach(gaim_gtkconv_update_font_colors); | |
2707 } | |
2708 | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2709 void set_default_away(GtkWidget *w, gpointer data) |
5440 | 2710 { |
6216 | 2711 struct away_message *default_away = NULL; |
5440 | 2712 int length = g_slist_length(away_messages); |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2713 int i = GPOINTER_TO_INT(data); |
5440 | 2714 |
2715 if (away_messages == NULL) | |
2716 default_away = NULL; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2717 else if (i >= length) |
5440 | 2718 default_away = g_slist_nth_data(away_messages, length - 1); |
2719 else | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2720 default_away = g_slist_nth_data(away_messages, i); |
6216 | 2721 |
2722 if(default_away) | |
2723 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
2724 else | |
2725 gaim_prefs_set_string("/core/away/default_message", ""); | |
5440 | 2726 } |
2727 | |
2728 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) | |
2729 { | |
2730 /* more stuff stolen from X-Chat */ | |
2731 GtkWidget *swid; | |
2732 GdkColor c; | |
2733 GtkStyle *style; | |
2734 c.pixel = 0; | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2735 |
5440 | 2736 if (fgc) { |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2737 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2738 GdkColor fgcolor; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2739 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2740 gdk_color_parse( |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2741 gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2742 &fgcolor); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2743 |
5440 | 2744 c.red = fgcolor.red; |
2745 c.blue = fgcolor.blue; | |
2746 c.green = fgcolor.green; | |
2747 } else { | |
2748 c.red = 0; | |
2749 c.blue = 0; | |
2750 c.green = 0; | |
2751 } | |
2752 } else { | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2753 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2754 GdkColor bgcolor; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2755 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2756 gdk_color_parse( |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2757 gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2758 &bgcolor); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2759 |
5440 | 2760 c.red = bgcolor.red; |
2761 c.blue = bgcolor.blue; | |
2762 c.green = bgcolor.green; | |
2763 } else { | |
2764 c.red = 0xffff; | |
2765 c.blue = 0xffff; | |
2766 c.green = 0xffff; | |
2767 } | |
2768 } | |
2769 | |
2770 style = gtk_style_new(); | |
2771 style->bg[0] = c; | |
2772 | |
2773 swid = gtk_event_box_new(); | |
2774 gtk_widget_set_style(GTK_WIDGET(swid), style); | |
2775 g_object_unref(style); | |
2776 gtk_widget_set_size_request(GTK_WIDGET(swid), 40, -1); | |
2777 gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5); | |
2778 gtk_widget_show(swid); | |
2779 return swid; | |
2780 } | |
2781 | |
2782 void apply_font_dlg(GtkWidget *w, GtkWidget *f) | |
2783 { | |
7079 | 2784 char *fontname, *space; |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2785 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2786 fontname = |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2787 gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f)); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2788 |
5440 | 2789 destroy_fontsel(0, 0); |
2790 | |
7079 | 2791 space = strrchr(fontname, ' '); |
2792 if(space && isdigit(*(space+1))) | |
2793 *space = '\0'; | |
5440 | 2794 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2795 gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2796 |
5440 | 2797 g_free(fontname); |
2798 | |
2799 gaim_conversation_foreach(gaim_gtkconv_update_font_face); | |
2800 } | |
2801 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2802 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2803 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2804 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2805 { |
5841 | 2806 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2807 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2808 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2809 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2810 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2811 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2812 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2813 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2814 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2815 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2816 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2817 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2818 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2819 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2820 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2821 /* Accounts Dialog */ |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
2822 gaim_prefs_add_none("/gaim/gtk/accounts"); |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
2823 gaim_prefs_add_none("/gaim/gtk/accounts/dialog"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2824 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 550); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2825 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 250); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2826 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2827 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2828 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2829 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2830 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2831 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2832 gaim_prefs_add_none("/gaim/gtk/browsers"); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2833 gaim_prefs_add_bool("/gaim/gtk/browsers/new_window", FALSE); |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
2834 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2835 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2836 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2837 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2838 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2839 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2840 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2841 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2842 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2843 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2844 |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2845 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2846 gaim_prefs_add_none("/gaim/gtk/smileys"); |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2847 gaim_prefs_add_string("/gaim/gtk/smileys/theme", ""); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2848 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2849 /* Smiley Callbacks */ |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2850 gaim_prefs_connect_callback("/gaim/gtk/smileys/theme", |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2851 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2852 } |