Mercurial > pidgin
annotate src/gtkprefs.c @ 10358:524674a4f6bb
[gaim-migrate @ 11576]
N/C
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 13 Dec 2004 06:29:45 +0000 |
parents | 393750603513 |
children | f608b72a7611 |
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); |
9301 | 902 gaim_gtk_prefs_checkbox(_("_Raise IM window on events"), |
903 "/gaim/gtk/conversations/im/raise_on_events", vbox); | |
904 | |
9303 | 905 gaim_gtk_prefs_checkbox(_("Raise chat _window on events"), |
9301 | 906 "/gaim/gtk/conversations/chat/raise_on_events", vbox); |
9155 | 907 |
908 /* All the tab options! */ | |
909 vbox = gaim_gtk_make_frame(ret, _("Tab Options")); | |
910 | |
911 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
|
912 "/gaim/gtk/conversations/tabs", vbox); |
9155 | 913 |
914 /* | |
915 * Connect a signal to the above preference. When conversations are not | |
916 * shown in a tabbed window then all tabbing options should be disabled. | |
917 */ | |
918 vbox2 = gtk_vbox_new(FALSE, 0); | |
919 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); | |
10087 | 920 gaim_prefs_connect_callback(prefs, "/gaim/gtk/conversations/tabs", |
921 conversation_usetabs_cb, vbox2); | |
9155 | 922 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) |
923 gtk_widget_set_sensitive(vbox2, FALSE); | |
924 | |
9891 | 925 gaim_gtk_prefs_checkbox(_("Show close b_utton on tabs"), |
9155 | 926 "/gaim/gtk/conversations/close_on_tabs", vbox2); |
927 | |
928 label = gaim_gtk_prefs_dropdown(vbox2, _("Tab p_lacement:"), GAIM_PREF_INT, | |
8988 | 929 "/gaim/gtk/conversations/tab_side", |
930 _("Top"), GTK_POS_TOP, | |
931 _("Bottom"), GTK_POS_BOTTOM, | |
932 _("Left"), GTK_POS_LEFT, | |
933 _("Right"), GTK_POS_RIGHT, | |
934 NULL); | |
935 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
936 gtk_size_group_add_widget(sg, label); | |
937 | |
9155 | 938 names = gaim_conv_placement_get_options(); |
9251 | 939 label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"), |
9155 | 940 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
941 gtk_size_group_add_widget(sg, label); | |
942 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
943 g_list_free(names); | |
944 | |
5440 | 945 gtk_widget_show_all(ret); |
946 | |
947 return ret; | |
948 } | |
949 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
950 static void network_ip_changed(GtkEntry *entry, gpointer data) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
951 { |
8834 | 952 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
953 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
954 |
9150 | 955 static void |
956 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
957 gpointer data) | |
958 { | |
959 GtkWidget *frame = data; | |
960 const char *proxy = value; | |
961 | |
962 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | |
963 gtk_widget_set_sensitive(frame, TRUE); | |
964 else | |
965 gtk_widget_set_sensitive(frame, FALSE); | |
966 } | |
967 | |
968 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
969 { | |
970 if (entrynum == PROXYHOST) | |
971 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
972 else if (entrynum == PROXYPORT) | |
973 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
974 else if (entrynum == PROXYUSER) | |
975 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
976 else if (entrynum == PROXYPASS) | |
977 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
978 } | |
979 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
980 GtkWidget *network_page() { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
981 GtkWidget *ret; |
9150 | 982 GtkWidget *vbox, *hbox, *entry; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
983 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
984 GtkSizeGroup *sg; |
9150 | 985 GaimProxyInfo *proxy_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
986 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
987 ret = gtk_vbox_new(FALSE, 18); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
988 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
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 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
991 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
992 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
993 "/core/network/auto_ip", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
994 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
995 table = gtk_table_new(2, 1, FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
996 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
997 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
998 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
999 gtk_container_add(GTK_CONTAINER(vbox), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1000 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1001 label = gtk_label_new_with_mnemonic(_("Public _IP:")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1002 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1003 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
|
1004 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1005 entry = gtk_entry_new(); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1006 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1007 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
|
1008 g_signal_connect(G_OBJECT(entry), "changed", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1009 G_CALLBACK(network_ip_changed), NULL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1010 |
8834 | 1011 if (gaim_network_get_public_ip() != NULL) |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1012 gtk_entry_set_text(GTK_ENTRY(entry), |
8834 | 1013 gaim_network_get_public_ip()); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1014 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1015 gaim_set_accessible_label (entry, label); |
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 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1018 if (gaim_prefs_get_bool("/core/network/auto_ip")) { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1019 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1020 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1021 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1022 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1023 G_CALLBACK(gaim_gtk_toggle_sensitive), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1024 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1025 vbox = gaim_gtk_make_frame (ret, _("Ports")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1026 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1027 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1028 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
|
1029 "/core/network/ports_range_use", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1030 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1031 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1032 "/core/network/ports_range_start", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1033 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1034 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1035 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1036 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1037 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1038 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1039 "/core/network/ports_range_end", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1040 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1041 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1042 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1043 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1044 |
9150 | 1045 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
1046 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
7987 | 1047 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
9150 | 1048 "/core/proxy/type", |
1049 _("No proxy"), "none", | |
1050 "SOCKS 4", "socks4", | |
1051 "SOCKS 5", "socks5", | |
1052 "HTTP", "http", | |
1053 _("Use Environmental Settings"), "envvar", | |
1054 NULL); | |
1055 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
|
1056 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1057 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1058 if (proxy_info == NULL || |
6621 | 1059 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1060 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
|
1061 |
6001 | 1062 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1063 } |
10087 | 1064 gaim_prefs_connect_callback(prefs, "/core/proxy/type", |
1065 proxy_changed_cb, prefs_proxy_frame); | |
9150 | 1066 |
1067 table = gtk_table_new(4, 2, FALSE); | |
5440 | 1068 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1069 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1070 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
9150 | 1071 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); |
5440 | 1072 |
1073 | |
7797 | 1074 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1075 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1076 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1077 | |
1078 entry = gtk_entry_new(); | |
1079 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1080 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1081 g_signal_connect(G_OBJECT(entry), "changed", | |
1082 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1083 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1084 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1085 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1086 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1087 |
1088 hbox = gtk_hbox_new(TRUE, 5); | |
1089 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1090 gaim_set_accessible_label (entry, label); |
5440 | 1091 |
7870 | 1092 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1093 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1094 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1095 |
1096 entry = gtk_entry_new(); | |
1097 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1098 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1099 g_signal_connect(G_OBJECT(entry), "changed", |
1100 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1101 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1102 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1103 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1104 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1105 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1106 |
5440 | 1107 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1108 } | |
8137 | 1109 gaim_set_accessible_label (entry, label); |
5440 | 1110 |
7797 | 1111 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1112 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1113 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1114 |
1115 entry = gtk_entry_new(); | |
1116 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1117 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1118 g_signal_connect(G_OBJECT(entry), "changed", |
1119 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1120 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1121 if (proxy_info != NULL && gaim_proxy_info_get_username(proxy_info) != NULL) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1122 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1123 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1124 |
1125 hbox = gtk_hbox_new(TRUE, 5); | |
1126 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1127 gaim_set_accessible_label (entry, label); |
5440 | 1128 |
7797 | 1129 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1130 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1131 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1132 |
1133 entry = gtk_entry_new(); | |
1134 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1135 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
5440 | 1136 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1137 g_signal_connect(G_OBJECT(entry), "changed", | |
1138 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1139 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1140 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
|
1141 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1142 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1143 gaim_set_accessible_label (entry, label); |
5440 | 1144 |
1145 gtk_widget_show_all(ret); | |
1146 return ret; | |
1147 } | |
1148 | |
1149 #ifndef _WIN32 | |
1150 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1151 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1152 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1153 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1154 |
1155 /* carry on normally */ | |
1156 return FALSE; | |
1157 } | |
1158 | |
5633 | 1159 static GList *get_available_browsers() |
5440 | 1160 { |
1161 struct browser { | |
1162 char *name; | |
1163 char *command; | |
1164 }; | |
1165 | |
1166 static struct browser possible_browsers[] = { | |
9405 | 1167 {N_("Epiphany"), "epiphany"}, |
8267 | 1168 {N_("Firebird"), "mozilla-firebird"}, |
8356 | 1169 {N_("Firefox"), "firefox"}, |
9405 | 1170 {N_("Galeon"), "galeon"}, |
1171 {N_("Gnome Default"), "gnome-open"}, | |
1172 {N_("Konqueror"), "kfmclient"}, | |
1173 {N_("Mozilla"), "mozilla"}, | |
1174 {N_("Netscape"), "netscape"}, | |
1175 {N_("Opera"), "opera"} | |
5440 | 1176 }; |
9405 | 1177 static const int num_possible_browsers = 9; |
5440 | 1178 |
1179 GList *browsers = NULL; | |
1180 int i = 0; | |
5819 | 1181 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1182 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1183 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1184 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1185 |
5440 | 1186 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1187 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1188 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1189 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1190 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1191 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1192 browser_setting = NULL; |
5440 | 1193 } |
1194 } | |
1195 | |
5819 | 1196 if(browser_setting) |
1197 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1198 | |
5440 | 1199 return browsers; |
1200 } | |
1201 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1202 static void |
8274 | 1203 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
1204 gpointer data) | |
1205 { | |
1206 GtkWidget *hbox = data; | |
1207 const char *browser = value; | |
1208 | |
1209 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom")); | |
1210 } | |
1211 | |
1212 static void | |
1213 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1214 gpointer data) |
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 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1217 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1218 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1219 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1220 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1221 |
5440 | 1222 GtkWidget *browser_page() { |
1223 GtkWidget *ret; | |
1224 GtkWidget *vbox; | |
1225 GtkWidget *hbox; | |
1226 GtkWidget *label; | |
6007 | 1227 GtkWidget *entry; |
5440 | 1228 GtkSizeGroup *sg; |
1229 GList *browsers = NULL; | |
1230 | |
1231 ret = gtk_vbox_new(FALSE, 18); | |
1232 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1233 | |
1234 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1235 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1236 |
1237 browsers = get_available_browsers(); | |
1238 if (browsers != NULL) { | |
7987 | 1239 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
|
1240 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1241 browsers); |
5440 | 1242 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1243 gtk_size_group_add_widget(sg, label); | |
8274 | 1244 |
1245 hbox = gtk_hbox_new(FALSE, 0); | |
1246 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT, | |
1247 "/gaim/gtk/browsers/place", | |
1248 _("Browser default"), GAIM_BROWSER_DEFAULT, | |
1249 _("Existing window"), GAIM_BROWSER_CURRENT, | |
1250 _("New window"), GAIM_BROWSER_NEW_WINDOW, | |
1251 _("New tab"), GAIM_BROWSER_NEW_TAB, | |
1252 NULL); | |
1253 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1254 gtk_size_group_add_widget(sg, label); | |
1255 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1256 | |
1257 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) | |
1258 gtk_widget_set_sensitive(hbox, FALSE); | |
10087 | 1259 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1260 browser_changed1_cb, hbox); | |
5440 | 1261 } |
1262 | |
1263 hbox = gtk_hbox_new(FALSE, 5); | |
1264 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1265 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1266 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1267 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1268 gtk_size_group_add_widget(sg, label); | |
1269 | |
6007 | 1270 entry = gtk_entry_new(); |
1271 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1272 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1273 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1274 gtk_widget_set_sensitive(hbox, FALSE); |
10087 | 1275 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1276 browser_changed2_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1277 |
6007 | 1278 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1279 | |
1280 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1281 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1282 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1283 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1284 gaim_set_accessible_label (entry, label); |
5440 | 1285 |
1286 gtk_widget_show_all(ret); | |
1287 return ret; | |
1288 } | |
1289 #endif /*_WIN32*/ | |
1290 | |
1291 GtkWidget *logging_page() { | |
1292 GtkWidget *ret; | |
1293 GtkWidget *vbox; | |
7431 | 1294 GList *names; |
8573 | 1295 GtkWidget *sys_box; |
1296 GtkWidget *box; | |
1297 int syslog_enabled = gaim_prefs_get_bool("/core/logging/log_system"); | |
1298 | |
5440 | 1299 ret = gtk_vbox_new(FALSE, 18); |
1300 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1301 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1302 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1303 names = gaim_log_logger_get_options(); |
1304 | |
7987 | 1305 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1306 "/core/logging/format", names); | |
1307 | |
1308 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1309 "/core/logging/log_ims", vbox); |
7987 | 1310 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1311 "/core/logging/log_chats", vbox); |
8573 | 1312 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1313 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
8573 | 1314 |
1315 sys_box = gaim_gtk_prefs_checkbox(_("_Enable system log"), | |
1316 "/core/logging/log_system", vbox); | |
1317 | |
10272 | 1318 box = gaim_gtk_prefs_checkbox(_("Log when buddies log in/log _out"), |
8573 | 1319 "/core/logging/log_signon_signoff", vbox); |
1320 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1321 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1322 gtk_widget_set_sensitive(box, syslog_enabled); | |
1323 | |
1324 box = gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), | |
1325 "/core/logging/log_idle_state", vbox); | |
1326 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1327 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1328 gtk_widget_set_sensitive(box, syslog_enabled); | |
1329 | |
1330 box = gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), | |
1331 "/core/logging/log_away_state", vbox); | |
1332 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1333 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1334 gtk_widget_set_sensitive(box, syslog_enabled); | |
1335 | |
10272 | 1336 box = gaim_gtk_prefs_checkbox(_("Log your own _signons/idleness/awayness"), |
8573 | 1337 "/core/logging/log_own_states", vbox); |
1338 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1339 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1340 gtk_widget_set_sensitive(box, syslog_enabled); | |
1341 | |
5440 | 1342 gtk_widget_show_all(ret); |
1343 return ret; | |
1344 } | |
1345 | |
1346 #ifndef _WIN32 | |
1347 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1348 { | |
5684 | 1349 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1350 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1351 return TRUE; |
1352 } | |
6005 | 1353 |
1354 static void | |
10074 | 1355 sound_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
6005 | 1356 gpointer data) |
1357 { | |
1358 GtkWidget *hbox = data; | |
1359 const char *method = value; | |
1360 | |
1361 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1362 } | |
10074 | 1363 |
1364 static void | |
1365 sound_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
1366 gpointer data) | |
1367 { | |
1368 GtkWidget *vbox = data; | |
1369 const char *method = value; | |
1370 | |
1371 gtk_widget_set_sensitive(vbox, strcmp(method, "none")); | |
1372 } | |
5440 | 1373 #endif |
1374 | |
9150 | 1375 |
1376 static void | |
1377 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1378 { | |
1379 GtkTreeModel *model = (GtkTreeModel *)data; | |
1380 GtkTreeIter iter; | |
1381 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1382 const char *pref; | |
1383 | |
1384 gtk_tree_model_get_iter (model, &iter, path); | |
1385 gtk_tree_model_get (model, &iter, | |
1386 2, &pref, | |
1387 -1); | |
1388 | |
1389 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1390 | |
1391 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1392 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1393 -1); | |
1394 | |
1395 gtk_tree_path_free(path); | |
1396 } | |
1397 | |
1398 static void | |
1399 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1400 { | |
1401 char *pref; | |
1402 gboolean temp_value1, temp_value2; | |
1403 | |
1404 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1405 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1406 | |
1407 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1408 temp_value2 = gaim_prefs_get_bool(pref); | |
1409 | |
1410 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1411 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1412 | |
1413 gaim_sound_play_event(sound_row_sel); | |
1414 | |
1415 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1416 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1417 | |
1418 g_free(pref); | |
1419 } | |
1420 | |
9508 | 1421 /* |
1422 * Resets a sound file back to default. | |
1423 */ | |
9150 | 1424 static void |
1425 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1426 { | |
9508 | 1427 gchar *pref; |
1428 | |
1429 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1430 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
9150 | 1431 gaim_prefs_set_string(pref, ""); |
1432 g_free(pref); | |
1433 | |
1434 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1435 } | |
1436 | |
9508 | 1437 static void |
1438 sound_chosen_cb(void *user_data, const char *filename) | |
9150 | 1439 { |
9508 | 1440 gchar *pref; |
1441 int sound; | |
1442 | |
1443 sound = GPOINTER_TO_INT(user_data); | |
9150 | 1444 |
1445 /* Set it -- and forget it */ | |
1446 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
9508 | 1447 gaim_gtk_sound_get_event_option(sound)); |
1448 gaim_prefs_set_string(pref, filename); | |
9150 | 1449 g_free(pref); |
1450 | |
9508 | 1451 /* |
1452 * If the sound we just changed is still the currently selected | |
1453 * sound, then update the box showing the file name. | |
1454 */ | |
1455 if (sound == sound_row_sel) | |
1456 gtk_entry_set_text(GTK_ENTRY(sound_entry), filename); | |
9150 | 1457 } |
1458 | |
9508 | 1459 static void select_sound(GtkWidget *button, gpointer being_NULL_is_fun) |
9150 | 1460 { |
9508 | 1461 gchar *pref; |
1462 const char *filename; | |
1463 | |
1464 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1465 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1466 filename = gaim_prefs_get_string(pref); | |
1467 g_free(pref); | |
1468 | |
1469 if (*filename == '\0') | |
1470 filename = NULL; | |
1471 | |
1472 gaim_request_file(prefs, _("Sound Selection"), filename, FALSE, | |
1473 G_CALLBACK(sound_chosen_cb), NULL, GINT_TO_POINTER(sound_row_sel)); | |
9150 | 1474 } |
1475 | |
9508 | 1476 static void prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) { |
9150 | 1477 GtkTreeIter iter; |
1478 GValue val = { 0, }; | |
1479 const char *file; | |
1480 char *pref; | |
1481 | |
1482 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1483 return; | |
1484 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1485 sound_row_sel = g_value_get_uint(&val); | |
1486 | |
1487 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1488 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1489 file = gaim_prefs_get_string(pref); | |
1490 g_free(pref); | |
1491 if (sound_entry) | |
1492 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1493 g_value_unset (&val); | |
1494 } | |
1495 | |
5440 | 1496 GtkWidget *sound_page() { |
1497 GtkWidget *ret; | |
9150 | 1498 GtkWidget *vbox, *sw, *button; |
5440 | 1499 GtkSizeGroup *sg; |
9150 | 1500 GtkTreeIter iter; |
1501 GtkWidget *event_view; | |
1502 GtkListStore *event_store; | |
1503 GtkCellRenderer *rend; | |
1504 GtkTreeViewColumn *col; | |
1505 GtkTreeSelection *sel; | |
1506 GtkTreePath *path; | |
1507 GtkWidget *hbox; | |
1508 int j; | |
1509 const char *file; | |
1510 char *pref; | |
5440 | 1511 #ifndef _WIN32 |
1512 GtkWidget *dd; | |
1513 GtkWidget *label; | |
6007 | 1514 GtkWidget *entry; |
5684 | 1515 const char *cmd; |
5440 | 1516 #endif |
1517 | |
1518 ret = gtk_vbox_new(FALSE, 18); | |
1519 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1520 | |
1521 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1522 | |
1523 #ifndef _WIN32 | |
6033 | 1524 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1525 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1526 "/gaim/gtk/sound/method", | |
1527 _("Console beep"), "beep", | |
5440 | 1528 #ifdef USE_AO |
7987 | 1529 _("Automatic"), "automatic", |
1530 "ESD", "esd", | |
1531 "Arts", "arts", | |
5440 | 1532 #endif |
1533 #ifdef USE_NAS_AUDIO | |
7987 | 1534 "NAS", "nas", |
5440 | 1535 #endif |
7987 | 1536 _("Command"), "custom", |
10074 | 1537 _("No sounds"), "none", |
7987 | 1538 NULL); |
5440 | 1539 gtk_size_group_add_widget(sg, dd); |
1540 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1541 | |
1542 hbox = gtk_hbox_new(FALSE, 5); | |
1543 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1544 | |
6031 | 1545 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1546 gtk_size_group_add_widget(sg, label); |
1547 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1548 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1549 | |
6007 | 1550 entry = gtk_entry_new(); |
1551 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1552 | |
1553 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1554 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1555 if(cmd) |
6007 | 1556 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1557 gtk_widget_set_size_request(entry, 75, -1); | |
1558 | |
1559 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1560 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1561 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1562 |
1563 gtk_widget_set_sensitive(hbox, | |
1564 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1565 "custom")); | |
10087 | 1566 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1567 sound_changed1_cb, hbox); | |
6005 | 1568 |
8141 | 1569 gaim_set_accessible_label (entry, label); |
5440 | 1570 #endif /* _WIN32 */ |
9150 | 1571 |
10074 | 1572 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
1573 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"), | |
1574 "/gaim/gtk/sound/conv_focus", vbox); | |
1575 gaim_gtk_prefs_checkbox(_("_Sounds while away"), | |
1576 "/core/sound/while_away", vbox); | |
1577 | |
10075 | 1578 #ifndef _WIN32 |
10074 | 1579 gtk_widget_set_sensitive(vbox, |
1580 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1581 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1582 sound_changed2_cb, vbox); | |
10075 | 1583 #endif |
10074 | 1584 |
9150 | 1585 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); |
1586 | |
1587 /* The following is an ugly hack to make the frame expand so the | |
1588 * sound events list is big enough to be usable */ | |
1589 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1590 GTK_PACK_START); | |
1591 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1592 TRUE, 0, GTK_PACK_START); | |
1593 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1594 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1595 | |
1596 sw = gtk_scrolled_window_new(NULL,NULL); | |
1597 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1598 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1599 | |
1600 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1601 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1602 | |
1603 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1604 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1605 gaim_gtk_sound_get_event_option(j)); | |
1606 const char *label = gaim_gtk_sound_get_event_label(j); | |
1607 | |
1608 if (label == NULL) { | |
1609 g_free(pref); | |
1610 continue; | |
1611 } | |
1612 | |
1613 gtk_list_store_append (event_store, &iter); | |
1614 gtk_list_store_set(event_store, &iter, | |
1615 0, gaim_prefs_get_bool(pref), | |
1616 1, _(label), | |
1617 2, pref, | |
1618 3, j, | |
1619 -1); | |
1620 g_free(pref); | |
1621 } | |
1622 | |
1623 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1624 | |
1625 rend = gtk_cell_renderer_toggle_new(); | |
1626 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1627 g_signal_connect (G_OBJECT (sel), "changed", | |
1628 G_CALLBACK (prefs_sound_sel), | |
1629 NULL); | |
1630 g_signal_connect (G_OBJECT(rend), "toggled", | |
1631 G_CALLBACK(event_toggled), event_store); | |
1632 path = gtk_tree_path_new_first(); | |
1633 gtk_tree_selection_select_path(sel, path); | |
1634 gtk_tree_path_free(path); | |
1635 | |
1636 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1637 rend, | |
1638 "active", 0, | |
1639 NULL); | |
1640 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1641 | |
1642 rend = gtk_cell_renderer_text_new(); | |
1643 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1644 rend, | |
1645 "text", 1, | |
1646 NULL); | |
1647 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1648 g_object_unref(G_OBJECT(event_store)); | |
1649 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1650 | |
1651 hbox = gtk_hbox_new(FALSE, 6); | |
1652 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1653 sound_entry = gtk_entry_new(); | |
1654 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1655 gaim_gtk_sound_get_event_option(0)); | |
1656 file = gaim_prefs_get_string(pref); | |
1657 g_free(pref); | |
1658 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1659 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1660 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1661 | |
1662 button = gtk_button_new_with_label(_("Test")); | |
1663 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1664 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1665 | |
1666 button = gtk_button_new_with_label(_("Reset")); | |
1667 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1668 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1669 | |
1670 button = gtk_button_new_with_label(_("Choose...")); | |
9508 | 1671 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); |
9150 | 1672 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); |
5440 | 1673 gtk_widget_show_all(ret); |
9118 | 1674 |
10075 | 1675 #ifndef _WIN32 |
10074 | 1676 gtk_widget_set_sensitive(vbox, |
1677 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1678 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1679 sound_changed2_cb, vbox); | |
10075 | 1680 #endif |
10074 | 1681 |
5440 | 1682 return ret; |
1683 } | |
1684 | |
10182 | 1685 /* XXX CORE/UI */ |
1686 #if 0 | |
1687 static void | |
1688 set_default_away(GtkWidget *w, gpointer data) | |
1689 { | |
1690 struct away_message *default_away = NULL; | |
1691 int length = g_slist_length(away_messages); | |
1692 int i = GPOINTER_TO_INT(data); | |
1693 | |
1694 if (away_messages == NULL) | |
1695 default_away = NULL; | |
1696 else if (i >= length) | |
1697 default_away = g_slist_nth_data(away_messages, length - 1); | |
1698 else | |
1699 default_away = g_slist_nth_data(away_messages, i); | |
1700 | |
1701 if(default_away) | |
1702 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
1703 else | |
1704 gaim_prefs_set_string("/core/away/default_message", ""); | |
1705 } | |
1706 #endif | |
1707 | |
5440 | 1708 GtkWidget *away_page() { |
1709 GtkWidget *ret; | |
1710 GtkWidget *vbox; | |
1711 GtkWidget *hbox; | |
1712 GtkWidget *label; | |
1713 GtkWidget *button; | |
1714 GtkWidget *select; | |
1715 GtkWidget *dd; | |
1716 GtkSizeGroup *sg; | |
1717 | |
1718 ret = gtk_vbox_new(FALSE, 18); | |
1719 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1720 | |
1721 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1722 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1723 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1724 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1725 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1726 |
9596 | 1727 label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), |
1728 GAIM_PREF_STRING, "/core/away/auto_reply", | |
1729 _("Never"), "never", | |
9736 | 1730 _("When away"), "away", |
1731 _("When away and idle"), "awayidle", | |
9596 | 1732 NULL); |
6142 | 1733 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1734 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1735 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1736 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1737 _("None"), "none", | |
1738 _("Gaim usage"), "gaim", | |
5440 | 1739 #ifdef USE_SCREENSAVER |
1740 #ifndef _WIN32 | |
7987 | 1741 _("X usage"), "system", |
5440 | 1742 #else |
7987 | 1743 _("Windows usage"), "system", |
5440 | 1744 #endif |
1745 #endif | |
7987 | 1746 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1747 |
5440 | 1748 gtk_size_group_add_widget(sg, dd); |
1749 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1750 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1751 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1752 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1753 "/core/away/away_when_idle", vbox); |
8238 | 1754 |
7987 | 1755 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1756 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1757 1, 24 * 60, sg); | |
5440 | 1758 g_signal_connect(G_OBJECT(button), "clicked", |
1759 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1760 | |
8238 | 1761 hbox = gtk_hbox_new(FALSE, 0); |
1762 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1763 | |
5440 | 1764 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); |
1765 gtk_size_group_add_widget(sg, label); | |
1766 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
8238 | 1767 g_signal_connect(G_OBJECT(button), "clicked", |
1768 G_CALLBACK(gaim_gtk_toggle_sensitive), label); | |
5440 | 1769 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
8238 | 1770 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1771 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1772 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
8238 | 1773 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1774 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1775 |
5440 | 1776 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1777 |
5440 | 1778 return ret; |
1779 } | |
1780 | |
1781 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1782 | |
1783 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1784 { | |
1785 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1786 GtkTreeIter iter; | |
1787 GValue val = { 0, }; | |
1788 GaimPlugin *plug; | |
1789 | |
1790 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1791 return; | |
8104 | 1792 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1793 plug = g_value_get_pointer(&val); |
8998 | 1794 |
5440 | 1795 pname = g_markup_escape_text(_(plug->info->name), -1); |
9307 | 1796 pdesc = (plug->info->description) ? |
1797 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1798 pauth = (plug->info->author) ? | |
1799 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1800 pweb = (plug->info->homepage) ? | |
1801 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1802 | |
5440 | 1803 if (plug->error != NULL) { |
1804 perr = g_markup_escape_text(_(plug->error), -1); | |
1805 buf = g_strdup_printf( | |
1806 "<span size=\"larger\">%s %s</span>\n\n" | |
1807 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1808 "%s", | |
1809 pname, plug->info->version, perr, pdesc); | |
1810 g_free(perr); | |
1811 } | |
1812 else { | |
1813 buf = g_strdup_printf( | |
1814 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1815 pname, plug->info->version, pdesc); | |
1816 } | |
1817 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1818 g_free(buf); | |
1819 | |
1820 buf = g_strdup_printf( | |
1821 #ifndef _WIN32 | |
1822 _("<span size=\"larger\">%s %s</span>\n\n" | |
1823 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1824 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1825 "<span weight=\"bold\">File name:</span>\t%s"), | |
1826 #else | |
1827 _("<span size=\"larger\">%s %s</span>\n\n" | |
1828 "<span weight=\"bold\">Written by:</span> %s\n" | |
1829 "<span weight=\"bold\">URL:</span> %s\n" | |
1830 "<span weight=\"bold\">File name:</span> %s"), | |
1831 #endif | |
1832 pname, plug->info->version, pauth, pweb, plug->path); | |
1833 | |
1834 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1835 g_value_unset(&val); | |
1836 g_free(buf); | |
1837 g_free(pname); | |
1838 g_free(pdesc); | |
1839 g_free(pauth); | |
1840 g_free(pweb); | |
1841 } | |
1842 | |
1843 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1844 { | |
1845 GtkTreeModel *model = (GtkTreeModel *)data; | |
1846 GtkTreeIter iter; | |
1847 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1848 GaimPlugin *plug; | |
1849 gchar buf[1024]; | |
6040 | 1850 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1851 |
5440 | 1852 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1853 gdk_window_set_cursor(prefs->window, wait); | |
1854 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1855 |
5440 | 1856 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1857 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1858 |
5440 | 1859 if (!gaim_plugin_is_loaded(plug)) { |
1860 gaim_plugin_load(plug); | |
1861 | |
1862 /* | |
1863 * NOTE: This is basically the same check as before | |
1864 * (plug->type == plugin), but now there aren't plugin types. | |
1865 * Not yet, anyway. I want to do a V2 of the plugin API. | |
1866 * The thing is, we should have a flag specifying the UI type, | |
1867 * or just whether it's a general plugin or a UI-specific | |
1868 * plugin. We should only load this if it's UI-specific. | |
1869 * | |
1870 * -- ChipX86 | |
1871 */ | |
1872 if (GAIM_IS_GTK_PLUGIN(plug)) | |
1873 { | |
1874 GtkWidget *config_frame; | |
1875 GaimGtkPluginUiInfo *ui_info; | |
1876 | |
1877 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1878 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1879 | |
1880 if (config_frame != NULL) { | |
1881 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1882 prefs_notebook_add_page(_(plug->info->name), NULL, | |
10078 | 1883 config_frame, ui_info->iter, |
1884 &plugin_iter, notebook_page++); | |
5440 | 1885 } |
1886 } | |
8713 | 1887 |
1888 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8998 | 1889 GtkTreeIter iter; |
8713 | 1890 GtkWidget *pref_frame; |
1891 GaimPluginUiInfo *prefs_info; | |
1892 | |
1893 if(plug->info->type == GAIM_PLUGIN_PROTOCOL) | |
1894 iter = proto_iter; | |
1895 else | |
1896 iter = plugin_iter; | |
1897 | |
1898 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 1899 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
1900 pref_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8713 | 1901 |
1902 if(pref_frame != NULL) { | |
1903 prefs_info->iter = g_new0(GtkTreeIter, 1); | |
1904 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1905 pref_frame, prefs_info->iter, | |
1906 &iter, notebook_page++); | |
1907 } | |
1908 } | |
5440 | 1909 } |
1910 else { | |
1911 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1912 GaimGtkPluginUiInfo *ui_info; | |
1913 | |
1914 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1915 | |
1916 if (ui_info != NULL && ui_info->iter != NULL) { | |
1917 g_free(ui_info->iter); | |
1918 ui_info->iter = NULL; | |
1919 } | |
8745 | 1920 } |
1921 | |
1922 if (GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8713 | 1923 GaimPluginUiInfo *prefs_info; |
1924 | |
1925 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
1926 | |
8745 | 1927 if(prefs_info != NULL) { |
8814 | 1928 if(prefs_info->frame != NULL) { |
1929 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
1930 prefs_info->frame = NULL; | |
1931 } | |
1932 | |
8745 | 1933 if(prefs_info->iter != NULL) { |
1934 g_free(prefs_info->iter); | |
1935 prefs_info->iter = NULL; | |
1936 } | |
8713 | 1937 } |
5440 | 1938 } |
1939 | |
1940 gaim_plugin_unload(plug); | |
1941 } | |
1942 | |
1943 gdk_window_set_cursor(prefs->window, NULL); | |
1944 | |
6040 | 1945 name = g_markup_escape_text(_(plug->info->name), -1); |
1946 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 1947 if (plug->error != NULL) { |
6040 | 1948 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 1949 g_snprintf(buf, sizeof(buf), |
1950 "<span size=\"larger\">%s %s</span>\n\n" | |
1951 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1952 "%s", | |
6040 | 1953 name, plug->info->version, error, description); |
1954 g_free(error); | |
1955 } else { | |
5440 | 1956 g_snprintf(buf, sizeof(buf), |
1957 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 1958 name, plug->info->version, description); |
5440 | 1959 } |
6040 | 1960 g_free(name); |
1961 g_free(description); | |
5440 | 1962 |
1963 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1964 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1965 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1966 |
5440 | 1967 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1968 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1969 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1970 gaim_gtk_plugins_save(); |
5440 | 1971 } |
1972 | |
1973 static void | |
1974 update_plugin_list(void *data) | |
1975 { | |
1976 GtkListStore *ls = GTK_LIST_STORE(data); | |
1977 GtkTreeIter iter; | |
1978 GList *probes; | |
1979 GaimPlugin *plug; | |
1980 | |
1981 gtk_list_store_clear(ls); | |
1982 | |
1983 for (probes = gaim_plugins_get_all(); | |
1984 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1985 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1986 { |
5440 | 1987 plug = probes->data; |
1988 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1989 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
1990 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1991 { |
5440 | 1992 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1993 } |
5440 | 1994 |
1995 gtk_list_store_append (ls, &iter); | |
1996 gtk_list_store_set(ls, &iter, | |
1997 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1998 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 1999 2, _(plug->info->summary), |
8104 | 2000 3, plug, -1); |
5440 | 2001 } |
2002 } | |
2003 | |
2004 static GtkWidget *plugin_page () | |
2005 { | |
2006 GtkWidget *ret; | |
2007 GtkWidget *sw, *vp; | |
2008 GtkWidget *event_view; | |
2009 GtkListStore *ls; | |
2010 GtkCellRenderer *rend, *rendt; | |
2011 GtkTreeViewColumn *col; | |
2012 GtkTreeSelection *sel; | |
2013 GtkTreePath *path; | |
2014 GtkWidget *nb; | |
2015 | |
2016 ret = gtk_vbox_new(FALSE, 18); | |
2017 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2018 | |
2019 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 2020 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 2021 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
2022 | |
2023 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2024 | |
8104 | 2025 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 2026 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
2027 1, GTK_SORT_ASCENDING); | |
5440 | 2028 |
2029 update_plugin_list(ls); | |
2030 | |
2031 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
2032 | |
2033 rend = gtk_cell_renderer_toggle_new(); | |
2034 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2035 | |
2036 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
2037 rend, | |
2038 "active", 0, | |
2039 NULL); | |
2040 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2041 | |
2042 rendt = gtk_cell_renderer_text_new(); | |
2043 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2044 rendt, | |
2045 "text", 1, | |
2046 NULL); | |
2047 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8998 | 2048 |
8104 | 2049 rendt = gtk_cell_renderer_text_new(); |
2050 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2051 rendt, | |
2052 "text", 2, | |
2053 NULL); | |
2054 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
8998 | 2055 |
5440 | 2056 g_object_unref(G_OBJECT(ls)); |
2057 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
8998 | 2058 |
5440 | 2059 |
2060 nb = gtk_notebook_new(); | |
2061 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2062 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
8998 | 2063 |
5440 | 2064 /* Description */ |
2065 sw = gtk_scrolled_window_new(NULL, NULL); | |
2066 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2067 plugin_description = gtk_label_new(NULL); | |
8998 | 2068 |
5440 | 2069 vp = gtk_viewport_new(NULL, NULL); |
2070 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2071 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2072 | |
2073 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
2074 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2075 | |
8998 | 2076 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); |
5440 | 2077 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); |
2078 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
2079 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
2080 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
2081 | |
2082 /* Details */ | |
2083 sw = gtk_scrolled_window_new(NULL, NULL); | |
2084 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2085 plugin_details = gtk_label_new(NULL); | |
8998 | 2086 |
5440 | 2087 vp = gtk_viewport_new(NULL, NULL); |
2088 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2089 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2090 | |
2091 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
2092 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2093 | |
8998 | 2094 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); |
5440 | 2095 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
2096 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
8998 | 2097 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); |
5440 | 2098 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); |
2099 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2100 | |
2101 g_signal_connect (G_OBJECT (sel), "changed", | |
2102 G_CALLBACK (prefs_plugin_sel), | |
8998 | 2103 NULL); |
5440 | 2104 g_signal_connect (G_OBJECT(rend), "toggled", |
2105 G_CALLBACK(plugin_load), ls); | |
2106 | |
2107 path = gtk_tree_path_new_first(); | |
2108 gtk_tree_selection_select_path(sel, path); | |
2109 gtk_tree_path_free(path); | |
2110 | |
2111 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2112 | |
2113 gtk_widget_show_all(ret); | |
2114 return ret; | |
2115 } | |
2116 | |
2117 GtkTreeIter *prefs_notebook_add_page(const char *text, | |
2118 GdkPixbuf *pixbuf, | |
2119 GtkWidget *page, | |
2120 GtkTreeIter *iter, | |
2121 GtkTreeIter *parent, | |
2122 int ind) { | |
2123 GdkPixbuf *icon = NULL; | |
2124 | |
2125 if (pixbuf) | |
2126 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2127 | |
2128 if (pixbuf) | |
2129 g_object_unref(pixbuf); | |
2130 if (icon) | |
2131 g_object_unref(icon); | |
2132 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
2133 return iter; | |
2134 } | |
2135 | |
2136 void prefs_notebook_init() { | |
9267 | 2137 GtkTreeIter p, c, c2; |
5440 | 2138 GList *l; |
2139 GaimPlugin *plug; | |
2140 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
9150 | 2141 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
9267 | 2142 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c2, &c, notebook_page++); |
2143 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c2, &c, notebook_page++); | |
2144 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | |
9150 | 2145 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
8238 | 2146 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
5440 | 2147 #ifndef _WIN32 |
2148 /* We use the registered default browser in windows */ | |
10060 | 2149 /* if the user is running gnome 2.x, hide the browsers tab */ |
10061 | 2150 if (gaim_running_gnome() == FALSE) { |
10060 | 2151 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2152 } | |
5440 | 2153 #endif |
2154 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2155 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2156 | |
2157 if (gaim_plugins_enabled()) { | |
2158 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2159 | |
2160 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
8713 | 2161 plug = (GaimPlugin *)l->data; |
5440 | 2162 |
2163 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
2164 GtkWidget *config_frame; | |
2165 GaimGtkPluginUiInfo *ui_info; | |
2166 | |
2167 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
2168 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
2169 | |
2170 if (config_frame != NULL) { | |
2171 ui_info->iter = g_new0(GtkTreeIter, 1); | |
2172 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2173 config_frame, ui_info->iter, | |
2174 &plugin_iter, notebook_page++); | |
2175 } | |
2176 } | |
8713 | 2177 |
2178 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8745 | 2179 GtkWidget *gtk_frame; |
8713 | 2180 GaimPluginUiInfo *prefs_info; |
2181 | |
2182 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 2183 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
2184 gtk_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8745 | 2185 |
2186 if(GTK_IS_WIDGET(gtk_frame)) { | |
8713 | 2187 prefs_info->iter = g_new0(GtkTreeIter, 1); |
2188 prefs_notebook_add_page(_(plug->info->name), NULL, | |
8745 | 2189 gtk_frame, prefs_info->iter, |
9150 | 2190 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, |
8713 | 2191 notebook_page++); |
8814 | 2192 } else if(prefs_info->frame) { |
2193 /* in the event that there is a pref frame and we can | |
2194 * not make a widget out of it, we free the | |
2195 * pluginpref frame --Gary | |
2196 */ | |
2197 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
8713 | 2198 } |
2199 } | |
5440 | 2200 } |
2201 } | |
2202 } | |
2203 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2204 void gaim_gtk_prefs_show(void) |
5440 | 2205 { |
10078 | 2206 GtkWidget *vbox; |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2207 GtkWidget *bbox; |
5440 | 2208 GtkWidget *notebook; |
2209 GtkWidget *button; | |
2210 | |
2211 if (prefs) { | |
2212 gtk_window_present(GTK_WINDOW(prefs)); | |
2213 return; | |
2214 } | |
2215 | |
2216 /* copy the preferences to tmp values... | |
2217 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2218 /* (that should have been "effect," right?) */ |
2219 | |
5440 | 2220 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2221 | |
2222 /* Create the window */ | |
2223 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2224 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2225 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2226 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2227 gtk_container_set_border_width(GTK_CONTAINER(prefs), 12); |
5440 | 2228 g_signal_connect(G_OBJECT(prefs), "destroy", |
2229 G_CALLBACK(delete_prefs), NULL); | |
2230 | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2231 vbox = gtk_vbox_new(FALSE, 12); |
5440 | 2232 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
2233 gtk_widget_show(vbox); | |
2234 | |
2235 /* The notebook */ | |
2236 prefsnotebook = notebook = gtk_notebook_new (); | |
10078 | 2237 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_LEFT); |
2238 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE); | |
5440 | 2239 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); |
10078 | 2240 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
2241 | |
5440 | 2242 |
8713 | 2243 /* The buttons to press! */ |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2244 bbox = gtk_hbutton_box_new(); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2245 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2246 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
|
2247 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2248 gtk_widget_show (bbox); |
5440 | 2249 |
2250 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2251 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2252 G_CALLBACK(gtk_widget_destroy), prefs); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2253 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5440 | 2254 gtk_widget_show(button); |
2255 | |
2256 prefs_notebook_init(); | |
2257 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2258 /* Show everything. */ |
10078 | 2259 gtk_widget_show_all(prefs); |
5440 | 2260 } |
2261 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2262 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2263 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2264 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2265 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2266 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2267 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2268 |
7976 | 2269 GtkWidget * |
7987 | 2270 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2271 { |
2272 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2273 |
5440 | 2274 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2275 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2276 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2277 |
5440 | 2278 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
|
2279 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2280 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2281 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2282 |
5440 | 2283 gtk_widget_show(button); |
2284 | |
2285 return button; | |
2286 } | |
2287 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2288 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2289 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2290 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2291 { |
5841 | 2292 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2293 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2294 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2295 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2296 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2297 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2298 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2299 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2300 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2301 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2302 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2303 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2304 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2305 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2306 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2307 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2308 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2309 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2310 |
8283 | 2311 #ifndef _WIN32 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2312 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2313 gaim_prefs_add_none("/gaim/gtk/browsers"); |
8272 | 2314 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
|
2315 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2316 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
8283 | 2317 #endif |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2318 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2319 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2320 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2321 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2322 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2323 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2324 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2325 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2326 |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2327 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2328 gaim_prefs_add_none("/gaim/gtk/smileys"); |
9707 | 2329 gaim_prefs_add_string("/gaim/gtk/smileys/theme", "default"); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2330 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2331 /* Smiley Callbacks */ |
10087 | 2332 gaim_prefs_connect_callback(prefs, "/gaim/gtk/smileys/theme", |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2333 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2334 } |
8905 | 2335 |
2336 void gaim_gtk_prefs_update_old() { | |
2337 /* Rename some old prefs */ | |
2338 gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); | |
2339 gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); | |
2340 gaim_prefs_rename("/core/conversations/placement", | |
8998 | 2341 "/gaim/gtk/conversations/placement"); |
8905 | 2342 |
9025 | 2343 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2344 "/gaim/gtk/conversations/send_formatting"); | |
2345 | |
10307 | 2346 gaim_prefs_rename("/gaim/gtk/debug/timestamps", "/core/debug/timestamps"); |
2347 | |
8905 | 2348 /* Remove some no-longer-used prefs */ |
10133 | 2349 gaim_prefs_remove("/gaim/gtk/blist/button_style"); |
10168 | 2350 gaim_prefs_remove("/gaim/gtk/blist/grey_idle_buddies"); |
10133 | 2351 gaim_prefs_remove("/gaim/gtk/blist/raise_on_events"); |
8945 | 2352 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
10355 | 2353 gaim_prefs_remove("/gaim/gtk/blist/auto_expand_contacts"); |
10353 | 2354 gaim_prefs_remove("/gaim/gtk/blist/show_idle_time"); |
2355 gaim_prefs_remove("/gaim/gtk/blist/show_warning_level"); | |
10358 | 2356 gaim_prefs_remove("/gaim/gtk/conversations/button_type"); |
10164 | 2357 gaim_prefs_remove("/gaim/gtk/conversations/html_shortcuts"); |
8946 | 2358 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
8905 | 2359 gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links"); |
2360 gaim_prefs_remove("/gaim/gtk/conversations/show_smileys"); | |
10164 | 2361 gaim_prefs_remove("/gaim/gtk/conversations/smiley_shortcuts"); |
8941 | 2362 gaim_prefs_remove("/gaim/gtk/conversations/chat/tab_completion"); |
2363 gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete"); | |
8947 | 2364 gaim_prefs_remove("/gaim/gtk/sound/signon"); |
2365 gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); | |
8998 | 2366 gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); |
9025 | 2367 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor"); |
2368 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor"); | |
2369 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size"); | |
9301 | 2370 gaim_prefs_remove("/gaim/gtk/conversations/im/hide_on_send"); |
8905 | 2371 } |