Mercurial > pidgin
annotate src/gtkprefs.c @ 11243:a511b77a368b
[gaim-migrate @ 13408]
sf patch #1246384, from shiyee
"This patch globally defines
spacings and boreders according to the Gnome Human
Interfaces Guidelines, and uses those defines where
appropriate. No visual changes are made, but the the
intention is that the defines should help promote
uniformness."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 12 Aug 2005 23:53:28 +0000 |
parents | 096020ae09a9 |
children | bb0d7b719af2 |
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" |
10297
ec140184437b
[gaim-migrate @ 11480]
Luke Schierer <lschiere@pidgin.im>
parents:
10272
diff
changeset
|
50 #include "gtkstock.h" |
5872
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 |
5440 | 57 static int sound_row_sel = 0; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
58 static GtkWidget *prefsnotebook; |
5440 | 59 |
60 static GtkWidget *sound_entry = NULL; | |
61 static GtkListStore *smiley_theme_store = NULL; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
62 static GtkWidget *prefs_proxy_frame = NULL; |
5440 | 63 |
64 static GtkWidget *prefs = NULL; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
65 static GtkWidget *debugbutton = NULL; |
5440 | 66 static int notebook_page = 0; |
10759 | 67 static GtkTreeIter plugin_iter; |
5440 | 68 |
69 /* | |
70 * PROTOTYPES | |
71 */ | |
10759 | 72 static int prefs_notebook_add_page(const char*, GdkPixbuf*, |
73 GtkWidget*, GtkTreeIter*, | |
74 GtkTreeIter*, int); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
75 static void delete_prefs(GtkWidget *, void *); |
5440 | 76 static void update_plugin_list(void *data); |
77 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
78 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
79 update_spin_value(GtkWidget *w, GtkWidget *spin) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
80 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
81 const char *key = g_object_get_data(G_OBJECT(spin), "val"); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
82 int value; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
83 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
84 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
|
85 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
86 gaim_prefs_set_int(key, value); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
87 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
88 |
7976 | 89 GtkWidget * |
7987 | 90 gaim_gtk_prefs_labeled_spin_button(GtkWidget *box, const gchar *title, |
10367
5fe89d2df440
[gaim-migrate @ 11586]
Luke Schierer <lschiere@pidgin.im>
parents:
10364
diff
changeset
|
91 const char *key, int min, int max, GtkSizeGroup *sg) |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
92 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
93 GtkWidget *hbox; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
94 GtkWidget *label; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
95 GtkWidget *spin; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
96 GtkObject *adjust; |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
97 int val; |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
98 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
99 val = gaim_prefs_get_int(key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
100 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
101 hbox = gtk_hbox_new(FALSE, 5); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
102 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
103 gtk_widget_show(hbox); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
104 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
105 label = gtk_label_new_with_mnemonic(title); |
8713 | 106 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
107 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
108 gtk_widget_show(label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
109 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
110 adjust = gtk_adjustment_new(val, min, max, 1, 1, 1); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
111 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); |
10367
5fe89d2df440
[gaim-migrate @ 11586]
Luke Schierer <lschiere@pidgin.im>
parents:
10364
diff
changeset
|
112 g_object_set_data(G_OBJECT(spin), "val", (char *)key); |
8467 | 113 if (max < 10000) |
114 gtk_widget_set_size_request(spin, 50, -1); | |
115 else | |
116 gtk_widget_set_size_request(spin, 60, -1); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
117 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
118 g_signal_connect(G_OBJECT(adjust), "value-changed", |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
119 G_CALLBACK(update_spin_value), GTK_WIDGET(spin)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
120 gtk_widget_show(spin); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
121 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
122 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
123 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
124 if (sg) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
125 gtk_size_group_add_widget(sg, label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
126 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
127 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
128 |
8137 | 129 gaim_set_accessible_label (spin, label); |
10759 | 130 |
8238 | 131 return hbox; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
132 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
133 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
134 static void |
9422 | 135 entry_set(GtkEntry *entry, gpointer data) { |
10367
5fe89d2df440
[gaim-migrate @ 11586]
Luke Schierer <lschiere@pidgin.im>
parents:
10364
diff
changeset
|
136 const char *key = (const char*)data; |
9422 | 137 |
138 gaim_prefs_set_string(key, gtk_entry_get_text(entry)); | |
139 } | |
140 | |
141 GtkWidget * | |
10367
5fe89d2df440
[gaim-migrate @ 11586]
Luke Schierer <lschiere@pidgin.im>
parents:
10364
diff
changeset
|
142 gaim_gtk_prefs_labeled_entry(GtkWidget *page, const gchar *title, |
5fe89d2df440
[gaim-migrate @ 11586]
Luke Schierer <lschiere@pidgin.im>
parents:
10364
diff
changeset
|
143 const char *key, GtkSizeGroup *sg) |
9422 | 144 { |
145 GtkWidget *hbox, *label, *entry; | |
146 const gchar *value; | |
147 | |
148 value = gaim_prefs_get_string(key); | |
149 | |
150 hbox = gtk_hbox_new(FALSE, 5); | |
151 gtk_box_pack_start(GTK_BOX(page), hbox, FALSE, FALSE, 5); | |
152 gtk_widget_show(hbox); | |
153 | |
154 label = gtk_label_new_with_mnemonic(title); | |
155 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
156 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
157 gtk_widget_show(label); | |
158 | |
159 entry = gtk_entry_new(); | |
160 gtk_entry_set_text(GTK_ENTRY(entry), value); | |
161 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
162 g_signal_connect(G_OBJECT(entry), "changed", | |
163 G_CALLBACK(entry_set), (char*)key); | |
164 gtk_widget_show(entry); | |
165 | |
166 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
167 | |
168 if(sg) { | |
169 gtk_size_group_add_widget(sg, label); | |
170 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
171 } | |
172 | |
173 gaim_set_accessible_label(entry, label); | |
174 | |
175 return hbox; | |
176 } | |
177 | |
178 static void | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
179 dropdown_set(GObject *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
180 { |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
181 const char *str_value; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
182 int int_value; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
183 GaimPrefType type; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
184 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
185 type = GPOINTER_TO_INT(g_object_get_data(w, "type")); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
186 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
187 if (type == GAIM_PREF_INT) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
188 int_value = GPOINTER_TO_INT(g_object_get_data(w, "value")); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
189 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
190 gaim_prefs_set_int(key, int_value); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
191 } |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
192 else if (type == GAIM_PREF_STRING) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
193 str_value = (const char *)g_object_get_data(w, "value"); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
194 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
195 gaim_prefs_set_string(key, str_value); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
196 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
197 else if (type == GAIM_PREF_BOOLEAN) { |
9151 | 198 gaim_prefs_set_bool(key, |
199 GPOINTER_TO_INT(g_object_get_data(w, "value"))); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
200 } |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
201 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
202 |
7976 | 203 GtkWidget * |
7987 | 204 gaim_gtk_prefs_dropdown_from_list(GtkWidget *box, const gchar *title, |
205 GaimPrefType type, const char *key, GList *menuitems) | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
206 { |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
207 GtkWidget *dropdown, *opt, *menu; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
208 GtkWidget *label; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
209 GtkWidget *hbox; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
210 gchar *text; |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
211 const char *stored_str = NULL; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
212 int stored_int = 0; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
213 int int_value = 0; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
214 const char *str_value = NULL; |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
215 int o = 0; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
216 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
217 g_return_val_if_fail(menuitems != NULL, NULL); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
218 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
219 hbox = gtk_hbox_new(FALSE, 5); |
8713 | 220 /*gtk_container_add (GTK_CONTAINER (box), hbox);*/ |
221 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
|
222 gtk_widget_show(hbox); |
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 label = gtk_label_new_with_mnemonic(title); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
225 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
226 gtk_widget_show(label); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
227 |
8577 | 228 #if 0 /* GTK_CHECK_VERSION(2,4,0) */ |
229 if(type == GAIM_PREF_INT) | |
230 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); | |
231 else if(type == GAIM_PREF_STRING) | |
232 model = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_STRING); | |
233 dropdown = gtk_combo_box_new_with_model(model); | |
234 #else | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
235 dropdown = gtk_option_menu_new(); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
236 menu = gtk_menu_new(); |
8577 | 237 #endif |
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 gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
240 |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
241 if (type == GAIM_PREF_INT) |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
242 stored_int = gaim_prefs_get_int(key); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
243 else if (type == GAIM_PREF_STRING) |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
244 stored_str = gaim_prefs_get_string(key); |
5545
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 while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
247 menuitems = g_list_next(menuitems); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
248 g_return_val_if_fail(menuitems != NULL, NULL); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
249 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
250 opt = gtk_menu_item_new_with_label(text); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
251 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
252 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
|
253 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
254 if (type == GAIM_PREF_INT) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
255 int_value = GPOINTER_TO_INT(menuitems->data); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
256 g_object_set_data(G_OBJECT(opt), "value", |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
257 GINT_TO_POINTER(int_value)); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
258 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
259 else if (type == GAIM_PREF_STRING) { |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
260 str_value = (const char *)menuitems->data; |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
261 |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
262 g_object_set_data(G_OBJECT(opt), "value", (char *)str_value); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
263 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
264 else if (type == GAIM_PREF_BOOLEAN) { |
9151 | 265 g_object_set_data(G_OBJECT(opt), "value", |
266 menuitems->data); | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
267 } |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
268 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
269 g_signal_connect(G_OBJECT(opt), "activate", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
270 G_CALLBACK(dropdown_set), (char *)key); |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
271 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
272 gtk_widget_show(opt); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
273 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
274 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
275 if ((type == GAIM_PREF_INT && stored_int == int_value) || |
5753
96214f5de47c
[gaim-migrate @ 6178]
Christian Hammond <chipx86@chipx86.com>
parents:
5716
diff
changeset
|
276 (type == GAIM_PREF_STRING && stored_str != NULL && |
96214f5de47c
[gaim-migrate @ 6178]
Christian Hammond <chipx86@chipx86.com>
parents:
5716
diff
changeset
|
277 !strcmp(stored_str, str_value)) || |
9151 | 278 (type == GAIM_PREF_BOOLEAN && |
279 (gaim_prefs_get_bool(key) == GPOINTER_TO_INT(menuitems->data)))) { | |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
280 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
281 gtk_menu_set_active(GTK_MENU(menu), o); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
282 } |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
283 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
284 menuitems = g_list_next(menuitems); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
285 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
286 o++; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
287 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
288 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
289 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
290 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
291 gtk_widget_show(dropdown); |
8137 | 292 gaim_set_accessible_label (dropdown, label); |
5551
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 return label; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
295 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
296 |
7976 | 297 GtkWidget * |
7987 | 298 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
|
299 const char *key, ...) |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
300 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
301 va_list ap; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
302 GList *menuitems = NULL; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
303 GtkWidget *dropdown = NULL; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
304 char *name; |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
305 int int_value; |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
306 const char *str_value; |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
307 |
9151 | 308 g_return_val_if_fail(type == GAIM_PREF_BOOLEAN || type == GAIM_PREF_INT || |
309 type == GAIM_PREF_STRING, NULL); | |
310 | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
311 va_start(ap, key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
312 while ((name = va_arg(ap, char *)) != NULL) { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
313 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
314 menuitems = g_list_prepend(menuitems, name); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
315 |
9151 | 316 if (type == GAIM_PREF_INT || type == GAIM_PREF_BOOLEAN) { |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
317 int_value = va_arg(ap, int); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
318 menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(int_value)); |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
319 } |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
320 else { |
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
321 str_value = va_arg(ap, const char *); |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
322 menuitems = g_list_prepend(menuitems, (char *)str_value); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
323 } |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
324 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
325 va_end(ap); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
326 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
327 g_return_val_if_fail(menuitems != NULL, NULL); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
328 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
329 menuitems = g_list_reverse(menuitems); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
330 |
7987 | 331 dropdown = gaim_gtk_prefs_dropdown_from_list(box, title, type, key, |
332 menuitems); | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
333 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
334 g_list_free(menuitems); |
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 return dropdown; |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
337 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
338 |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
339 static void |
10759 | 340 add_plugin_prefs(GaimPlugin *plugin) |
341 { | |
342 /* | |
343 * NOTE: This is basically the same check as before | |
344 * (plug->type == plugin), but now there aren't plugin types. | |
345 * Not yet, anyway. I want to do a V2 of the plugin API. | |
346 * The thing is, we should have a flag specifying the UI type, | |
347 * or just whether it's a general plugin or a UI-specific | |
348 * plugin. We should only load this if it's UI-specific. | |
349 * | |
350 * -- ChipX86 | |
351 */ | |
352 if (GAIM_IS_GTK_PLUGIN(plugin)) | |
353 { | |
354 GtkWidget *config_frame; | |
355 GaimGtkPluginUiInfo *ui_info; | |
356 | |
357 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin); | |
358 config_frame = gaim_gtk_plugin_get_config_frame(plugin); | |
359 | |
360 if (config_frame != NULL) | |
361 { | |
362 ui_info->page_num = | |
363 prefs_notebook_add_page(_(plugin->info->name), NULL, | |
364 config_frame, NULL, | |
365 &plugin_iter, notebook_page++); | |
366 } | |
367 } | |
368 | |
369 if (GAIM_PLUGIN_HAS_PREF_FRAME(plugin)) | |
370 { | |
371 GtkWidget *gtk_frame; | |
372 GaimPluginUiInfo *prefs_info; | |
373 | |
374 prefs_info = GAIM_PLUGIN_UI_INFO(plugin); | |
375 prefs_info->frame = prefs_info->get_plugin_pref_frame(plugin); | |
376 gtk_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
377 | |
378 if (GTK_IS_WIDGET(gtk_frame)) | |
379 { | |
380 prefs_info->page_num = | |
381 prefs_notebook_add_page(_(plugin->info->name), NULL, | |
382 gtk_frame, NULL, | |
383 (plugin->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, | |
384 notebook_page++); | |
385 } else if(prefs_info->frame) { | |
386 /* in the event that there is a pref frame and we can | |
387 * not make a widget out of it, we free the | |
388 * pluginpref frame --Gary | |
389 */ | |
390 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
391 } | |
392 } | |
393 } | |
394 | |
395 static void | |
396 delete_plugin_prefs(GaimPlugin *plugin) | |
397 { | |
398 if (GAIM_IS_GTK_PLUGIN(plugin)) | |
399 { | |
400 GaimGtkPluginUiInfo *ui_info; | |
401 | |
402 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plugin); | |
403 | |
404 if (ui_info != NULL && ui_info->page_num > 0) { | |
405 gtk_notebook_remove_page(GTK_NOTEBOOK(prefsnotebook), | |
406 ui_info->page_num); | |
407 } | |
408 } | |
409 | |
410 if (GAIM_PLUGIN_HAS_PREF_FRAME(plugin)) | |
411 { | |
412 GaimPluginUiInfo *prefs_info; | |
413 | |
414 prefs_info = GAIM_PLUGIN_UI_INFO(plugin); | |
415 | |
416 if (prefs_info->frame != NULL) { | |
417 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
418 prefs_info->frame = NULL; | |
419 } | |
420 | |
421 if (prefs_info->page_num > 0) { | |
422 gtk_notebook_remove_page(GTK_NOTEBOOK(prefsnotebook), | |
423 prefs_info->page_num); | |
424 } | |
425 } | |
426 } | |
427 | |
428 static void | |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
429 delete_prefs(GtkWidget *asdf, void *gdsa) |
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
430 { |
5440 | 431 GList *l; |
432 | |
9508 | 433 /* Close any "select sound" request dialogs */ |
434 gaim_request_close_with_handle(prefs); | |
435 | |
5440 | 436 gaim_plugins_unregister_probe_notify_cb(update_plugin_list); |
437 | |
10087 | 438 /* Unregister callbacks. */ |
439 gaim_prefs_disconnect_by_handle(prefs); | |
440 | |
5440 | 441 prefs = NULL; |
442 sound_entry = NULL; | |
443 debugbutton = NULL; | |
444 notebook_page = 0; | |
445 smiley_theme_store = NULL; | |
446 | |
10759 | 447 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) |
448 { | |
449 delete_plugin_prefs(l->data); | |
5440 | 450 } |
451 } | |
452 | |
453 static void smiley_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
454 GtkTreeIter iter; | |
455 const char *filename; | |
456 GValue val = { 0, }; | |
5841 | 457 |
5440 | 458 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
459 return; | |
460 gtk_tree_model_get_value (model, &iter, 2, &val); | |
461 filename = g_value_get_string(&val); | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
462 gaim_prefs_set_string("/gaim/gtk/smileys/theme", filename); |
5440 | 463 g_value_unset (&val); |
464 } | |
465 | |
10871 | 466 static GtkTreePath *theme_refresh_theme_list() |
5440 | 467 { |
468 GdkPixbuf *pixbuf; | |
469 GSList *themes; | |
470 GtkTreeIter iter; | |
471 GtkTreePath *path = NULL; | |
472 int ind = 0; | |
473 | |
474 | |
475 smiley_theme_probe(); | |
476 | |
477 if (!smiley_themes) | |
478 return NULL; | |
479 | |
480 themes = smiley_themes; | |
481 | |
482 gtk_list_store_clear(smiley_theme_store); | |
483 | |
484 while (themes) { | |
485 struct smiley_theme *theme = themes->data; | |
486 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n" | |
487 "<span size='smaller' foreground='dim grey'>%s</span>", | |
488 theme->name, theme->author, theme->desc); | |
489 gtk_list_store_append (smiley_theme_store, &iter); | |
8494 | 490 |
491 /* | |
492 * LEAK - Gentoo memprof thinks pixbuf is leaking here... but it | |
493 * looks like it should be ok to me. Anyone know what's up? --Mark | |
494 */ | |
8963 | 495 pixbuf = (theme->icon ? gdk_pixbuf_new_from_file(theme->icon, NULL) : NULL); |
5440 | 496 |
497 gtk_list_store_set(smiley_theme_store, &iter, | |
498 0, pixbuf, | |
499 1, description, | |
500 2, theme->path, | |
8928 | 501 3, theme->name, |
5440 | 502 -1); |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
503 |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
504 if (pixbuf != NULL) |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
505 g_object_unref(G_OBJECT(pixbuf)); |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
506 |
5440 | 507 g_free(description); |
508 themes = themes->next; | |
509 if (current_smiley_theme && !strcmp(theme->path, current_smiley_theme->path)) { | |
510 /* path = gtk_tree_path_new_from_indices(ind); */ | |
511 char *iwishihadgtk2_2 = g_strdup_printf("%d", ind); | |
512 path = gtk_tree_path_new_from_string(iwishihadgtk2_2); | |
513 g_free(iwishihadgtk2_2); | |
514 } | |
515 ind++; | |
516 } | |
517 | |
518 return path; | |
519 } | |
520 | |
10871 | 521 static void theme_install_theme(char *path, char *extn) { |
5440 | 522 #ifndef _WIN32 |
9769 | 523 gchar *command, *escaped; |
5440 | 524 #endif |
525 gchar *destdir; | |
526 gchar *tail; | |
8494 | 527 GtkTreePath *themepath = NULL; |
5440 | 528 |
529 /* Just to be safe */ | |
530 g_strchomp(path); | |
531 | |
532 /* I dont know what you are, get out of here */ | |
533 if (extn != NULL) | |
534 tail = extn; | |
535 else if ((tail = strrchr(path, '.')) == NULL) | |
536 return; | |
537 | |
538 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL); | |
539 | |
540 /* We'll check this just to make sure. This also lets us do something different on | |
541 * other platforms, if need be */ | |
542 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) { | |
543 #ifndef _WIN32 | |
9769 | 544 escaped = g_shell_quote(path); |
545 command = g_strdup_printf("tar > /dev/null xzf %s -C %s", escaped, destdir); | |
546 g_free(escaped); | |
5440 | 547 #else |
548 if(!wgaim_gz_untar(path, destdir)) { | |
549 g_free(destdir); | |
550 return; | |
551 } | |
552 #endif | |
553 } | |
554 else { | |
555 g_free(destdir); | |
556 return; | |
557 } | |
558 | |
559 #ifndef _WIN32 | |
560 /* Fire! */ | |
561 system(command); | |
562 | |
563 g_free(command); | |
564 #endif | |
565 g_free(destdir); | |
566 | |
8494 | 567 themepath = theme_refresh_theme_list(); |
568 if (themepath != NULL) | |
569 gtk_tree_path_free(themepath); | |
5440 | 570 } |
571 | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
572 static void |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
573 theme_got_url(void *data, const char *themedata, size_t len) |
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
574 { |
5440 | 575 FILE *f; |
576 gchar *path; | |
577 | |
10203
7ff9b8b22e7d
[gaim-migrate @ 11324]
Herman Bloggs <hermanator12002@yahoo.com>
parents:
10182
diff
changeset
|
578 f = gaim_mkstemp(&path, TRUE); |
5440 | 579 fwrite(themedata, len, 1, f); |
580 fclose(f); | |
581 | |
582 theme_install_theme(path, data); | |
583 | |
10589
0f7452b1f777
[gaim-migrate @ 11994]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
10492
diff
changeset
|
584 g_unlink(path); |
5440 | 585 g_free(path); |
586 } | |
587 | |
11137 | 588 static void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, |
5440 | 589 guint info, guint t, gpointer data) { |
11137 | 590 gchar *name = (gchar *)sd->data; |
5440 | 591 |
592 if ((sd->length >= 0) && (sd->format == 8)) { | |
11137 | 593 /* Well, it looks like the drag event was cool. |
5440 | 594 * Let's do something with it */ |
595 | |
596 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
597 GError *converr = NULL; | |
598 gchar *tmp; | |
11137 | 599 /* It looks like we're dealing with a local file. Let's |
5440 | 600 * just untar it in the right place */ |
601 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { | |
602 gaim_debug(GAIM_DEBUG_ERROR, "theme dnd", "%s\n", | |
603 (converr ? converr->message : | |
604 "g_filename_from_uri error")); | |
605 return; | |
606 } | |
607 theme_install_theme(tmp, NULL); | |
608 g_free(tmp); | |
609 } else if (!g_ascii_strncasecmp(name, "http://", 7)) { | |
610 /* Oo, a web drag and drop. This is where things | |
611 * will start to get interesting */ | |
612 gchar *tail; | |
613 | |
614 if ((tail = strrchr(name, '.')) == NULL) | |
615 return; | |
616 | |
617 /* We'll check this just to make sure. This also lets us do something different on | |
618 * other platforms, if need be */ | |
7094
2343c3aa1dec
[gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents:
7092
diff
changeset
|
619 gaim_url_fetch(name, TRUE, NULL, FALSE, theme_got_url, ".tgz"); |
5440 | 620 } |
621 | |
622 gtk_drag_finish(dc, TRUE, FALSE, t); | |
623 } | |
624 | |
625 gtk_drag_finish(dc, FALSE, FALSE, t); | |
626 } | |
627 | |
8928 | 628 /* Does same as normal sort, except "none" is sorted first */ |
629 gint gaim_sort_smileys (GtkTreeModel *model, | |
630 GtkTreeIter *a, | |
631 GtkTreeIter *b, | |
632 gpointer userdata) | |
633 { | |
634 gint ret = 0; | |
9949 | 635 gchar *name1 = NULL, *name2 = NULL; |
8928 | 636 |
637 gtk_tree_model_get(model, a, 3, &name1, -1); | |
638 gtk_tree_model_get(model, b, 3, &name2, -1); | |
639 | |
640 if (name1 == NULL || name2 == NULL) { | |
641 if (!(name1 == NULL && name2 == NULL)) | |
642 ret = (name1 == NULL) ? -1: 1; | |
643 } else if (!g_ascii_strcasecmp(name1, "none")) { | |
10167 | 644 if (!g_utf8_collate(name1, name2)) |
645 ret = 0; | |
646 else | |
647 /* Sort name1 first */ | |
648 ret = -1; | |
8928 | 649 } else if (!g_ascii_strcasecmp(name2, "none")) { |
650 /* Sort name2 first */ | |
651 ret = 1; | |
652 } else { | |
653 /* Neither string is "none", default to normal sort */ | |
654 ret = g_utf8_collate(name1,name2); | |
655 } | |
656 | |
9521 | 657 g_free(name1); |
658 g_free(name2); | |
659 | |
8928 | 660 return ret; |
661 } | |
662 | |
10850 | 663 static GtkWidget * |
664 theme_page() | |
665 { | |
5440 | 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 | |
11243 | 676 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
677 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 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 |
10181 | 744 formatting_reset_cb(GtkWidget *w, GtkWidget *imhtml) { |
9025 | 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 |
10850 | 809 static GtkWidget * |
810 messages_page() | |
811 { | |
5440 | 812 GtkWidget *ret; |
9025 | 813 GtkWidget *vbox, *fontvbox; |
8833 | 814 GtkWidget *imhtml; |
815 GtkWidget *toolbar; | |
8988 | 816 GtkWidget *frame; |
9025 | 817 GtkWidget *option; |
818 GtkWidget *button; | |
5440 | 819 |
11243 | 820 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
821 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 822 |
8988 | 823 vbox = gaim_gtk_make_frame (ret, _("Display")); |
824 #ifdef USE_GTKSPELL | |
825 gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"), | |
826 "/gaim/gtk/conversations/spellcheck", vbox); | |
827 #endif | |
9049 | 828 vbox = gaim_gtk_make_frame (ret, _("Ignore")); |
10488 | 829 gaim_gtk_prefs_checkbox(_("Ignore _formatting"), |
830 "/gaim/gtk/conversations/ignore_formatting", vbox); | |
8988 | 831 |
832 vbox = gaim_gtk_make_frame (ret, _("Default Formatting")); | |
833 | |
9025 | 834 option = gaim_gtk_prefs_checkbox(_("_Send default formatting with outgoing messages"), |
835 "/gaim/gtk/conversations/send_formatting", vbox); | |
836 | |
8988 | 837 |
9025 | 838 fontvbox = gtk_vbox_new(FALSE, 0); |
10181 | 839 gtk_container_add(GTK_CONTAINER(vbox), fontvbox); |
840 | |
841 frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar); | |
9025 | 842 gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml"); |
8836 | 843 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); |
9025 | 844 gtk_imhtml_append_text(GTK_IMHTML(imhtml), _("This is how your outgoing message text will appear when you use protocols that support formatting. :)"), 0); |
10181 | 845 gtk_box_pack_start(GTK_BOX(fontvbox), frame, FALSE, FALSE, 0); |
8988 | 846 |
9056 | 847 button = gtk_button_new_with_mnemonic(_("_Clear Formatting")); |
9025 | 848 gtk_box_pack_start(GTK_BOX(fontvbox), button, FALSE, FALSE, 0); |
849 | |
850 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) | |
851 gtk_widget_set_sensitive(fontvbox, FALSE); | |
852 | |
8836 | 853 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
854 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml)); | |
855 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
856 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml)); | |
857 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
858 gtk_imhtml_toggle_underline(GTK_IMHTML(imhtml)); | |
859 | |
860 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); | |
861 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor")); | |
862 gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor")); | |
863 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
864 | |
9025 | 865 g_signal_connect(G_OBJECT(button), "clicked", |
866 G_CALLBACK(formatting_reset_cb), imhtml); | |
867 | |
868 g_signal_connect(G_OBJECT(option), "clicked", | |
869 G_CALLBACK(gaim_gtk_toggle_sensitive), fontvbox); | |
870 | |
871 g_signal_connect(G_OBJECT(imhtml), "format_function_toggle", | |
872 G_CALLBACK(formatting_toggle_cb), NULL); | |
873 | |
5440 | 874 gtk_widget_show_all(ret); |
875 return ret; | |
876 } | |
877 | |
10850 | 878 static GtkWidget * |
879 list_page() | |
880 { | |
5440 | 881 GtkWidget *ret; |
882 GtkWidget *vbox; | |
883 GList *l= NULL; | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
884 GSList *sl; |
11243 | 885 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
886 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
7305 | 887 |
888 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
889 vbox = gaim_gtk_make_frame (ret, _("Buddy List Sorting")); |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
890 |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
891 for (sl = gaim_gtk_blist_sort_methods; sl != NULL; sl = sl->next) { |
5631 | 892 struct gaim_gtk_blist_sort_method *method = sl->data; |
893 | |
894 l = g_list_append(l, method->name); | |
895 l = g_list_append(l, method->id); | |
5440 | 896 } |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
897 |
8063 | 898 gaim_gtk_prefs_dropdown_from_list(vbox, _("_Sorting:"), GAIM_PREF_STRING, |
7987 | 899 "/gaim/gtk/blist/sort_type", l); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
900 |
5440 | 901 g_list_free(l); |
902 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
903 vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); |
10351 | 904 gaim_gtk_prefs_checkbox(_("Show more buddy details"), |
7305 | 905 "/gaim/gtk/blist/show_buddy_icons", vbox); |
5440 | 906 |
907 gtk_widget_show_all(ret); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
908 |
5440 | 909 return ret; |
910 } | |
911 | |
8979 | 912 static void |
9155 | 913 conversation_usetabs_cb(const char *name, GaimPrefType type, gpointer value, |
8979 | 914 gpointer data) |
915 { | |
10112 | 916 gboolean usetabs = GPOINTER_TO_INT(value); |
9155 | 917 |
918 if (usetabs) | |
919 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
920 else | |
8979 | 921 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
922 } | |
923 | |
10850 | 924 static GtkWidget * |
925 conv_page() | |
926 { | |
5440 | 927 GtkWidget *ret; |
9155 | 928 GtkWidget *vbox, *vbox2; |
5440 | 929 GtkWidget *label; |
930 GtkSizeGroup *sg; | |
931 GList *names = NULL; | |
932 | |
11243 | 933 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
934 gtk_container_set_border_width(GTK_CONTAINER(ret), GAIM_HIG_BORDER); | |
5440 | 935 |
936 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
937 vbox = gaim_gtk_make_frame(ret, _("Conversations")); |
5440 | 938 |
9832 | 939 gaim_gtk_prefs_checkbox(_("Send unknown \"_slash\" commands as messages"), |
940 "/gaim/gtk/conversations/passthrough_unknown_commands", vbox); | |
9301 | 941 |
9150 | 942 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
943 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
9155 | 944 gaim_gtk_prefs_checkbox(_("Enable buddy ic_on animation"), |
9150 | 945 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); |
9155 | 946 gaim_gtk_prefs_checkbox(_("_Notify buddies that you are typing to them"), |
9150 | 947 "/core/conversations/im/send_typing", vbox); |
9155 | 948 |
949 /* All the tab options! */ | |
950 vbox = gaim_gtk_make_frame(ret, _("Tab Options")); | |
951 | |
952 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
|
953 "/gaim/gtk/conversations/tabs", vbox); |
9155 | 954 |
955 /* | |
956 * Connect a signal to the above preference. When conversations are not | |
957 * shown in a tabbed window then all tabbing options should be disabled. | |
958 */ | |
10972 | 959 vbox2 = gtk_vbox_new(FALSE, 9); |
9155 | 960 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); |
10087 | 961 gaim_prefs_connect_callback(prefs, "/gaim/gtk/conversations/tabs", |
962 conversation_usetabs_cb, vbox2); | |
9155 | 963 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) |
964 gtk_widget_set_sensitive(vbox2, FALSE); | |
965 | |
9891 | 966 gaim_gtk_prefs_checkbox(_("Show close b_utton on tabs"), |
9155 | 967 "/gaim/gtk/conversations/close_on_tabs", vbox2); |
968 | |
969 label = gaim_gtk_prefs_dropdown(vbox2, _("Tab p_lacement:"), GAIM_PREF_INT, | |
8988 | 970 "/gaim/gtk/conversations/tab_side", |
971 _("Top"), GTK_POS_TOP, | |
972 _("Bottom"), GTK_POS_BOTTOM, | |
973 _("Left"), GTK_POS_LEFT, | |
974 _("Right"), GTK_POS_RIGHT, | |
975 NULL); | |
10973 | 976 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
8988 | 977 gtk_size_group_add_widget(sg, label); |
978 | |
9155 | 979 names = gaim_conv_placement_get_options(); |
9251 | 980 label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"), |
9155 | 981 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
982 gtk_size_group_add_widget(sg, label); | |
10973 | 983 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
9155 | 984 g_list_free(names); |
985 | |
5440 | 986 gtk_widget_show_all(ret); |
987 | |
988 return ret; | |
989 } | |
990 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
991 static void network_ip_changed(GtkEntry *entry, gpointer data) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
992 { |
8834 | 993 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
994 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
995 |
9150 | 996 static void |
997 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
998 gpointer data) | |
999 { | |
1000 GtkWidget *frame = data; | |
1001 const char *proxy = value; | |
1002 | |
1003 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | |
1004 gtk_widget_set_sensitive(frame, TRUE); | |
1005 else | |
1006 gtk_widget_set_sensitive(frame, FALSE); | |
1007 } | |
1008 | |
1009 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
1010 { | |
1011 if (entrynum == PROXYHOST) | |
1012 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
1013 else if (entrynum == PROXYPORT) | |
1014 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
1015 else if (entrynum == PROXYUSER) | |
1016 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
1017 else if (entrynum == PROXYPASS) | |
1018 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
1019 } | |
1020 | |
10850 | 1021 static GtkWidget * |
1022 network_page() | |
1023 { | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1024 GtkWidget *ret; |
9150 | 1025 GtkWidget *vbox, *hbox, *entry; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1026 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1027 GtkSizeGroup *sg; |
9150 | 1028 GaimProxyInfo *proxy_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1029 |
11243 | 1030 ret = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
1031 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1032 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1033 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1034 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1035 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1036 "/core/network/auto_ip", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1037 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1038 table = gtk_table_new(2, 1, FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1039 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1040 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1041 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1042 gtk_container_add(GTK_CONTAINER(vbox), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1043 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1044 label = gtk_label_new_with_mnemonic(_("Public _IP:")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1045 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1046 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
|
1047 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1048 entry = gtk_entry_new(); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1049 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1050 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
|
1051 g_signal_connect(G_OBJECT(entry), "changed", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1052 G_CALLBACK(network_ip_changed), NULL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1053 |
8834 | 1054 if (gaim_network_get_public_ip() != NULL) |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1055 gtk_entry_set_text(GTK_ENTRY(entry), |
8834 | 1056 gaim_network_get_public_ip()); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1057 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1058 gaim_set_accessible_label (entry, label); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1059 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1060 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1061 if (gaim_prefs_get_bool("/core/network/auto_ip")) { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1062 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1063 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1064 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1065 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1066 G_CALLBACK(gaim_gtk_toggle_sensitive), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1067 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1068 vbox = gaim_gtk_make_frame (ret, _("Ports")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1069 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1070 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1071 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
|
1072 "/core/network/ports_range_use", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1073 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1074 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1075 "/core/network/ports_range_start", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1076 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1077 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1078 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1079 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1080 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1081 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1082 "/core/network/ports_range_end", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1083 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1084 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1085 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1086 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1087 |
9150 | 1088 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
1089 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
7987 | 1090 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
9150 | 1091 "/core/proxy/type", |
1092 _("No proxy"), "none", | |
1093 "SOCKS 4", "socks4", | |
1094 "SOCKS 5", "socks5", | |
1095 "HTTP", "http", | |
1096 _("Use Environmental Settings"), "envvar", | |
1097 NULL); | |
1098 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
|
1099 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1100 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1101 if (proxy_info == NULL || |
6621 | 1102 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1103 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
|
1104 |
6001 | 1105 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1106 } |
10087 | 1107 gaim_prefs_connect_callback(prefs, "/core/proxy/type", |
1108 proxy_changed_cb, prefs_proxy_frame); | |
9150 | 1109 |
1110 table = gtk_table_new(4, 2, FALSE); | |
5440 | 1111 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1112 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1113 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
9150 | 1114 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); |
5440 | 1115 |
1116 | |
7797 | 1117 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1118 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1119 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1120 | |
1121 entry = gtk_entry_new(); | |
1122 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1123 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1124 g_signal_connect(G_OBJECT(entry), "changed", | |
1125 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1126 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1127 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1128 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1129 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1130 |
1131 hbox = gtk_hbox_new(TRUE, 5); | |
1132 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1133 gaim_set_accessible_label (entry, label); |
5440 | 1134 |
7870 | 1135 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1136 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1137 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1138 |
1139 entry = gtk_entry_new(); | |
1140 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1141 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1142 g_signal_connect(G_OBJECT(entry), "changed", |
1143 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1144 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1145 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1146 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1147 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1148 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1149 |
5440 | 1150 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1151 } | |
8137 | 1152 gaim_set_accessible_label (entry, label); |
5440 | 1153 |
7797 | 1154 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1155 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1156 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1157 |
1158 entry = gtk_entry_new(); | |
1159 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1160 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1161 g_signal_connect(G_OBJECT(entry), "changed", |
1162 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1163 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1164 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
|
1165 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1166 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1167 |
1168 hbox = gtk_hbox_new(TRUE, 5); | |
1169 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1170 gaim_set_accessible_label (entry, label); |
5440 | 1171 |
7797 | 1172 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1173 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1174 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1175 |
1176 entry = gtk_entry_new(); | |
1177 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1178 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
5440 | 1179 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1180 g_signal_connect(G_OBJECT(entry), "changed", | |
1181 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1182 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1183 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
|
1184 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1185 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1186 gaim_set_accessible_label (entry, label); |
5440 | 1187 |
1188 gtk_widget_show_all(ret); | |
1189 return ret; | |
1190 } | |
1191 | |
1192 #ifndef _WIN32 | |
1193 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1194 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1195 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1196 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1197 |
1198 /* carry on normally */ | |
1199 return FALSE; | |
1200 } | |
1201 | |
5633 | 1202 static GList *get_available_browsers() |
5440 | 1203 { |
1204 struct browser { | |
1205 char *name; | |
1206 char *command; | |
1207 }; | |
1208 | |
1209 static struct browser possible_browsers[] = { | |
9405 | 1210 {N_("Epiphany"), "epiphany"}, |
8267 | 1211 {N_("Firebird"), "mozilla-firebird"}, |
8356 | 1212 {N_("Firefox"), "firefox"}, |
9405 | 1213 {N_("Galeon"), "galeon"}, |
1214 {N_("Gnome Default"), "gnome-open"}, | |
1215 {N_("Konqueror"), "kfmclient"}, | |
1216 {N_("Mozilla"), "mozilla"}, | |
1217 {N_("Netscape"), "netscape"}, | |
1218 {N_("Opera"), "opera"} | |
5440 | 1219 }; |
9405 | 1220 static const int num_possible_browsers = 9; |
5440 | 1221 |
1222 GList *browsers = NULL; | |
1223 int i = 0; | |
5819 | 1224 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1225 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1226 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1227 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1228 |
5440 | 1229 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1230 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1231 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1232 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1233 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1234 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1235 browser_setting = NULL; |
5440 | 1236 } |
1237 } | |
1238 | |
5819 | 1239 if(browser_setting) |
1240 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1241 | |
5440 | 1242 return browsers; |
1243 } | |
1244 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1245 static void |
8274 | 1246 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
1247 gpointer data) | |
1248 { | |
1249 GtkWidget *hbox = data; | |
1250 const char *browser = value; | |
1251 | |
1252 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom")); | |
1253 } | |
1254 | |
1255 static void | |
1256 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1257 gpointer data) |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1258 { |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1259 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1260 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1261 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1262 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1263 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1264 |
10850 | 1265 static GtkWidget * |
1266 browser_page() | |
1267 { | |
5440 | 1268 GtkWidget *ret; |
1269 GtkWidget *vbox; | |
1270 GtkWidget *hbox; | |
1271 GtkWidget *label; | |
6007 | 1272 GtkWidget *entry; |
5440 | 1273 GtkSizeGroup *sg; |
1274 GList *browsers = NULL; | |
1275 | |
11243 | 1276 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); |
1277 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 1278 |
1279 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1280 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1281 |
1282 browsers = get_available_browsers(); | |
1283 if (browsers != NULL) { | |
7987 | 1284 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
|
1285 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1286 browsers); |
10973 | 1287 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
5440 | 1288 gtk_size_group_add_widget(sg, label); |
8274 | 1289 |
1290 hbox = gtk_hbox_new(FALSE, 0); | |
1291 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT, | |
1292 "/gaim/gtk/browsers/place", | |
1293 _("Browser default"), GAIM_BROWSER_DEFAULT, | |
1294 _("Existing window"), GAIM_BROWSER_CURRENT, | |
1295 _("New window"), GAIM_BROWSER_NEW_WINDOW, | |
1296 _("New tab"), GAIM_BROWSER_NEW_TAB, | |
1297 NULL); | |
10973 | 1298 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
8274 | 1299 gtk_size_group_add_widget(sg, label); |
1300 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1301 | |
1302 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) | |
1303 gtk_widget_set_sensitive(hbox, FALSE); | |
10087 | 1304 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1305 browser_changed1_cb, hbox); | |
5440 | 1306 } |
1307 | |
1308 hbox = gtk_hbox_new(FALSE, 5); | |
1309 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1310 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1311 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1312 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1313 gtk_size_group_add_widget(sg, label); | |
1314 | |
6007 | 1315 entry = gtk_entry_new(); |
1316 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1317 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1318 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1319 gtk_widget_set_sensitive(hbox, FALSE); |
10087 | 1320 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1321 browser_changed2_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1322 |
6007 | 1323 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1324 | |
1325 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1326 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1327 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1328 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1329 gaim_set_accessible_label (entry, label); |
5440 | 1330 |
1331 gtk_widget_show_all(ret); | |
1332 return ret; | |
1333 } | |
1334 #endif /*_WIN32*/ | |
1335 | |
10850 | 1336 static GtkWidget * |
1337 logging_page() | |
1338 { | |
5440 | 1339 GtkWidget *ret; |
1340 GtkWidget *vbox; | |
7431 | 1341 GList *names; |
8573 | 1342 GtkWidget *sys_box; |
1343 GtkWidget *box; | |
1344 int syslog_enabled = gaim_prefs_get_bool("/core/logging/log_system"); | |
1345 | |
11243 | 1346 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); |
1347 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 1348 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1349 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1350 names = gaim_log_logger_get_options(); |
1351 | |
7987 | 1352 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1353 "/core/logging/format", names); | |
1354 | |
1355 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1356 "/core/logging/log_ims", vbox); |
7987 | 1357 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1358 "/core/logging/log_chats", vbox); |
8573 | 1359 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1360 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
8573 | 1361 |
1362 sys_box = gaim_gtk_prefs_checkbox(_("_Enable system log"), | |
1363 "/core/logging/log_system", vbox); | |
1364 | |
10272 | 1365 box = gaim_gtk_prefs_checkbox(_("Log when buddies log in/log _out"), |
8573 | 1366 "/core/logging/log_signon_signoff", vbox); |
1367 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1368 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1369 gtk_widget_set_sensitive(box, syslog_enabled); | |
1370 | |
1371 box = gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), | |
1372 "/core/logging/log_idle_state", vbox); | |
1373 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1374 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1375 gtk_widget_set_sensitive(box, syslog_enabled); | |
1376 | |
1377 box = gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), | |
1378 "/core/logging/log_away_state", vbox); | |
1379 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1380 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1381 gtk_widget_set_sensitive(box, syslog_enabled); | |
1382 | |
10272 | 1383 box = gaim_gtk_prefs_checkbox(_("Log your own _signons/idleness/awayness"), |
8573 | 1384 "/core/logging/log_own_states", vbox); |
1385 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1386 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1387 gtk_widget_set_sensitive(box, syslog_enabled); | |
1388 | |
5440 | 1389 gtk_widget_show_all(ret); |
1390 return ret; | |
1391 } | |
1392 | |
1393 #ifndef _WIN32 | |
1394 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1395 { | |
5684 | 1396 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1397 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1398 return TRUE; |
1399 } | |
6005 | 1400 |
1401 static void | |
10074 | 1402 sound_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
6005 | 1403 gpointer data) |
1404 { | |
1405 GtkWidget *hbox = data; | |
1406 const char *method = value; | |
1407 | |
1408 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1409 } | |
10074 | 1410 |
1411 static void | |
1412 sound_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
1413 gpointer data) | |
1414 { | |
1415 GtkWidget *vbox = data; | |
1416 const char *method = value; | |
1417 | |
1418 gtk_widget_set_sensitive(vbox, strcmp(method, "none")); | |
1419 } | |
5440 | 1420 #endif |
1421 | |
9150 | 1422 |
1423 static void | |
1424 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1425 { | |
1426 GtkTreeModel *model = (GtkTreeModel *)data; | |
1427 GtkTreeIter iter; | |
1428 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
10930 | 1429 char *pref; |
9150 | 1430 |
1431 gtk_tree_model_get_iter (model, &iter, path); | |
1432 gtk_tree_model_get (model, &iter, | |
1433 2, &pref, | |
1434 -1); | |
1435 | |
1436 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
10930 | 1437 g_free(pref); |
9150 | 1438 |
1439 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1440 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1441 -1); | |
1442 | |
1443 gtk_tree_path_free(path); | |
1444 } | |
1445 | |
1446 static void | |
1447 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1448 { | |
1449 char *pref; | |
1450 gboolean temp_value1, temp_value2; | |
1451 | |
1452 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1453 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1454 | |
1455 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1456 temp_value2 = gaim_prefs_get_bool(pref); | |
1457 | |
1458 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1459 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1460 | |
1461 gaim_sound_play_event(sound_row_sel); | |
1462 | |
1463 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1464 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1465 | |
1466 g_free(pref); | |
1467 } | |
1468 | |
9508 | 1469 /* |
1470 * Resets a sound file back to default. | |
1471 */ | |
9150 | 1472 static void |
1473 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1474 { | |
9508 | 1475 gchar *pref; |
1476 | |
1477 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1478 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
9150 | 1479 gaim_prefs_set_string(pref, ""); |
1480 g_free(pref); | |
1481 | |
1482 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1483 } | |
1484 | |
9508 | 1485 static void |
1486 sound_chosen_cb(void *user_data, const char *filename) | |
9150 | 1487 { |
9508 | 1488 gchar *pref; |
1489 int sound; | |
1490 | |
1491 sound = GPOINTER_TO_INT(user_data); | |
9150 | 1492 |
1493 /* Set it -- and forget it */ | |
1494 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
9508 | 1495 gaim_gtk_sound_get_event_option(sound)); |
1496 gaim_prefs_set_string(pref, filename); | |
9150 | 1497 g_free(pref); |
1498 | |
9508 | 1499 /* |
1500 * If the sound we just changed is still the currently selected | |
1501 * sound, then update the box showing the file name. | |
1502 */ | |
1503 if (sound == sound_row_sel) | |
1504 gtk_entry_set_text(GTK_ENTRY(sound_entry), filename); | |
9150 | 1505 } |
1506 | |
9508 | 1507 static void select_sound(GtkWidget *button, gpointer being_NULL_is_fun) |
9150 | 1508 { |
9508 | 1509 gchar *pref; |
1510 const char *filename; | |
1511 | |
1512 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1513 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1514 filename = gaim_prefs_get_string(pref); | |
1515 g_free(pref); | |
1516 | |
1517 if (*filename == '\0') | |
1518 filename = NULL; | |
1519 | |
1520 gaim_request_file(prefs, _("Sound Selection"), filename, FALSE, | |
1521 G_CALLBACK(sound_chosen_cb), NULL, GINT_TO_POINTER(sound_row_sel)); | |
9150 | 1522 } |
1523 | |
9508 | 1524 static void prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) { |
9150 | 1525 GtkTreeIter iter; |
1526 GValue val = { 0, }; | |
1527 const char *file; | |
1528 char *pref; | |
1529 | |
1530 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1531 return; | |
1532 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1533 sound_row_sel = g_value_get_uint(&val); | |
1534 | |
1535 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1536 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1537 file = gaim_prefs_get_string(pref); | |
1538 g_free(pref); | |
1539 if (sound_entry) | |
1540 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1541 g_value_unset (&val); | |
1542 } | |
1543 | |
10850 | 1544 static GtkWidget * |
1545 sound_page() | |
1546 { | |
5440 | 1547 GtkWidget *ret; |
9150 | 1548 GtkWidget *vbox, *sw, *button; |
5440 | 1549 GtkSizeGroup *sg; |
9150 | 1550 GtkTreeIter iter; |
1551 GtkWidget *event_view; | |
1552 GtkListStore *event_store; | |
1553 GtkCellRenderer *rend; | |
1554 GtkTreeViewColumn *col; | |
1555 GtkTreeSelection *sel; | |
1556 GtkTreePath *path; | |
1557 GtkWidget *hbox; | |
1558 int j; | |
1559 const char *file; | |
11082 | 1560 char *pref; |
5440 | 1561 #ifndef _WIN32 |
1562 GtkWidget *dd; | |
1563 GtkWidget *label; | |
6007 | 1564 GtkWidget *entry; |
5684 | 1565 const char *cmd; |
5440 | 1566 #endif |
1567 | |
11243 | 1568 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); |
1569 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 1570 |
1571 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1572 | |
1573 #ifndef _WIN32 | |
6033 | 1574 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1575 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1576 "/gaim/gtk/sound/method", | |
1577 _("Console beep"), "beep", | |
5440 | 1578 #ifdef USE_AO |
7987 | 1579 _("Automatic"), "automatic", |
11082 | 1580 "Arts", "arts", |
7987 | 1581 "ESD", "esd", |
1582 "NAS", "nas", | |
5440 | 1583 #endif |
7987 | 1584 _("Command"), "custom", |
10074 | 1585 _("No sounds"), "none", |
7987 | 1586 NULL); |
5440 | 1587 gtk_size_group_add_widget(sg, dd); |
10973 | 1588 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); |
5440 | 1589 |
1590 hbox = gtk_hbox_new(FALSE, 5); | |
1591 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1592 | |
6031 | 1593 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1594 gtk_size_group_add_widget(sg, label); |
1595 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1596 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1597 | |
6007 | 1598 entry = gtk_entry_new(); |
1599 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1600 | |
1601 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1602 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1603 if(cmd) |
6007 | 1604 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1605 gtk_widget_set_size_request(entry, 75, -1); | |
1606 | |
1607 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1608 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1609 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1610 |
1611 gtk_widget_set_sensitive(hbox, | |
1612 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1613 "custom")); | |
10087 | 1614 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1615 sound_changed1_cb, hbox); | |
6005 | 1616 |
8141 | 1617 gaim_set_accessible_label (entry, label); |
5440 | 1618 #endif /* _WIN32 */ |
9150 | 1619 |
10074 | 1620 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
1621 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"), | |
1622 "/gaim/gtk/sound/conv_focus", vbox); | |
1623 gaim_gtk_prefs_checkbox(_("_Sounds while away"), | |
1624 "/core/sound/while_away", vbox); | |
1625 | |
10075 | 1626 #ifndef _WIN32 |
10074 | 1627 gtk_widget_set_sensitive(vbox, |
1628 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1629 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1630 sound_changed2_cb, vbox); | |
10075 | 1631 #endif |
10074 | 1632 |
9150 | 1633 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); |
1634 | |
1635 /* The following is an ugly hack to make the frame expand so the | |
1636 * sound events list is big enough to be usable */ | |
1637 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1638 GTK_PACK_START); | |
1639 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1640 TRUE, 0, GTK_PACK_START); | |
1641 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1642 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1643 | |
1644 sw = gtk_scrolled_window_new(NULL,NULL); | |
1645 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1646 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1647 | |
1648 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1649 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1650 | |
1651 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1652 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1653 gaim_gtk_sound_get_event_option(j)); | |
1654 const char *label = gaim_gtk_sound_get_event_label(j); | |
1655 | |
1656 if (label == NULL) { | |
1657 g_free(pref); | |
1658 continue; | |
1659 } | |
1660 | |
1661 gtk_list_store_append (event_store, &iter); | |
1662 gtk_list_store_set(event_store, &iter, | |
1663 0, gaim_prefs_get_bool(pref), | |
1664 1, _(label), | |
1665 2, pref, | |
1666 3, j, | |
1667 -1); | |
1668 g_free(pref); | |
1669 } | |
1670 | |
1671 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1672 | |
1673 rend = gtk_cell_renderer_toggle_new(); | |
1674 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1675 g_signal_connect (G_OBJECT (sel), "changed", | |
1676 G_CALLBACK (prefs_sound_sel), | |
1677 NULL); | |
1678 g_signal_connect (G_OBJECT(rend), "toggled", | |
1679 G_CALLBACK(event_toggled), event_store); | |
1680 path = gtk_tree_path_new_first(); | |
1681 gtk_tree_selection_select_path(sel, path); | |
1682 gtk_tree_path_free(path); | |
1683 | |
1684 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1685 rend, | |
1686 "active", 0, | |
1687 NULL); | |
1688 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1689 | |
1690 rend = gtk_cell_renderer_text_new(); | |
1691 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1692 rend, | |
1693 "text", 1, | |
1694 NULL); | |
1695 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1696 g_object_unref(G_OBJECT(event_store)); | |
1697 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1698 | |
11243 | 1699 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
9150 | 1700 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
1701 sound_entry = gtk_entry_new(); | |
1702 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1703 gaim_gtk_sound_get_event_option(0)); | |
1704 file = gaim_prefs_get_string(pref); | |
1705 g_free(pref); | |
1706 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1707 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1708 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1709 | |
1710 button = gtk_button_new_with_label(_("Test")); | |
1711 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1712 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1713 | |
1714 button = gtk_button_new_with_label(_("Reset")); | |
1715 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1716 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1717 | |
1718 button = gtk_button_new_with_label(_("Choose...")); | |
9508 | 1719 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); |
9150 | 1720 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); |
5440 | 1721 gtk_widget_show_all(ret); |
9118 | 1722 |
10075 | 1723 #ifndef _WIN32 |
10074 | 1724 gtk_widget_set_sensitive(vbox, |
1725 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1726 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1727 sound_changed2_cb, vbox); | |
10075 | 1728 #endif |
10074 | 1729 |
5440 | 1730 return ret; |
1731 } | |
1732 | |
10182 | 1733 /* XXX CORE/UI */ |
1734 #if 0 | |
1735 static void | |
1736 set_default_away(GtkWidget *w, gpointer data) | |
1737 { | |
1738 struct away_message *default_away = NULL; | |
1739 int length = g_slist_length(away_messages); | |
1740 int i = GPOINTER_TO_INT(data); | |
1741 | |
1742 if (away_messages == NULL) | |
1743 default_away = NULL; | |
1744 else if (i >= length) | |
1745 default_away = g_slist_nth_data(away_messages, length - 1); | |
1746 else | |
1747 default_away = g_slist_nth_data(away_messages, i); | |
1748 | |
1749 if(default_away) | |
1750 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
1751 else | |
1752 gaim_prefs_set_string("/core/away/default_message", ""); | |
1753 } | |
1754 #endif | |
1755 | |
10850 | 1756 static GtkWidget * |
1757 away_page() | |
1758 { | |
5440 | 1759 GtkWidget *ret; |
1760 GtkWidget *vbox; | |
1761 GtkWidget *hbox; | |
1762 GtkWidget *label; | |
1763 GtkWidget *button; | |
1764 GtkWidget *select; | |
1765 GtkWidget *dd; | |
1766 GtkSizeGroup *sg; | |
1767 | |
11243 | 1768 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); |
1769 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 1770 |
1771 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1772 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1773 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1774 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1775 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1776 |
9596 | 1777 label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), |
1778 GAIM_PREF_STRING, "/core/away/auto_reply", | |
1779 _("Never"), "never", | |
9736 | 1780 _("When away"), "away", |
10859 | 1781 _("When both away and idle"), "awayidle", |
9596 | 1782 NULL); |
6142 | 1783 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1784 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1785 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1786 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1787 _("None"), "none", | |
1788 _("Gaim usage"), "gaim", | |
5440 | 1789 #ifdef USE_SCREENSAVER |
1790 #ifndef _WIN32 | |
7987 | 1791 _("X usage"), "system", |
5440 | 1792 #else |
7987 | 1793 _("Windows usage"), "system", |
5440 | 1794 #endif |
1795 #endif | |
7987 | 1796 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1797 |
5440 | 1798 gtk_size_group_add_widget(sg, dd); |
10973 | 1799 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0.5); |
5440 | 1800 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1801 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1802 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1803 "/core/away/away_when_idle", vbox); |
8238 | 1804 |
7987 | 1805 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1806 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1807 1, 24 * 60, sg); | |
5440 | 1808 g_signal_connect(G_OBJECT(button), "clicked", |
1809 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1810 | |
8238 | 1811 hbox = gtk_hbox_new(FALSE, 0); |
1812 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1813 | |
5440 | 1814 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); |
1815 gtk_size_group_add_widget(sg, label); | |
10973 | 1816 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); |
8238 | 1817 g_signal_connect(G_OBJECT(button), "clicked", |
1818 G_CALLBACK(gaim_gtk_toggle_sensitive), label); | |
5440 | 1819 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
8238 | 1820 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1821 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1822 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
8238 | 1823 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1824 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1825 |
5440 | 1826 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1827 |
5440 | 1828 return ret; |
1829 } | |
1830 | |
1831 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1832 | |
1833 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1834 { | |
1835 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1836 GtkTreeIter iter; | |
1837 GValue val = { 0, }; | |
1838 GaimPlugin *plug; | |
1839 | |
1840 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1841 return; | |
8104 | 1842 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1843 plug = g_value_get_pointer(&val); |
8998 | 1844 |
5440 | 1845 pname = g_markup_escape_text(_(plug->info->name), -1); |
9307 | 1846 pdesc = (plug->info->description) ? |
1847 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1848 pauth = (plug->info->author) ? | |
1849 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1850 pweb = (plug->info->homepage) ? | |
1851 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1852 | |
5440 | 1853 if (plug->error != NULL) { |
1854 perr = g_markup_escape_text(_(plug->error), -1); | |
1855 buf = g_strdup_printf( | |
1856 "<span size=\"larger\">%s %s</span>\n\n" | |
1857 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1858 "%s", | |
10386 | 1859 pname, plug->info->version, perr, pdesc ? pdesc : ""); |
5440 | 1860 g_free(perr); |
1861 } | |
1862 else { | |
1863 buf = g_strdup_printf( | |
1864 "<span size=\"larger\">%s %s</span>\n\n%s", | |
10386 | 1865 pname, plug->info->version, pdesc ? pdesc : ""); |
5440 | 1866 } |
1867 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1868 g_free(buf); | |
1869 | |
1870 buf = g_strdup_printf( | |
1871 #ifndef _WIN32 | |
1872 _("<span size=\"larger\">%s %s</span>\n\n" | |
1873 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1874 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1875 "<span weight=\"bold\">File name:</span>\t%s"), | |
1876 #else | |
1877 _("<span size=\"larger\">%s %s</span>\n\n" | |
1878 "<span weight=\"bold\">Written by:</span> %s\n" | |
1879 "<span weight=\"bold\">URL:</span> %s\n" | |
1880 "<span weight=\"bold\">File name:</span> %s"), | |
1881 #endif | |
10386 | 1882 pname, plug->info->version, pauth ? pauth : "", pweb ? pweb : "", plug->path); |
5440 | 1883 |
1884 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1885 g_value_unset(&val); | |
1886 g_free(buf); | |
1887 g_free(pname); | |
1888 g_free(pdesc); | |
1889 g_free(pauth); | |
1890 g_free(pweb); | |
1891 } | |
1892 | |
1893 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1894 { | |
1895 GtkTreeModel *model = (GtkTreeModel *)data; | |
1896 GtkTreeIter iter; | |
1897 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1898 GaimPlugin *plug; | |
1899 gchar buf[1024]; | |
6040 | 1900 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1901 |
5440 | 1902 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1903 gdk_window_set_cursor(prefs->window, wait); | |
1904 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1905 |
5440 | 1906 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1907 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1908 |
5440 | 1909 if (!gaim_plugin_is_loaded(plug)) { |
1910 gaim_plugin_load(plug); | |
10759 | 1911 add_plugin_prefs(plug); |
5440 | 1912 } |
1913 else { | |
10759 | 1914 delete_plugin_prefs(plug); |
5440 | 1915 gaim_plugin_unload(plug); |
1916 } | |
1917 | |
1918 gdk_window_set_cursor(prefs->window, NULL); | |
1919 | |
6040 | 1920 name = g_markup_escape_text(_(plug->info->name), -1); |
1921 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 1922 if (plug->error != NULL) { |
6040 | 1923 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 1924 g_snprintf(buf, sizeof(buf), |
1925 "<span size=\"larger\">%s %s</span>\n\n" | |
1926 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1927 "%s", | |
6040 | 1928 name, plug->info->version, error, description); |
1929 g_free(error); | |
1930 } else { | |
5440 | 1931 g_snprintf(buf, sizeof(buf), |
1932 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 1933 name, plug->info->version, description); |
5440 | 1934 } |
6040 | 1935 g_free(name); |
1936 g_free(description); | |
5440 | 1937 |
1938 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1939 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1940 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1941 |
5440 | 1942 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1943 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1944 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1945 gaim_gtk_plugins_save(); |
5440 | 1946 } |
1947 | |
1948 static void | |
1949 update_plugin_list(void *data) | |
1950 { | |
1951 GtkListStore *ls = GTK_LIST_STORE(data); | |
1952 GtkTreeIter iter; | |
1953 GList *probes; | |
1954 GaimPlugin *plug; | |
1955 | |
1956 gtk_list_store_clear(ls); | |
11052
8a68c933a5dd
[gaim-migrate @ 12990]
Richard Laager <rlaager@wiktel.com>
parents:
11033
diff
changeset
|
1957 gaim_plugins_probe(GAIM_PLUGIN_EXT); |
5440 | 1958 |
1959 for (probes = gaim_plugins_get_all(); | |
1960 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1961 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1962 { |
5440 | 1963 plug = probes->data; |
1964 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1965 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
1966 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1967 { |
5440 | 1968 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1969 } |
5440 | 1970 |
1971 gtk_list_store_append (ls, &iter); | |
1972 gtk_list_store_set(ls, &iter, | |
1973 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1974 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 1975 2, _(plug->info->summary), |
8104 | 1976 3, plug, -1); |
5440 | 1977 } |
1978 } | |
1979 | |
1980 static GtkWidget *plugin_page () | |
1981 { | |
1982 GtkWidget *ret; | |
1983 GtkWidget *sw, *vp; | |
1984 GtkWidget *event_view; | |
1985 GtkListStore *ls; | |
1986 GtkCellRenderer *rend, *rendt; | |
1987 GtkTreeViewColumn *col; | |
1988 GtkTreeSelection *sel; | |
1989 GtkTreePath *path; | |
1990 GtkWidget *nb; | |
1991 | |
11243 | 1992 ret = gtk_vbox_new(FALSE, GAIM_HIG_CAT_SPACE); |
1993 gtk_container_set_border_width (GTK_CONTAINER (ret), GAIM_HIG_BORDER); | |
5440 | 1994 |
1995 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 1996 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 1997 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1998 | |
1999 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2000 | |
8104 | 2001 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 2002 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
2003 1, GTK_SORT_ASCENDING); | |
5440 | 2004 |
2005 update_plugin_list(ls); | |
2006 | |
2007 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
2008 | |
2009 rend = gtk_cell_renderer_toggle_new(); | |
2010 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2011 | |
2012 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
2013 rend, | |
2014 "active", 0, | |
2015 NULL); | |
2016 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2017 | |
2018 rendt = gtk_cell_renderer_text_new(); | |
2019 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2020 rendt, | |
2021 "text", 1, | |
2022 NULL); | |
2023 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8998 | 2024 |
8104 | 2025 rendt = gtk_cell_renderer_text_new(); |
2026 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2027 rendt, | |
2028 "text", 2, | |
2029 NULL); | |
2030 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
8998 | 2031 |
5440 | 2032 g_object_unref(G_OBJECT(ls)); |
2033 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
8998 | 2034 |
5440 | 2035 |
2036 nb = gtk_notebook_new(); | |
2037 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2038 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
8998 | 2039 |
5440 | 2040 /* Description */ |
2041 sw = gtk_scrolled_window_new(NULL, NULL); | |
2042 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2043 plugin_description = gtk_label_new(NULL); | |
8998 | 2044 |
5440 | 2045 vp = gtk_viewport_new(NULL, NULL); |
2046 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2047 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2048 | |
2049 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
2050 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2051 | |
8998 | 2052 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); |
5440 | 2053 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); |
2054 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
11243 | 2055 gtk_misc_set_padding(GTK_MISC(plugin_description), GAIM_HIG_BOX_SPACE, GAIM_HIG_BOX_SPACE); |
5440 | 2056 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); |
2057 | |
2058 /* Details */ | |
2059 sw = gtk_scrolled_window_new(NULL, NULL); | |
2060 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2061 plugin_details = gtk_label_new(NULL); | |
8998 | 2062 |
5440 | 2063 vp = gtk_viewport_new(NULL, NULL); |
2064 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2065 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2066 | |
2067 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
2068 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2069 | |
8998 | 2070 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); |
5440 | 2071 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
2072 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
11243 | 2073 gtk_misc_set_padding(GTK_MISC(plugin_details), GAIM_HIG_BOX_SPACE, GAIM_HIG_BOX_SPACE); |
5440 | 2074 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); |
2075 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2076 | |
2077 g_signal_connect (G_OBJECT (sel), "changed", | |
2078 G_CALLBACK (prefs_plugin_sel), | |
8998 | 2079 NULL); |
5440 | 2080 g_signal_connect (G_OBJECT(rend), "toggled", |
2081 G_CALLBACK(plugin_load), ls); | |
2082 | |
2083 path = gtk_tree_path_new_first(); | |
2084 gtk_tree_selection_select_path(sel, path); | |
2085 gtk_tree_path_free(path); | |
2086 | |
2087 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2088 | |
2089 gtk_widget_show_all(ret); | |
2090 return ret; | |
2091 } | |
2092 | |
10759 | 2093 int prefs_notebook_add_page(const char *text, |
5440 | 2094 GdkPixbuf *pixbuf, |
2095 GtkWidget *page, | |
2096 GtkTreeIter *iter, | |
2097 GtkTreeIter *parent, | |
2098 int ind) { | |
2099 GdkPixbuf *icon = NULL; | |
2100 | |
2101 if (pixbuf) | |
2102 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2103 | |
2104 if (pixbuf) | |
2105 g_object_unref(pixbuf); | |
2106 if (icon) | |
2107 g_object_unref(icon); | |
10759 | 2108 |
2109 return gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
5440 | 2110 } |
2111 | |
10871 | 2112 static void prefs_notebook_init() { |
9267 | 2113 GtkTreeIter p, c, c2; |
5440 | 2114 GList *l; |
2115 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
9150 | 2116 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
9267 | 2117 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c2, &c, notebook_page++); |
2118 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | |
9150 | 2119 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
8238 | 2120 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
5440 | 2121 #ifndef _WIN32 |
2122 /* We use the registered default browser in windows */ | |
10060 | 2123 /* if the user is running gnome 2.x, hide the browsers tab */ |
10061 | 2124 if (gaim_running_gnome() == FALSE) { |
10060 | 2125 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2126 } | |
5440 | 2127 #endif |
2128 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2129 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2130 | |
2131 if (gaim_plugins_enabled()) { | |
2132 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2133 | |
2134 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
10759 | 2135 add_plugin_prefs(l->data); |
5440 | 2136 } |
2137 } | |
2138 } | |
2139 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2140 void gaim_gtk_prefs_show(void) |
5440 | 2141 { |
10078 | 2142 GtkWidget *vbox; |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2143 GtkWidget *bbox; |
5440 | 2144 GtkWidget *notebook; |
2145 GtkWidget *button; | |
2146 | |
2147 if (prefs) { | |
2148 gtk_window_present(GTK_WINDOW(prefs)); | |
2149 return; | |
2150 } | |
2151 | |
2152 /* copy the preferences to tmp values... | |
2153 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2154 /* (that should have been "effect," right?) */ |
2155 | |
5440 | 2156 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2157 | |
2158 /* Create the window */ | |
2159 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2160 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2161 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2162 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
11243 | 2163 gtk_container_set_border_width(GTK_CONTAINER(prefs), GAIM_HIG_BORDER); |
5440 | 2164 g_signal_connect(G_OBJECT(prefs), "destroy", |
2165 G_CALLBACK(delete_prefs), NULL); | |
2166 | |
11243 | 2167 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BORDER); |
5440 | 2168 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
2169 gtk_widget_show(vbox); | |
2170 | |
2171 /* The notebook */ | |
2172 prefsnotebook = notebook = gtk_notebook_new (); | |
10078 | 2173 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
2174 | |
5440 | 2175 |
8713 | 2176 /* The buttons to press! */ |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2177 bbox = gtk_hbutton_box_new(); |
11243 | 2178 gtk_box_set_spacing(GTK_BOX(bbox), GAIM_HIG_BOX_SPACE); |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2179 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
|
2180 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2181 gtk_widget_show (bbox); |
5440 | 2182 |
2183 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2184 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2185 G_CALLBACK(gtk_widget_destroy), prefs); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2186 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5440 | 2187 gtk_widget_show(button); |
2188 | |
2189 prefs_notebook_init(); | |
2190 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2191 /* Show everything. */ |
10078 | 2192 gtk_widget_show_all(prefs); |
5440 | 2193 } |
2194 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2195 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2196 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2197 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2198 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2199 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2200 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2201 |
7976 | 2202 GtkWidget * |
7987 | 2203 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2204 { |
2205 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2206 |
5440 | 2207 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2208 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2209 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2210 |
5440 | 2211 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
|
2212 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2213 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2214 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2215 |
5440 | 2216 gtk_widget_show(button); |
2217 | |
2218 return button; | |
2219 } | |
2220 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2221 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2222 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2223 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2224 { |
5841 | 2225 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2226 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2227 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2228 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2229 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2230 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2231 { |
11033
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11007
diff
changeset
|
2232 gaim_debug_register_category("theme dnd"); |
50224ac8184d
[gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents:
11007
diff
changeset
|
2233 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2234 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2235 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2236 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2237 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2238 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2239 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2240 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2241 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2242 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2243 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2244 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2245 |
8283 | 2246 #ifndef _WIN32 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2247 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2248 gaim_prefs_add_none("/gaim/gtk/browsers"); |
8272 | 2249 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
|
2250 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2251 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
8283 | 2252 #endif |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2253 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2254 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2255 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2256 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2257 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2258 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2259 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2260 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2261 |
10605 | 2262 /* File locations */ |
2263 gaim_prefs_add_none("/gaim/gtk/filelocations"); | |
2264 gaim_prefs_add_string("/gaim/gtk/filelocations/last_save_folder", ""); | |
2265 gaim_prefs_add_string("/gaim/gtk/filelocations/last_open_folder", ""); | |
2266 gaim_prefs_add_string("/gaim/gtk/filelocations/last_icon_folder", ""); | |
2267 | |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2268 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2269 gaim_prefs_add_none("/gaim/gtk/smileys"); |
9707 | 2270 gaim_prefs_add_string("/gaim/gtk/smileys/theme", "default"); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2271 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2272 /* Smiley Callbacks */ |
10087 | 2273 gaim_prefs_connect_callback(prefs, "/gaim/gtk/smileys/theme", |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2274 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2275 } |
8905 | 2276 |
2277 void gaim_gtk_prefs_update_old() { | |
2278 /* Rename some old prefs */ | |
2279 gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); | |
2280 gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); | |
2281 gaim_prefs_rename("/core/conversations/placement", | |
8998 | 2282 "/gaim/gtk/conversations/placement"); |
8905 | 2283 |
9025 | 2284 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2285 "/gaim/gtk/conversations/send_formatting"); | |
2286 | |
10307 | 2287 gaim_prefs_rename("/gaim/gtk/debug/timestamps", "/core/debug/timestamps"); |
10488 | 2288 gaim_prefs_rename("/gaim/gtk/conversations/ignore_colors", "/gaim/gtk/conversations/ignore_formatting"); |
10701 | 2289 gaim_prefs_rename("/gaim/gtk/conversations/im/raise_on_events", "/plugins/gtk/X11/notify/method_raise"); |
10307 | 2290 |
8905 | 2291 /* Remove some no-longer-used prefs */ |
10398 | 2292 gaim_prefs_remove("/gaim/gtk/blist/auto_expand_contacts"); |
10133 | 2293 gaim_prefs_remove("/gaim/gtk/blist/button_style"); |
10168 | 2294 gaim_prefs_remove("/gaim/gtk/blist/grey_idle_buddies"); |
10133 | 2295 gaim_prefs_remove("/gaim/gtk/blist/raise_on_events"); |
8945 | 2296 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
10353 | 2297 gaim_prefs_remove("/gaim/gtk/blist/show_idle_time"); |
2298 gaim_prefs_remove("/gaim/gtk/blist/show_warning_level"); | |
10358 | 2299 gaim_prefs_remove("/gaim/gtk/conversations/button_type"); |
10398 | 2300 gaim_prefs_remove("/gaim/gtk/conversations/ctrl_enter_sends"); |
2301 gaim_prefs_remove("/gaim/gtk/conversations/enter_sends"); | |
10164 | 2302 gaim_prefs_remove("/gaim/gtk/conversations/html_shortcuts"); |
8946 | 2303 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
10398 | 2304 gaim_prefs_remove("/gaim/gtk/conversations/show_smileys"); |
2305 gaim_prefs_remove("/gaim/gtk/conversations/show_timestamps"); | |
8905 | 2306 gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links"); |
10164 | 2307 gaim_prefs_remove("/gaim/gtk/conversations/smiley_shortcuts"); |
9025 | 2308 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor"); |
2309 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor"); | |
2310 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size"); | |
10398 | 2311 gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete"); |
2312 gaim_prefs_remove("/gaim/gtk/conversations/chat/tab_completion"); | |
9301 | 2313 gaim_prefs_remove("/gaim/gtk/conversations/im/hide_on_send"); |
10398 | 2314 gaim_prefs_remove("/gaim/gtk/conversations/chat/color_nicks"); |
2315 gaim_prefs_remove("/gaim/gtk/conversations/chat/raise_on_events"); | |
10492 | 2316 gaim_prefs_remove("/gaim/gtk/conversations/ignore_fonts"); |
2317 gaim_prefs_remove("/gaim/gtk/conversations/ignore_font_sizes"); | |
10398 | 2318 gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); |
2319 gaim_prefs_remove("/gaim/gtk/sound/signon"); | |
2320 gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); | |
10489 | 2321 gaim_prefs_remove("/gaim/gtk/conversations/escape_closes"); |
8905 | 2322 } |