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