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