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