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