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