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