Mercurial > pidgin.yaz
annotate src/gtkprefs.c @ 10835:c5f8b6e66455
[gaim-migrate @ 12507]
the gevolution plugin works with evolution-data-server 1.0 or 1.2
committer: Tailor Script <tailor@pidgin.im>
author | Stu Tomlinson <stu@nosnilmot.com> |
---|---|
date | Sun, 17 Apr 2005 15:36:28 +0000 |
parents | 56915e1b3ba3 |
children | fa06fda62868 |
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 | |
466 GtkTreePath *theme_refresh_theme_list() | |
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 | |
521 void theme_install_theme(char *path, char *extn) { | |
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 | |
588 void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd, | |
589 guint info, guint t, gpointer data) { | |
590 gchar *name = sd->data; | |
591 | |
592 if ((sd->length >= 0) && (sd->format == 8)) { | |
593 /* Well, it looks like the drag event was cool. | |
594 * Let's do something with it */ | |
595 | |
596 if (!g_ascii_strncasecmp(name, "file://", 7)) { | |
597 GError *converr = NULL; | |
598 gchar *tmp; | |
599 /* It looks like we're dealing with a local file. Let's | |
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 | |
5440 | 663 GtkWidget *theme_page() { |
664 GtkWidget *ret; | |
665 GtkWidget *sw; | |
666 GtkWidget *view; | |
667 GtkCellRenderer *rend; | |
668 GtkTreeViewColumn *col; | |
669 GtkTreeSelection *sel; | |
670 GtkTreePath *path = NULL; | |
671 GtkWidget *label; | |
672 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}}; | |
673 | |
674 ret = gtk_vbox_new(FALSE, 18); | |
675 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
676 | |
677 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.")); | |
678 | |
679 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); | |
680 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); | |
681 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT); | |
682 | |
683 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, TRUE, 0); | |
684 gtk_widget_show(label); | |
685 | |
686 sw = gtk_scrolled_window_new(NULL,NULL); | |
7939 | 687 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
7931 | 688 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
5440 | 689 |
690 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
8928 | 691 smiley_theme_store = gtk_list_store_new (4, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); |
5440 | 692 |
693 path = theme_refresh_theme_list(); | |
8075 | 694 |
5440 | 695 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store)); |
696 | |
697 gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, | |
698 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); | |
699 | |
700 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store); | |
701 | |
702 rend = gtk_cell_renderer_pixbuf_new(); | |
703 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view)); | |
704 | |
705 if(path) { | |
706 gtk_tree_selection_select_path(sel, path); | |
707 gtk_tree_path_free(path); | |
708 } | |
8928 | 709 |
710 /* Custom sort so "none" theme is at top of list */ | |
711 gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(smiley_theme_store), | |
712 3, gaim_sort_smileys, NULL, NULL); | |
713 | |
8075 | 714 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(smiley_theme_store), |
8928 | 715 3, GTK_SORT_ASCENDING); |
5440 | 716 |
717 col = gtk_tree_view_column_new_with_attributes (_("Icon"), | |
718 rend, | |
719 "pixbuf", 0, | |
720 NULL); | |
721 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
722 | |
723 rend = gtk_cell_renderer_text_new(); | |
724 col = gtk_tree_view_column_new_with_attributes (_("Description"), | |
725 rend, | |
726 "markup", 1, | |
727 NULL); | |
728 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col); | |
729 g_object_unref(G_OBJECT(smiley_theme_store)); | |
730 gtk_container_add(GTK_CONTAINER(sw), view); | |
731 | |
8075 | 732 g_signal_connect(G_OBJECT(sel), "changed", G_CALLBACK(smiley_sel), NULL); |
5440 | 733 |
734 gtk_widget_show_all(ret); | |
8137 | 735 |
736 gaim_set_accessible_label (view, label); | |
737 | |
5440 | 738 return ret; |
739 } | |
740 | |
9025 | 741 static void |
10181 | 742 formatting_reset_cb(GtkWidget *w, GtkWidget *imhtml) { |
9025 | 743 gboolean bold, italic, uline; |
744 bold = italic = uline = FALSE; | |
745 | |
746 gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), &bold, &italic, &uline); | |
747 if (bold) | |
748 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml)); | |
749 if (italic) | |
750 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml)); | |
751 if (uline) | |
752 gtk_imhtml_toggle_underline(GTK_IMHTML(imhtml)); | |
753 | |
754 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), 3); | |
755 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), NULL); | |
756 gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), NULL); | |
757 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), NULL); | |
758 } | |
759 | |
760 static void | |
761 formatting_toggle_cb(GtkIMHtml *imhtml, GtkIMHtmlButtons buttons, void *bah) | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
762 { |
9025 | 763 gboolean bold, italic, uline; |
764 | |
765 bold = italic = uline = FALSE; | |
766 gtk_imhtml_get_current_format(GTK_IMHTML(imhtml), | |
767 &bold, &italic, &uline); | |
768 | |
769 if (buttons & GTK_IMHTML_BOLD) | |
770 gaim_prefs_set_bool("/gaim/gtk/conversations/send_bold", bold); | |
771 if (buttons & GTK_IMHTML_ITALIC) | |
772 gaim_prefs_set_bool("/gaim/gtk/conversations/send_italic", italic); | |
773 if (buttons & GTK_IMHTML_UNDERLINE) | |
774 gaim_prefs_set_bool("/gaim/gtk/conversations/send_underline", uline); | |
775 | |
776 if (buttons & GTK_IMHTML_GROW || buttons & GTK_IMHTML_SHRINK) | |
777 gaim_prefs_set_int("/gaim/gtk/conversations/font_size", | |
778 gtk_imhtml_get_current_fontsize(GTK_IMHTML(imhtml))); | |
779 if (buttons & GTK_IMHTML_FACE) { | |
780 char *face = gtk_imhtml_get_current_fontface(GTK_IMHTML(imhtml)); | |
781 if (!face) | |
782 face = g_strdup(""); | |
783 | |
784 gaim_prefs_set_string("/gaim/gtk/conversations/font_face", face); | |
785 g_free(face); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
786 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
787 |
9025 | 788 if (buttons & GTK_IMHTML_FORECOLOR) { |
789 char *color = gtk_imhtml_get_current_forecolor(GTK_IMHTML(imhtml)); | |
790 if (!color) | |
791 color = g_strdup(""); | |
792 | |
793 gaim_prefs_set_string("/gaim/gtk/conversations/fgcolor", color); | |
794 g_free(color); | |
795 } | |
796 | |
797 if (buttons & GTK_IMHTML_BACKCOLOR) { | |
798 char *color = gtk_imhtml_get_current_backcolor(GTK_IMHTML(imhtml)); | |
799 if (!color) | |
800 color = g_strdup(""); | |
801 | |
802 gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", color); | |
803 g_free(color); | |
804 } | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
805 } |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
806 |
8988 | 807 GtkWidget *messages_page() { |
5440 | 808 GtkWidget *ret; |
9025 | 809 GtkWidget *vbox, *fontvbox; |
8833 | 810 GtkWidget *imhtml; |
811 GtkWidget *toolbar; | |
8988 | 812 GtkWidget *frame; |
9025 | 813 GtkWidget *option; |
814 GtkWidget *button; | |
5440 | 815 |
816 ret = gtk_vbox_new(FALSE, 18); | |
817 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
818 | |
8988 | 819 vbox = gaim_gtk_make_frame (ret, _("Display")); |
820 #ifdef USE_GTKSPELL | |
821 gaim_gtk_prefs_checkbox(_("_Highlight misspelled words"), | |
822 "/gaim/gtk/conversations/spellcheck", vbox); | |
823 #endif | |
9049 | 824 vbox = gaim_gtk_make_frame (ret, _("Ignore")); |
10488 | 825 gaim_gtk_prefs_checkbox(_("Ignore _formatting"), |
826 "/gaim/gtk/conversations/ignore_formatting", vbox); | |
8988 | 827 |
828 vbox = gaim_gtk_make_frame (ret, _("Default Formatting")); | |
829 | |
9025 | 830 option = gaim_gtk_prefs_checkbox(_("_Send default formatting with outgoing messages"), |
831 "/gaim/gtk/conversations/send_formatting", vbox); | |
832 | |
8988 | 833 |
9025 | 834 fontvbox = gtk_vbox_new(FALSE, 0); |
10181 | 835 gtk_container_add(GTK_CONTAINER(vbox), fontvbox); |
836 | |
837 frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar); | |
9025 | 838 gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml"); |
8836 | 839 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); |
9025 | 840 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 | 841 gtk_box_pack_start(GTK_BOX(fontvbox), frame, FALSE, FALSE, 0); |
8988 | 842 |
9056 | 843 button = gtk_button_new_with_mnemonic(_("_Clear Formatting")); |
9025 | 844 gtk_box_pack_start(GTK_BOX(fontvbox), button, FALSE, FALSE, 0); |
845 | |
846 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) | |
847 gtk_widget_set_sensitive(fontvbox, FALSE); | |
848 | |
8836 | 849 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
850 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml)); | |
851 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
852 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml)); | |
853 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
854 gtk_imhtml_toggle_underline(GTK_IMHTML(imhtml)); | |
855 | |
856 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); | |
857 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor")); | |
858 gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor")); | |
859 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
860 | |
9025 | 861 g_signal_connect(G_OBJECT(button), "clicked", |
862 G_CALLBACK(formatting_reset_cb), imhtml); | |
863 | |
864 g_signal_connect(G_OBJECT(option), "clicked", | |
865 G_CALLBACK(gaim_gtk_toggle_sensitive), fontvbox); | |
866 | |
867 g_signal_connect(G_OBJECT(imhtml), "format_function_toggle", | |
868 G_CALLBACK(formatting_toggle_cb), NULL); | |
869 | |
5440 | 870 gtk_widget_show_all(ret); |
871 return ret; | |
872 } | |
873 | |
874 GtkWidget *list_page() { | |
875 GtkWidget *ret; | |
876 GtkWidget *vbox; | |
877 GList *l= NULL; | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
878 GSList *sl; |
5440 | 879 ret = gtk_vbox_new(FALSE, 18); |
880 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
7305 | 881 |
882 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
883 vbox = gaim_gtk_make_frame (ret, _("Buddy List Sorting")); |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
884 |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
885 for (sl = gaim_gtk_blist_sort_methods; sl != NULL; sl = sl->next) { |
5631 | 886 struct gaim_gtk_blist_sort_method *method = sl->data; |
887 | |
888 l = g_list_append(l, method->name); | |
889 l = g_list_append(l, method->id); | |
5440 | 890 } |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
891 |
8063 | 892 gaim_gtk_prefs_dropdown_from_list(vbox, _("_Sorting:"), GAIM_PREF_STRING, |
7987 | 893 "/gaim/gtk/blist/sort_type", l); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
894 |
5440 | 895 g_list_free(l); |
896 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
897 vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); |
10351 | 898 gaim_gtk_prefs_checkbox(_("Show more buddy details"), |
7305 | 899 "/gaim/gtk/blist/show_buddy_icons", vbox); |
5440 | 900 |
901 gtk_widget_show_all(ret); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
902 |
5440 | 903 return ret; |
904 } | |
905 | |
8979 | 906 static void |
9155 | 907 conversation_usetabs_cb(const char *name, GaimPrefType type, gpointer value, |
8979 | 908 gpointer data) |
909 { | |
10112 | 910 gboolean usetabs = GPOINTER_TO_INT(value); |
9155 | 911 |
912 if (usetabs) | |
913 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
914 else | |
8979 | 915 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
916 } | |
917 | |
5440 | 918 GtkWidget *conv_page() { |
919 GtkWidget *ret; | |
9155 | 920 GtkWidget *vbox, *vbox2; |
5440 | 921 GtkWidget *label; |
922 GtkSizeGroup *sg; | |
923 GList *names = NULL; | |
924 | |
925 ret = gtk_vbox_new(FALSE, 18); | |
926 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
927 | |
928 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
929 vbox = gaim_gtk_make_frame(ret, _("Conversations")); |
5440 | 930 |
9832 | 931 gaim_gtk_prefs_checkbox(_("Send unknown \"_slash\" commands as messages"), |
932 "/gaim/gtk/conversations/passthrough_unknown_commands", vbox); | |
9301 | 933 |
9150 | 934 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
935 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
9155 | 936 gaim_gtk_prefs_checkbox(_("Enable buddy ic_on animation"), |
9150 | 937 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); |
9155 | 938 gaim_gtk_prefs_checkbox(_("_Notify buddies that you are typing to them"), |
9150 | 939 "/core/conversations/im/send_typing", vbox); |
9155 | 940 |
941 /* All the tab options! */ | |
942 vbox = gaim_gtk_make_frame(ret, _("Tab Options")); | |
943 | |
944 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
|
945 "/gaim/gtk/conversations/tabs", vbox); |
9155 | 946 |
947 /* | |
948 * Connect a signal to the above preference. When conversations are not | |
949 * shown in a tabbed window then all tabbing options should be disabled. | |
950 */ | |
951 vbox2 = gtk_vbox_new(FALSE, 0); | |
952 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); | |
10087 | 953 gaim_prefs_connect_callback(prefs, "/gaim/gtk/conversations/tabs", |
954 conversation_usetabs_cb, vbox2); | |
9155 | 955 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) |
956 gtk_widget_set_sensitive(vbox2, FALSE); | |
957 | |
9891 | 958 gaim_gtk_prefs_checkbox(_("Show close b_utton on tabs"), |
9155 | 959 "/gaim/gtk/conversations/close_on_tabs", vbox2); |
960 | |
961 label = gaim_gtk_prefs_dropdown(vbox2, _("Tab p_lacement:"), GAIM_PREF_INT, | |
8988 | 962 "/gaim/gtk/conversations/tab_side", |
963 _("Top"), GTK_POS_TOP, | |
964 _("Bottom"), GTK_POS_BOTTOM, | |
965 _("Left"), GTK_POS_LEFT, | |
966 _("Right"), GTK_POS_RIGHT, | |
967 NULL); | |
968 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
969 gtk_size_group_add_widget(sg, label); | |
970 | |
9155 | 971 names = gaim_conv_placement_get_options(); |
9251 | 972 label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"), |
9155 | 973 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
974 gtk_size_group_add_widget(sg, label); | |
975 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
976 g_list_free(names); | |
977 | |
5440 | 978 gtk_widget_show_all(ret); |
979 | |
980 return ret; | |
981 } | |
982 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
983 static void network_ip_changed(GtkEntry *entry, gpointer data) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
984 { |
8834 | 985 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
986 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
987 |
9150 | 988 static void |
989 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
990 gpointer data) | |
991 { | |
992 GtkWidget *frame = data; | |
993 const char *proxy = value; | |
994 | |
995 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | |
996 gtk_widget_set_sensitive(frame, TRUE); | |
997 else | |
998 gtk_widget_set_sensitive(frame, FALSE); | |
999 } | |
1000 | |
1001 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
1002 { | |
1003 if (entrynum == PROXYHOST) | |
1004 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
1005 else if (entrynum == PROXYPORT) | |
1006 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
1007 else if (entrynum == PROXYUSER) | |
1008 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
1009 else if (entrynum == PROXYPASS) | |
1010 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
1011 } | |
1012 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1013 GtkWidget *network_page() { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1014 GtkWidget *ret; |
9150 | 1015 GtkWidget *vbox, *hbox, *entry; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1016 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1017 GtkSizeGroup *sg; |
9150 | 1018 GaimProxyInfo *proxy_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1019 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1020 ret = gtk_vbox_new(FALSE, 18); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1021 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1022 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1023 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1024 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1025 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1026 "/core/network/auto_ip", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1027 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1028 table = gtk_table_new(2, 1, FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1029 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1030 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1031 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1032 gtk_container_add(GTK_CONTAINER(vbox), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1033 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1034 label = gtk_label_new_with_mnemonic(_("Public _IP:")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1035 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1036 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
|
1037 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1038 entry = gtk_entry_new(); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1039 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1040 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
|
1041 g_signal_connect(G_OBJECT(entry), "changed", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1042 G_CALLBACK(network_ip_changed), NULL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1043 |
8834 | 1044 if (gaim_network_get_public_ip() != NULL) |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1045 gtk_entry_set_text(GTK_ENTRY(entry), |
8834 | 1046 gaim_network_get_public_ip()); |
8231
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 gaim_set_accessible_label (entry, label); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1049 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1050 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1051 if (gaim_prefs_get_bool("/core/network/auto_ip")) { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1052 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1053 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1054 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1055 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1056 G_CALLBACK(gaim_gtk_toggle_sensitive), table); |
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 vbox = gaim_gtk_make_frame (ret, _("Ports")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1059 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
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 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
|
1062 "/core/network/ports_range_use", vbox); |
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 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1065 "/core/network/ports_range_start", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1066 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1067 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1068 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1069 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
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 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1072 "/core/network/ports_range_end", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1073 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1074 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1075 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1076 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1077 |
9150 | 1078 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
1079 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
7987 | 1080 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
9150 | 1081 "/core/proxy/type", |
1082 _("No proxy"), "none", | |
1083 "SOCKS 4", "socks4", | |
1084 "SOCKS 5", "socks5", | |
1085 "HTTP", "http", | |
1086 _("Use Environmental Settings"), "envvar", | |
1087 NULL); | |
1088 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
|
1089 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1090 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1091 if (proxy_info == NULL || |
6621 | 1092 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1093 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
|
1094 |
6001 | 1095 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1096 } |
10087 | 1097 gaim_prefs_connect_callback(prefs, "/core/proxy/type", |
1098 proxy_changed_cb, prefs_proxy_frame); | |
9150 | 1099 |
1100 table = gtk_table_new(4, 2, FALSE); | |
5440 | 1101 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1102 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1103 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
9150 | 1104 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); |
5440 | 1105 |
1106 | |
7797 | 1107 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1108 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1109 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1110 | |
1111 entry = gtk_entry_new(); | |
1112 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1113 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1114 g_signal_connect(G_OBJECT(entry), "changed", | |
1115 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1116 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1117 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1118 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1119 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1120 |
1121 hbox = gtk_hbox_new(TRUE, 5); | |
1122 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1123 gaim_set_accessible_label (entry, label); |
5440 | 1124 |
7870 | 1125 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1126 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1127 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1128 |
1129 entry = gtk_entry_new(); | |
1130 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1131 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1132 g_signal_connect(G_OBJECT(entry), "changed", |
1133 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1134 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1135 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1136 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1137 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1138 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1139 |
5440 | 1140 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1141 } | |
8137 | 1142 gaim_set_accessible_label (entry, label); |
5440 | 1143 |
7797 | 1144 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1145 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1146 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1147 |
1148 entry = gtk_entry_new(); | |
1149 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1150 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1151 g_signal_connect(G_OBJECT(entry), "changed", |
1152 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1153 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1154 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
|
1155 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1156 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1157 |
1158 hbox = gtk_hbox_new(TRUE, 5); | |
1159 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1160 gaim_set_accessible_label (entry, label); |
5440 | 1161 |
7797 | 1162 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1163 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1164 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1165 |
1166 entry = gtk_entry_new(); | |
1167 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1168 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
5440 | 1169 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1170 g_signal_connect(G_OBJECT(entry), "changed", | |
1171 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1172 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1173 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
|
1174 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1175 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1176 gaim_set_accessible_label (entry, label); |
5440 | 1177 |
1178 gtk_widget_show_all(ret); | |
1179 return ret; | |
1180 } | |
1181 | |
1182 #ifndef _WIN32 | |
1183 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1184 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1185 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1186 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1187 |
1188 /* carry on normally */ | |
1189 return FALSE; | |
1190 } | |
1191 | |
5633 | 1192 static GList *get_available_browsers() |
5440 | 1193 { |
1194 struct browser { | |
1195 char *name; | |
1196 char *command; | |
1197 }; | |
1198 | |
1199 static struct browser possible_browsers[] = { | |
9405 | 1200 {N_("Epiphany"), "epiphany"}, |
8267 | 1201 {N_("Firebird"), "mozilla-firebird"}, |
8356 | 1202 {N_("Firefox"), "firefox"}, |
9405 | 1203 {N_("Galeon"), "galeon"}, |
1204 {N_("Gnome Default"), "gnome-open"}, | |
1205 {N_("Konqueror"), "kfmclient"}, | |
1206 {N_("Mozilla"), "mozilla"}, | |
1207 {N_("Netscape"), "netscape"}, | |
1208 {N_("Opera"), "opera"} | |
5440 | 1209 }; |
9405 | 1210 static const int num_possible_browsers = 9; |
5440 | 1211 |
1212 GList *browsers = NULL; | |
1213 int i = 0; | |
5819 | 1214 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1215 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1216 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1217 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1218 |
5440 | 1219 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1220 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1221 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1222 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1223 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1224 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1225 browser_setting = NULL; |
5440 | 1226 } |
1227 } | |
1228 | |
5819 | 1229 if(browser_setting) |
1230 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1231 | |
5440 | 1232 return browsers; |
1233 } | |
1234 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1235 static void |
8274 | 1236 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
1237 gpointer data) | |
1238 { | |
1239 GtkWidget *hbox = data; | |
1240 const char *browser = value; | |
1241 | |
1242 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom")); | |
1243 } | |
1244 | |
1245 static void | |
1246 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1247 gpointer data) |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1248 { |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1249 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1250 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1251 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1252 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1253 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1254 |
5440 | 1255 GtkWidget *browser_page() { |
1256 GtkWidget *ret; | |
1257 GtkWidget *vbox; | |
1258 GtkWidget *hbox; | |
1259 GtkWidget *label; | |
6007 | 1260 GtkWidget *entry; |
5440 | 1261 GtkSizeGroup *sg; |
1262 GList *browsers = NULL; | |
1263 | |
1264 ret = gtk_vbox_new(FALSE, 18); | |
1265 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1266 | |
1267 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1268 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1269 |
1270 browsers = get_available_browsers(); | |
1271 if (browsers != NULL) { | |
7987 | 1272 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
|
1273 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1274 browsers); |
5440 | 1275 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1276 gtk_size_group_add_widget(sg, label); | |
8274 | 1277 |
1278 hbox = gtk_hbox_new(FALSE, 0); | |
1279 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT, | |
1280 "/gaim/gtk/browsers/place", | |
1281 _("Browser default"), GAIM_BROWSER_DEFAULT, | |
1282 _("Existing window"), GAIM_BROWSER_CURRENT, | |
1283 _("New window"), GAIM_BROWSER_NEW_WINDOW, | |
1284 _("New tab"), GAIM_BROWSER_NEW_TAB, | |
1285 NULL); | |
1286 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1287 gtk_size_group_add_widget(sg, label); | |
1288 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1289 | |
1290 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) | |
1291 gtk_widget_set_sensitive(hbox, FALSE); | |
10087 | 1292 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1293 browser_changed1_cb, hbox); | |
5440 | 1294 } |
1295 | |
1296 hbox = gtk_hbox_new(FALSE, 5); | |
1297 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1298 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1299 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1300 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1301 gtk_size_group_add_widget(sg, label); | |
1302 | |
6007 | 1303 entry = gtk_entry_new(); |
1304 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1305 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1306 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1307 gtk_widget_set_sensitive(hbox, FALSE); |
10087 | 1308 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1309 browser_changed2_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1310 |
6007 | 1311 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1312 | |
1313 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1314 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1315 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1316 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1317 gaim_set_accessible_label (entry, label); |
5440 | 1318 |
1319 gtk_widget_show_all(ret); | |
1320 return ret; | |
1321 } | |
1322 #endif /*_WIN32*/ | |
1323 | |
1324 GtkWidget *logging_page() { | |
1325 GtkWidget *ret; | |
1326 GtkWidget *vbox; | |
7431 | 1327 GList *names; |
8573 | 1328 GtkWidget *sys_box; |
1329 GtkWidget *box; | |
1330 int syslog_enabled = gaim_prefs_get_bool("/core/logging/log_system"); | |
1331 | |
5440 | 1332 ret = gtk_vbox_new(FALSE, 18); |
1333 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1334 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1335 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1336 names = gaim_log_logger_get_options(); |
1337 | |
7987 | 1338 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1339 "/core/logging/format", names); | |
1340 | |
1341 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1342 "/core/logging/log_ims", vbox); |
7987 | 1343 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1344 "/core/logging/log_chats", vbox); |
8573 | 1345 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1346 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
8573 | 1347 |
1348 sys_box = gaim_gtk_prefs_checkbox(_("_Enable system log"), | |
1349 "/core/logging/log_system", vbox); | |
1350 | |
10272 | 1351 box = gaim_gtk_prefs_checkbox(_("Log when buddies log in/log _out"), |
8573 | 1352 "/core/logging/log_signon_signoff", vbox); |
1353 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1354 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1355 gtk_widget_set_sensitive(box, syslog_enabled); | |
1356 | |
1357 box = gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), | |
1358 "/core/logging/log_idle_state", vbox); | |
1359 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1360 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1361 gtk_widget_set_sensitive(box, syslog_enabled); | |
1362 | |
1363 box = gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), | |
1364 "/core/logging/log_away_state", vbox); | |
1365 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1366 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1367 gtk_widget_set_sensitive(box, syslog_enabled); | |
1368 | |
10272 | 1369 box = gaim_gtk_prefs_checkbox(_("Log your own _signons/idleness/awayness"), |
8573 | 1370 "/core/logging/log_own_states", vbox); |
1371 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1372 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1373 gtk_widget_set_sensitive(box, syslog_enabled); | |
1374 | |
5440 | 1375 gtk_widget_show_all(ret); |
1376 return ret; | |
1377 } | |
1378 | |
1379 #ifndef _WIN32 | |
1380 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1381 { | |
5684 | 1382 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1383 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1384 return TRUE; |
1385 } | |
6005 | 1386 |
1387 static void | |
10074 | 1388 sound_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
6005 | 1389 gpointer data) |
1390 { | |
1391 GtkWidget *hbox = data; | |
1392 const char *method = value; | |
1393 | |
1394 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1395 } | |
10074 | 1396 |
1397 static void | |
1398 sound_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
1399 gpointer data) | |
1400 { | |
1401 GtkWidget *vbox = data; | |
1402 const char *method = value; | |
1403 | |
1404 gtk_widget_set_sensitive(vbox, strcmp(method, "none")); | |
1405 } | |
5440 | 1406 #endif |
1407 | |
9150 | 1408 |
1409 static void | |
1410 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1411 { | |
1412 GtkTreeModel *model = (GtkTreeModel *)data; | |
1413 GtkTreeIter iter; | |
1414 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1415 const char *pref; | |
1416 | |
1417 gtk_tree_model_get_iter (model, &iter, path); | |
1418 gtk_tree_model_get (model, &iter, | |
1419 2, &pref, | |
1420 -1); | |
1421 | |
1422 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1423 | |
1424 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1425 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1426 -1); | |
1427 | |
1428 gtk_tree_path_free(path); | |
1429 } | |
1430 | |
1431 static void | |
1432 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1433 { | |
1434 char *pref; | |
1435 gboolean temp_value1, temp_value2; | |
1436 | |
1437 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1438 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1439 | |
1440 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1441 temp_value2 = gaim_prefs_get_bool(pref); | |
1442 | |
1443 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1444 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1445 | |
1446 gaim_sound_play_event(sound_row_sel); | |
1447 | |
1448 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1449 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1450 | |
1451 g_free(pref); | |
1452 } | |
1453 | |
9508 | 1454 /* |
1455 * Resets a sound file back to default. | |
1456 */ | |
9150 | 1457 static void |
1458 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1459 { | |
9508 | 1460 gchar *pref; |
1461 | |
1462 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1463 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
9150 | 1464 gaim_prefs_set_string(pref, ""); |
1465 g_free(pref); | |
1466 | |
1467 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1468 } | |
1469 | |
9508 | 1470 static void |
1471 sound_chosen_cb(void *user_data, const char *filename) | |
9150 | 1472 { |
9508 | 1473 gchar *pref; |
1474 int sound; | |
1475 | |
1476 sound = GPOINTER_TO_INT(user_data); | |
9150 | 1477 |
1478 /* Set it -- and forget it */ | |
1479 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
9508 | 1480 gaim_gtk_sound_get_event_option(sound)); |
1481 gaim_prefs_set_string(pref, filename); | |
9150 | 1482 g_free(pref); |
1483 | |
9508 | 1484 /* |
1485 * If the sound we just changed is still the currently selected | |
1486 * sound, then update the box showing the file name. | |
1487 */ | |
1488 if (sound == sound_row_sel) | |
1489 gtk_entry_set_text(GTK_ENTRY(sound_entry), filename); | |
9150 | 1490 } |
1491 | |
9508 | 1492 static void select_sound(GtkWidget *button, gpointer being_NULL_is_fun) |
9150 | 1493 { |
9508 | 1494 gchar *pref; |
1495 const char *filename; | |
1496 | |
1497 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1498 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1499 filename = gaim_prefs_get_string(pref); | |
1500 g_free(pref); | |
1501 | |
1502 if (*filename == '\0') | |
1503 filename = NULL; | |
1504 | |
1505 gaim_request_file(prefs, _("Sound Selection"), filename, FALSE, | |
1506 G_CALLBACK(sound_chosen_cb), NULL, GINT_TO_POINTER(sound_row_sel)); | |
9150 | 1507 } |
1508 | |
9508 | 1509 static void prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) { |
9150 | 1510 GtkTreeIter iter; |
1511 GValue val = { 0, }; | |
1512 const char *file; | |
1513 char *pref; | |
1514 | |
1515 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1516 return; | |
1517 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1518 sound_row_sel = g_value_get_uint(&val); | |
1519 | |
1520 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1521 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1522 file = gaim_prefs_get_string(pref); | |
1523 g_free(pref); | |
1524 if (sound_entry) | |
1525 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1526 g_value_unset (&val); | |
1527 } | |
1528 | |
5440 | 1529 GtkWidget *sound_page() { |
1530 GtkWidget *ret; | |
9150 | 1531 GtkWidget *vbox, *sw, *button; |
5440 | 1532 GtkSizeGroup *sg; |
9150 | 1533 GtkTreeIter iter; |
1534 GtkWidget *event_view; | |
1535 GtkListStore *event_store; | |
1536 GtkCellRenderer *rend; | |
1537 GtkTreeViewColumn *col; | |
1538 GtkTreeSelection *sel; | |
1539 GtkTreePath *path; | |
1540 GtkWidget *hbox; | |
1541 int j; | |
1542 const char *file; | |
1543 char *pref; | |
5440 | 1544 #ifndef _WIN32 |
1545 GtkWidget *dd; | |
1546 GtkWidget *label; | |
6007 | 1547 GtkWidget *entry; |
5684 | 1548 const char *cmd; |
5440 | 1549 #endif |
1550 | |
1551 ret = gtk_vbox_new(FALSE, 18); | |
1552 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1553 | |
1554 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1555 | |
1556 #ifndef _WIN32 | |
6033 | 1557 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1558 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1559 "/gaim/gtk/sound/method", | |
1560 _("Console beep"), "beep", | |
5440 | 1561 #ifdef USE_AO |
7987 | 1562 _("Automatic"), "automatic", |
1563 "ESD", "esd", | |
1564 "Arts", "arts", | |
5440 | 1565 #endif |
1566 #ifdef USE_NAS_AUDIO | |
7987 | 1567 "NAS", "nas", |
5440 | 1568 #endif |
7987 | 1569 _("Command"), "custom", |
10074 | 1570 _("No sounds"), "none", |
7987 | 1571 NULL); |
5440 | 1572 gtk_size_group_add_widget(sg, dd); |
1573 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1574 | |
1575 hbox = gtk_hbox_new(FALSE, 5); | |
1576 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1577 | |
6031 | 1578 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1579 gtk_size_group_add_widget(sg, label); |
1580 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1581 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1582 | |
6007 | 1583 entry = gtk_entry_new(); |
1584 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1585 | |
1586 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1587 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1588 if(cmd) |
6007 | 1589 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1590 gtk_widget_set_size_request(entry, 75, -1); | |
1591 | |
1592 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1593 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1594 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1595 |
1596 gtk_widget_set_sensitive(hbox, | |
1597 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1598 "custom")); | |
10087 | 1599 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1600 sound_changed1_cb, hbox); | |
6005 | 1601 |
8141 | 1602 gaim_set_accessible_label (entry, label); |
5440 | 1603 #endif /* _WIN32 */ |
9150 | 1604 |
10074 | 1605 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
1606 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"), | |
1607 "/gaim/gtk/sound/conv_focus", vbox); | |
1608 gaim_gtk_prefs_checkbox(_("_Sounds while away"), | |
1609 "/core/sound/while_away", vbox); | |
1610 | |
10075 | 1611 #ifndef _WIN32 |
10074 | 1612 gtk_widget_set_sensitive(vbox, |
1613 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1614 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1615 sound_changed2_cb, vbox); | |
10075 | 1616 #endif |
10074 | 1617 |
9150 | 1618 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); |
1619 | |
1620 /* The following is an ugly hack to make the frame expand so the | |
1621 * sound events list is big enough to be usable */ | |
1622 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1623 GTK_PACK_START); | |
1624 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1625 TRUE, 0, GTK_PACK_START); | |
1626 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1627 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1628 | |
1629 sw = gtk_scrolled_window_new(NULL,NULL); | |
1630 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1631 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1632 | |
1633 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1634 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1635 | |
1636 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1637 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1638 gaim_gtk_sound_get_event_option(j)); | |
1639 const char *label = gaim_gtk_sound_get_event_label(j); | |
1640 | |
1641 if (label == NULL) { | |
1642 g_free(pref); | |
1643 continue; | |
1644 } | |
1645 | |
1646 gtk_list_store_append (event_store, &iter); | |
1647 gtk_list_store_set(event_store, &iter, | |
1648 0, gaim_prefs_get_bool(pref), | |
1649 1, _(label), | |
1650 2, pref, | |
1651 3, j, | |
1652 -1); | |
1653 g_free(pref); | |
1654 } | |
1655 | |
1656 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1657 | |
1658 rend = gtk_cell_renderer_toggle_new(); | |
1659 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1660 g_signal_connect (G_OBJECT (sel), "changed", | |
1661 G_CALLBACK (prefs_sound_sel), | |
1662 NULL); | |
1663 g_signal_connect (G_OBJECT(rend), "toggled", | |
1664 G_CALLBACK(event_toggled), event_store); | |
1665 path = gtk_tree_path_new_first(); | |
1666 gtk_tree_selection_select_path(sel, path); | |
1667 gtk_tree_path_free(path); | |
1668 | |
1669 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1670 rend, | |
1671 "active", 0, | |
1672 NULL); | |
1673 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1674 | |
1675 rend = gtk_cell_renderer_text_new(); | |
1676 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1677 rend, | |
1678 "text", 1, | |
1679 NULL); | |
1680 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1681 g_object_unref(G_OBJECT(event_store)); | |
1682 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1683 | |
1684 hbox = gtk_hbox_new(FALSE, 6); | |
1685 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1686 sound_entry = gtk_entry_new(); | |
1687 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1688 gaim_gtk_sound_get_event_option(0)); | |
1689 file = gaim_prefs_get_string(pref); | |
1690 g_free(pref); | |
1691 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1692 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1693 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1694 | |
1695 button = gtk_button_new_with_label(_("Test")); | |
1696 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1697 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1698 | |
1699 button = gtk_button_new_with_label(_("Reset")); | |
1700 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1701 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1702 | |
1703 button = gtk_button_new_with_label(_("Choose...")); | |
9508 | 1704 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); |
9150 | 1705 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); |
5440 | 1706 gtk_widget_show_all(ret); |
9118 | 1707 |
10075 | 1708 #ifndef _WIN32 |
10074 | 1709 gtk_widget_set_sensitive(vbox, |
1710 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1711 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1712 sound_changed2_cb, vbox); | |
10075 | 1713 #endif |
10074 | 1714 |
5440 | 1715 return ret; |
1716 } | |
1717 | |
10182 | 1718 /* XXX CORE/UI */ |
1719 #if 0 | |
1720 static void | |
1721 set_default_away(GtkWidget *w, gpointer data) | |
1722 { | |
1723 struct away_message *default_away = NULL; | |
1724 int length = g_slist_length(away_messages); | |
1725 int i = GPOINTER_TO_INT(data); | |
1726 | |
1727 if (away_messages == NULL) | |
1728 default_away = NULL; | |
1729 else if (i >= length) | |
1730 default_away = g_slist_nth_data(away_messages, length - 1); | |
1731 else | |
1732 default_away = g_slist_nth_data(away_messages, i); | |
1733 | |
1734 if(default_away) | |
1735 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
1736 else | |
1737 gaim_prefs_set_string("/core/away/default_message", ""); | |
1738 } | |
1739 #endif | |
1740 | |
5440 | 1741 GtkWidget *away_page() { |
1742 GtkWidget *ret; | |
1743 GtkWidget *vbox; | |
1744 GtkWidget *hbox; | |
1745 GtkWidget *label; | |
1746 GtkWidget *button; | |
1747 GtkWidget *select; | |
1748 GtkWidget *dd; | |
1749 GtkSizeGroup *sg; | |
1750 | |
1751 ret = gtk_vbox_new(FALSE, 18); | |
1752 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1753 | |
1754 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1755 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1756 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1757 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1758 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1759 |
9596 | 1760 label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), |
1761 GAIM_PREF_STRING, "/core/away/auto_reply", | |
1762 _("Never"), "never", | |
9736 | 1763 _("When away"), "away", |
10650 | 1764 _("if (away && idle)"), "awayidle", |
9596 | 1765 NULL); |
6142 | 1766 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1767 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1768 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1769 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1770 _("None"), "none", | |
1771 _("Gaim usage"), "gaim", | |
5440 | 1772 #ifdef USE_SCREENSAVER |
1773 #ifndef _WIN32 | |
7987 | 1774 _("X usage"), "system", |
5440 | 1775 #else |
7987 | 1776 _("Windows usage"), "system", |
5440 | 1777 #endif |
1778 #endif | |
7987 | 1779 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1780 |
5440 | 1781 gtk_size_group_add_widget(sg, dd); |
1782 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1783 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1784 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1785 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1786 "/core/away/away_when_idle", vbox); |
8238 | 1787 |
7987 | 1788 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1789 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1790 1, 24 * 60, sg); | |
5440 | 1791 g_signal_connect(G_OBJECT(button), "clicked", |
1792 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1793 | |
8238 | 1794 hbox = gtk_hbox_new(FALSE, 0); |
1795 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1796 | |
5440 | 1797 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); |
1798 gtk_size_group_add_widget(sg, label); | |
1799 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
8238 | 1800 g_signal_connect(G_OBJECT(button), "clicked", |
1801 G_CALLBACK(gaim_gtk_toggle_sensitive), label); | |
5440 | 1802 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
8238 | 1803 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1804 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1805 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
8238 | 1806 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1807 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1808 |
5440 | 1809 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1810 |
5440 | 1811 return ret; |
1812 } | |
1813 | |
1814 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1815 | |
1816 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1817 { | |
1818 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1819 GtkTreeIter iter; | |
1820 GValue val = { 0, }; | |
1821 GaimPlugin *plug; | |
1822 | |
1823 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1824 return; | |
8104 | 1825 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1826 plug = g_value_get_pointer(&val); |
8998 | 1827 |
5440 | 1828 pname = g_markup_escape_text(_(plug->info->name), -1); |
9307 | 1829 pdesc = (plug->info->description) ? |
1830 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1831 pauth = (plug->info->author) ? | |
1832 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1833 pweb = (plug->info->homepage) ? | |
1834 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1835 | |
5440 | 1836 if (plug->error != NULL) { |
1837 perr = g_markup_escape_text(_(plug->error), -1); | |
1838 buf = g_strdup_printf( | |
1839 "<span size=\"larger\">%s %s</span>\n\n" | |
1840 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1841 "%s", | |
10386 | 1842 pname, plug->info->version, perr, pdesc ? pdesc : ""); |
5440 | 1843 g_free(perr); |
1844 } | |
1845 else { | |
1846 buf = g_strdup_printf( | |
1847 "<span size=\"larger\">%s %s</span>\n\n%s", | |
10386 | 1848 pname, plug->info->version, pdesc ? pdesc : ""); |
5440 | 1849 } |
1850 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1851 g_free(buf); | |
1852 | |
1853 buf = g_strdup_printf( | |
1854 #ifndef _WIN32 | |
1855 _("<span size=\"larger\">%s %s</span>\n\n" | |
1856 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1857 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1858 "<span weight=\"bold\">File name:</span>\t%s"), | |
1859 #else | |
1860 _("<span size=\"larger\">%s %s</span>\n\n" | |
1861 "<span weight=\"bold\">Written by:</span> %s\n" | |
1862 "<span weight=\"bold\">URL:</span> %s\n" | |
1863 "<span weight=\"bold\">File name:</span> %s"), | |
1864 #endif | |
10386 | 1865 pname, plug->info->version, pauth ? pauth : "", pweb ? pweb : "", plug->path); |
5440 | 1866 |
1867 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1868 g_value_unset(&val); | |
1869 g_free(buf); | |
1870 g_free(pname); | |
1871 g_free(pdesc); | |
1872 g_free(pauth); | |
1873 g_free(pweb); | |
1874 } | |
1875 | |
1876 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1877 { | |
1878 GtkTreeModel *model = (GtkTreeModel *)data; | |
1879 GtkTreeIter iter; | |
1880 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1881 GaimPlugin *plug; | |
1882 gchar buf[1024]; | |
6040 | 1883 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1884 |
5440 | 1885 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1886 gdk_window_set_cursor(prefs->window, wait); | |
1887 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1888 |
5440 | 1889 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1890 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1891 |
5440 | 1892 if (!gaim_plugin_is_loaded(plug)) { |
1893 gaim_plugin_load(plug); | |
10759 | 1894 add_plugin_prefs(plug); |
5440 | 1895 } |
1896 else { | |
10759 | 1897 delete_plugin_prefs(plug); |
5440 | 1898 gaim_plugin_unload(plug); |
1899 } | |
1900 | |
1901 gdk_window_set_cursor(prefs->window, NULL); | |
1902 | |
6040 | 1903 name = g_markup_escape_text(_(plug->info->name), -1); |
1904 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 1905 if (plug->error != NULL) { |
6040 | 1906 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 1907 g_snprintf(buf, sizeof(buf), |
1908 "<span size=\"larger\">%s %s</span>\n\n" | |
1909 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1910 "%s", | |
6040 | 1911 name, plug->info->version, error, description); |
1912 g_free(error); | |
1913 } else { | |
5440 | 1914 g_snprintf(buf, sizeof(buf), |
1915 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 1916 name, plug->info->version, description); |
5440 | 1917 } |
6040 | 1918 g_free(name); |
1919 g_free(description); | |
5440 | 1920 |
1921 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1922 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1923 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1924 |
5440 | 1925 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1926 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1927 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1928 gaim_gtk_plugins_save(); |
5440 | 1929 } |
1930 | |
1931 static void | |
1932 update_plugin_list(void *data) | |
1933 { | |
1934 GtkListStore *ls = GTK_LIST_STORE(data); | |
1935 GtkTreeIter iter; | |
1936 GList *probes; | |
1937 GaimPlugin *plug; | |
1938 | |
1939 gtk_list_store_clear(ls); | |
1940 | |
1941 for (probes = gaim_plugins_get_all(); | |
1942 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1943 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1944 { |
5440 | 1945 plug = probes->data; |
1946 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1947 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
1948 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1949 { |
5440 | 1950 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1951 } |
5440 | 1952 |
1953 gtk_list_store_append (ls, &iter); | |
1954 gtk_list_store_set(ls, &iter, | |
1955 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1956 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 1957 2, _(plug->info->summary), |
8104 | 1958 3, plug, -1); |
5440 | 1959 } |
1960 } | |
1961 | |
1962 static GtkWidget *plugin_page () | |
1963 { | |
1964 GtkWidget *ret; | |
1965 GtkWidget *sw, *vp; | |
1966 GtkWidget *event_view; | |
1967 GtkListStore *ls; | |
1968 GtkCellRenderer *rend, *rendt; | |
1969 GtkTreeViewColumn *col; | |
1970 GtkTreeSelection *sel; | |
1971 GtkTreePath *path; | |
1972 GtkWidget *nb; | |
1973 | |
1974 ret = gtk_vbox_new(FALSE, 18); | |
1975 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1976 | |
1977 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 1978 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 1979 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
1980 | |
1981 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
1982 | |
8104 | 1983 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 1984 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
1985 1, GTK_SORT_ASCENDING); | |
5440 | 1986 |
1987 update_plugin_list(ls); | |
1988 | |
1989 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
1990 | |
1991 rend = gtk_cell_renderer_toggle_new(); | |
1992 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1993 | |
1994 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
1995 rend, | |
1996 "active", 0, | |
1997 NULL); | |
1998 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1999 | |
2000 rendt = gtk_cell_renderer_text_new(); | |
2001 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2002 rendt, | |
2003 "text", 1, | |
2004 NULL); | |
2005 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8998 | 2006 |
8104 | 2007 rendt = gtk_cell_renderer_text_new(); |
2008 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2009 rendt, | |
2010 "text", 2, | |
2011 NULL); | |
2012 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
8998 | 2013 |
5440 | 2014 g_object_unref(G_OBJECT(ls)); |
2015 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
8998 | 2016 |
5440 | 2017 |
2018 nb = gtk_notebook_new(); | |
2019 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2020 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
8998 | 2021 |
5440 | 2022 /* Description */ |
2023 sw = gtk_scrolled_window_new(NULL, NULL); | |
2024 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2025 plugin_description = gtk_label_new(NULL); | |
8998 | 2026 |
5440 | 2027 vp = gtk_viewport_new(NULL, NULL); |
2028 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2029 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2030 | |
2031 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
2032 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2033 | |
8998 | 2034 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); |
5440 | 2035 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); |
2036 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
2037 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
2038 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
2039 | |
2040 /* Details */ | |
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_details = 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_details); | |
2050 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2051 | |
8998 | 2052 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); |
5440 | 2053 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
2054 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
8998 | 2055 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); |
5440 | 2056 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); |
2057 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2058 | |
2059 g_signal_connect (G_OBJECT (sel), "changed", | |
2060 G_CALLBACK (prefs_plugin_sel), | |
8998 | 2061 NULL); |
5440 | 2062 g_signal_connect (G_OBJECT(rend), "toggled", |
2063 G_CALLBACK(plugin_load), ls); | |
2064 | |
2065 path = gtk_tree_path_new_first(); | |
2066 gtk_tree_selection_select_path(sel, path); | |
2067 gtk_tree_path_free(path); | |
2068 | |
2069 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2070 | |
2071 gtk_widget_show_all(ret); | |
2072 return ret; | |
2073 } | |
2074 | |
10759 | 2075 int prefs_notebook_add_page(const char *text, |
5440 | 2076 GdkPixbuf *pixbuf, |
2077 GtkWidget *page, | |
2078 GtkTreeIter *iter, | |
2079 GtkTreeIter *parent, | |
2080 int ind) { | |
2081 GdkPixbuf *icon = NULL; | |
2082 | |
2083 if (pixbuf) | |
2084 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2085 | |
2086 if (pixbuf) | |
2087 g_object_unref(pixbuf); | |
2088 if (icon) | |
2089 g_object_unref(icon); | |
10759 | 2090 |
2091 return gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
5440 | 2092 } |
2093 | |
2094 void prefs_notebook_init() { | |
9267 | 2095 GtkTreeIter p, c, c2; |
5440 | 2096 GList *l; |
2097 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
9150 | 2098 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
9267 | 2099 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c2, &c, notebook_page++); |
2100 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | |
9150 | 2101 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
8238 | 2102 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
5440 | 2103 #ifndef _WIN32 |
2104 /* We use the registered default browser in windows */ | |
10060 | 2105 /* if the user is running gnome 2.x, hide the browsers tab */ |
10061 | 2106 if (gaim_running_gnome() == FALSE) { |
10060 | 2107 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2108 } | |
5440 | 2109 #endif |
2110 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2111 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2112 | |
2113 if (gaim_plugins_enabled()) { | |
2114 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2115 | |
2116 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
10759 | 2117 add_plugin_prefs(l->data); |
5440 | 2118 } |
2119 } | |
2120 } | |
2121 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2122 void gaim_gtk_prefs_show(void) |
5440 | 2123 { |
10078 | 2124 GtkWidget *vbox; |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2125 GtkWidget *bbox; |
5440 | 2126 GtkWidget *notebook; |
2127 GtkWidget *button; | |
2128 | |
2129 if (prefs) { | |
2130 gtk_window_present(GTK_WINDOW(prefs)); | |
2131 return; | |
2132 } | |
2133 | |
2134 /* copy the preferences to tmp values... | |
2135 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2136 /* (that should have been "effect," right?) */ |
2137 | |
5440 | 2138 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2139 | |
2140 /* Create the window */ | |
2141 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2142 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2143 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2144 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2145 gtk_container_set_border_width(GTK_CONTAINER(prefs), 12); |
5440 | 2146 g_signal_connect(G_OBJECT(prefs), "destroy", |
2147 G_CALLBACK(delete_prefs), NULL); | |
2148 | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2149 vbox = gtk_vbox_new(FALSE, 12); |
5440 | 2150 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
2151 gtk_widget_show(vbox); | |
2152 | |
2153 /* The notebook */ | |
2154 prefsnotebook = notebook = gtk_notebook_new (); | |
10078 | 2155 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE); |
5440 | 2156 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); |
10078 | 2157 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
2158 | |
5440 | 2159 |
8713 | 2160 /* The buttons to press! */ |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2161 bbox = gtk_hbutton_box_new(); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2162 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2163 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
|
2164 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2165 gtk_widget_show (bbox); |
5440 | 2166 |
2167 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2168 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2169 G_CALLBACK(gtk_widget_destroy), prefs); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2170 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5440 | 2171 gtk_widget_show(button); |
2172 | |
2173 prefs_notebook_init(); | |
2174 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2175 /* Show everything. */ |
10078 | 2176 gtk_widget_show_all(prefs); |
5440 | 2177 } |
2178 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2179 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2180 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2181 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2182 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2183 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2184 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2185 |
7976 | 2186 GtkWidget * |
7987 | 2187 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2188 { |
2189 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2190 |
5440 | 2191 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2192 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2193 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2194 |
5440 | 2195 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
|
2196 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2197 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2198 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2199 |
5440 | 2200 gtk_widget_show(button); |
2201 | |
2202 return button; | |
2203 } | |
2204 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2205 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2206 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2207 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2208 { |
5841 | 2209 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2210 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2211 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2212 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2213 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2214 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2215 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2216 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2217 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2218 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2219 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2220 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2221 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2222 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2223 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2224 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2225 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2226 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2227 |
8283 | 2228 #ifndef _WIN32 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2229 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2230 gaim_prefs_add_none("/gaim/gtk/browsers"); |
8272 | 2231 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
|
2232 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2233 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
8283 | 2234 #endif |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2235 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2236 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2237 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2238 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2239 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2240 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2241 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2242 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2243 |
10605 | 2244 /* File locations */ |
2245 gaim_prefs_add_none("/gaim/gtk/filelocations"); | |
2246 gaim_prefs_add_string("/gaim/gtk/filelocations/last_save_folder", ""); | |
2247 gaim_prefs_add_string("/gaim/gtk/filelocations/last_open_folder", ""); | |
2248 gaim_prefs_add_string("/gaim/gtk/filelocations/last_icon_folder", ""); | |
2249 | |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2250 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2251 gaim_prefs_add_none("/gaim/gtk/smileys"); |
9707 | 2252 gaim_prefs_add_string("/gaim/gtk/smileys/theme", "default"); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2253 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2254 /* Smiley Callbacks */ |
10087 | 2255 gaim_prefs_connect_callback(prefs, "/gaim/gtk/smileys/theme", |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2256 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2257 } |
8905 | 2258 |
2259 void gaim_gtk_prefs_update_old() { | |
2260 /* Rename some old prefs */ | |
2261 gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); | |
2262 gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); | |
2263 gaim_prefs_rename("/core/conversations/placement", | |
8998 | 2264 "/gaim/gtk/conversations/placement"); |
8905 | 2265 |
9025 | 2266 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2267 "/gaim/gtk/conversations/send_formatting"); | |
2268 | |
10307 | 2269 gaim_prefs_rename("/gaim/gtk/debug/timestamps", "/core/debug/timestamps"); |
10488 | 2270 gaim_prefs_rename("/gaim/gtk/conversations/ignore_colors", "/gaim/gtk/conversations/ignore_formatting"); |
10701 | 2271 gaim_prefs_rename("/gaim/gtk/conversations/im/raise_on_events", "/plugins/gtk/X11/notify/method_raise"); |
10307 | 2272 |
8905 | 2273 /* Remove some no-longer-used prefs */ |
10398 | 2274 gaim_prefs_remove("/gaim/gtk/blist/auto_expand_contacts"); |
10133 | 2275 gaim_prefs_remove("/gaim/gtk/blist/button_style"); |
10168 | 2276 gaim_prefs_remove("/gaim/gtk/blist/grey_idle_buddies"); |
10133 | 2277 gaim_prefs_remove("/gaim/gtk/blist/raise_on_events"); |
8945 | 2278 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
10353 | 2279 gaim_prefs_remove("/gaim/gtk/blist/show_idle_time"); |
2280 gaim_prefs_remove("/gaim/gtk/blist/show_warning_level"); | |
10358 | 2281 gaim_prefs_remove("/gaim/gtk/conversations/button_type"); |
10398 | 2282 gaim_prefs_remove("/gaim/gtk/conversations/ctrl_enter_sends"); |
2283 gaim_prefs_remove("/gaim/gtk/conversations/enter_sends"); | |
10164 | 2284 gaim_prefs_remove("/gaim/gtk/conversations/html_shortcuts"); |
8946 | 2285 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
10398 | 2286 gaim_prefs_remove("/gaim/gtk/conversations/show_smileys"); |
2287 gaim_prefs_remove("/gaim/gtk/conversations/show_timestamps"); | |
8905 | 2288 gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links"); |
10164 | 2289 gaim_prefs_remove("/gaim/gtk/conversations/smiley_shortcuts"); |
9025 | 2290 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor"); |
2291 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor"); | |
2292 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size"); | |
10398 | 2293 gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete"); |
2294 gaim_prefs_remove("/gaim/gtk/conversations/chat/tab_completion"); | |
9301 | 2295 gaim_prefs_remove("/gaim/gtk/conversations/im/hide_on_send"); |
10398 | 2296 gaim_prefs_remove("/gaim/gtk/conversations/chat/color_nicks"); |
2297 gaim_prefs_remove("/gaim/gtk/conversations/chat/raise_on_events"); | |
10492 | 2298 gaim_prefs_remove("/gaim/gtk/conversations/ignore_fonts"); |
2299 gaim_prefs_remove("/gaim/gtk/conversations/ignore_font_sizes"); | |
10398 | 2300 gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); |
2301 gaim_prefs_remove("/gaim/gtk/sound/signon"); | |
2302 gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); | |
10489 | 2303 gaim_prefs_remove("/gaim/gtk/conversations/escape_closes"); |
8905 | 2304 } |