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