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