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