Mercurial > pidgin
annotate src/gtkprefs.c @ 10458:ad9258716144
[gaim-migrate @ 11727]
This should fix sf bug #1093455
Basically it's possible for people to kick you from an AIM chat room, and
I don't think there's anything we can do about this. When this happens
you can't rejoin, and I don't think there's anything we can do about
that, either.
But now, at least oscar will tell the core you're no longer in the chat
room when you've been kicked. i.e. it changes the chat title from
"My Lame Chat" to "(My Lame Chat)"
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 31 Dec 2004 05:42:26 +0000 |
parents | de59c0e7f87e |
children | 47366cf2792b |
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 | |
522 unlink(path); | |
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")); |
763 gaim_gtk_prefs_checkbox(_("Ignore c_olors"), | |
764 "/gaim/gtk/conversations/ignore_colors", vbox); | |
765 gaim_gtk_prefs_checkbox(_("Ignore font _faces"), | |
766 "/gaim/gtk/conversations/ignore_fonts", vbox); | |
767 gaim_gtk_prefs_checkbox(_("Ignore font si_zes"), | |
768 "/gaim/gtk/conversations/ignore_font_sizes", vbox); | |
8988 | 769 |
770 vbox = gaim_gtk_make_frame (ret, _("Default Formatting")); | |
771 | |
9025 | 772 option = gaim_gtk_prefs_checkbox(_("_Send default formatting with outgoing messages"), |
773 "/gaim/gtk/conversations/send_formatting", vbox); | |
774 | |
8988 | 775 |
9025 | 776 fontvbox = gtk_vbox_new(FALSE, 0); |
10181 | 777 gtk_container_add(GTK_CONTAINER(vbox), fontvbox); |
778 | |
779 frame = gaim_gtk_create_imhtml(TRUE, &imhtml, &toolbar); | |
9025 | 780 gtk_widget_set_name(imhtml, "gaim_gtkprefs_font_imhtml"); |
8836 | 781 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(imhtml), TRUE); |
9025 | 782 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 | 783 gtk_box_pack_start(GTK_BOX(fontvbox), frame, FALSE, FALSE, 0); |
8988 | 784 |
9056 | 785 button = gtk_button_new_with_mnemonic(_("_Clear Formatting")); |
9025 | 786 gtk_box_pack_start(GTK_BOX(fontvbox), button, FALSE, FALSE, 0); |
787 | |
788 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/send_formatting")) | |
789 gtk_widget_set_sensitive(fontvbox, FALSE); | |
790 | |
8836 | 791 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) |
792 gtk_imhtml_toggle_bold(GTK_IMHTML(imhtml)); | |
793 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) | |
794 gtk_imhtml_toggle_italic(GTK_IMHTML(imhtml)); | |
795 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) | |
796 gtk_imhtml_toggle_underline(GTK_IMHTML(imhtml)); | |
797 | |
798 gtk_imhtml_font_set_size(GTK_IMHTML(imhtml), gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); | |
799 gtk_imhtml_toggle_forecolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor")); | |
800 gtk_imhtml_toggle_backcolor(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor")); | |
801 gtk_imhtml_toggle_fontface(GTK_IMHTML(imhtml), gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | |
802 | |
9025 | 803 g_signal_connect(G_OBJECT(button), "clicked", |
804 G_CALLBACK(formatting_reset_cb), imhtml); | |
805 | |
806 g_signal_connect(G_OBJECT(option), "clicked", | |
807 G_CALLBACK(gaim_gtk_toggle_sensitive), fontvbox); | |
808 | |
809 g_signal_connect(G_OBJECT(imhtml), "format_function_toggle", | |
810 G_CALLBACK(formatting_toggle_cb), NULL); | |
811 | |
5440 | 812 gtk_widget_show_all(ret); |
813 return ret; | |
814 } | |
815 | |
816 GtkWidget *hotkeys_page() { | |
817 GtkWidget *ret; | |
818 GtkWidget *vbox; | |
819 ret = gtk_vbox_new(FALSE, 18); | |
820 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
821 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
822 vbox = gaim_gtk_make_frame (ret, _("Window Closing")); |
7987 | 823 gaim_gtk_prefs_checkbox(_("_Escape closes window"), |
824 "/gaim/gtk/conversations/escape_closes", vbox); | |
5440 | 825 |
826 gtk_widget_show_all(ret); | |
827 return ret; | |
828 } | |
829 | |
830 GtkWidget *list_page() { | |
831 GtkWidget *ret; | |
832 GtkWidget *vbox; | |
833 GList *l= NULL; | |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
834 GSList *sl; |
5440 | 835 ret = gtk_vbox_new(FALSE, 18); |
836 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
7305 | 837 |
838 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
839 vbox = gaim_gtk_make_frame (ret, _("Buddy List Sorting")); |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
840 |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
841 for (sl = gaim_gtk_blist_sort_methods; sl != NULL; sl = sl->next) { |
5631 | 842 struct gaim_gtk_blist_sort_method *method = sl->data; |
843 | |
844 l = g_list_append(l, method->name); | |
845 l = g_list_append(l, method->id); | |
5440 | 846 } |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
847 |
8063 | 848 gaim_gtk_prefs_dropdown_from_list(vbox, _("_Sorting:"), GAIM_PREF_STRING, |
7987 | 849 "/gaim/gtk/blist/sort_type", l); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
850 |
5440 | 851 g_list_free(l); |
852 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
853 vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); |
10351 | 854 gaim_gtk_prefs_checkbox(_("Show more buddy details"), |
7305 | 855 "/gaim/gtk/blist/show_buddy_icons", vbox); |
5440 | 856 |
857 gtk_widget_show_all(ret); | |
5547
90a67ea697f7
[gaim-migrate @ 5948]
Christian Hammond <chipx86@chipx86.com>
parents:
5546
diff
changeset
|
858 |
5440 | 859 return ret; |
860 } | |
861 | |
8979 | 862 static void |
9155 | 863 conversation_usetabs_cb(const char *name, GaimPrefType type, gpointer value, |
8979 | 864 gpointer data) |
865 { | |
10112 | 866 gboolean usetabs = GPOINTER_TO_INT(value); |
9155 | 867 |
868 if (usetabs) | |
869 gtk_widget_set_sensitive(GTK_WIDGET(data), TRUE); | |
870 else | |
8979 | 871 gtk_widget_set_sensitive(GTK_WIDGET(data), FALSE); |
872 } | |
873 | |
5440 | 874 GtkWidget *conv_page() { |
875 GtkWidget *ret; | |
9155 | 876 GtkWidget *vbox, *vbox2; |
5440 | 877 GtkWidget *label; |
878 GtkSizeGroup *sg; | |
879 GList *names = NULL; | |
880 | |
881 ret = gtk_vbox_new(FALSE, 18); | |
882 gtk_container_set_border_width(GTK_CONTAINER(ret), 12); | |
883 | |
884 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
885 vbox = gaim_gtk_make_frame(ret, _("Conversations")); |
5440 | 886 |
9832 | 887 gaim_gtk_prefs_checkbox(_("Send unknown \"_slash\" commands as messages"), |
888 "/gaim/gtk/conversations/passthrough_unknown_commands", vbox); | |
9301 | 889 |
9150 | 890 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
891 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
9155 | 892 gaim_gtk_prefs_checkbox(_("Enable buddy ic_on animation"), |
9150 | 893 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); |
9155 | 894 gaim_gtk_prefs_checkbox(_("_Notify buddies that you are typing to them"), |
9150 | 895 "/core/conversations/im/send_typing", vbox); |
9155 | 896 |
897 /* All the tab options! */ | |
898 vbox = gaim_gtk_make_frame(ret, _("Tab Options")); | |
899 | |
900 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
|
901 "/gaim/gtk/conversations/tabs", vbox); |
9155 | 902 |
903 /* | |
904 * Connect a signal to the above preference. When conversations are not | |
905 * shown in a tabbed window then all tabbing options should be disabled. | |
906 */ | |
907 vbox2 = gtk_vbox_new(FALSE, 0); | |
908 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); | |
10087 | 909 gaim_prefs_connect_callback(prefs, "/gaim/gtk/conversations/tabs", |
910 conversation_usetabs_cb, vbox2); | |
9155 | 911 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) |
912 gtk_widget_set_sensitive(vbox2, FALSE); | |
913 | |
9891 | 914 gaim_gtk_prefs_checkbox(_("Show close b_utton on tabs"), |
9155 | 915 "/gaim/gtk/conversations/close_on_tabs", vbox2); |
916 | |
917 label = gaim_gtk_prefs_dropdown(vbox2, _("Tab p_lacement:"), GAIM_PREF_INT, | |
8988 | 918 "/gaim/gtk/conversations/tab_side", |
919 _("Top"), GTK_POS_TOP, | |
920 _("Bottom"), GTK_POS_BOTTOM, | |
921 _("Left"), GTK_POS_LEFT, | |
922 _("Right"), GTK_POS_RIGHT, | |
923 NULL); | |
924 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
925 gtk_size_group_add_widget(sg, label); | |
926 | |
9155 | 927 names = gaim_conv_placement_get_options(); |
9251 | 928 label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"), |
9155 | 929 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
930 gtk_size_group_add_widget(sg, label); | |
931 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
932 g_list_free(names); | |
933 | |
5440 | 934 gtk_widget_show_all(ret); |
935 | |
936 return ret; | |
937 } | |
938 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
939 static void network_ip_changed(GtkEntry *entry, gpointer data) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
940 { |
8834 | 941 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
942 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
943 |
9150 | 944 static void |
945 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
946 gpointer data) | |
947 { | |
948 GtkWidget *frame = data; | |
949 const char *proxy = value; | |
950 | |
951 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | |
952 gtk_widget_set_sensitive(frame, TRUE); | |
953 else | |
954 gtk_widget_set_sensitive(frame, FALSE); | |
955 } | |
956 | |
957 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
958 { | |
959 if (entrynum == PROXYHOST) | |
960 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
961 else if (entrynum == PROXYPORT) | |
962 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
963 else if (entrynum == PROXYUSER) | |
964 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
965 else if (entrynum == PROXYPASS) | |
966 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
967 } | |
968 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
969 GtkWidget *network_page() { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
970 GtkWidget *ret; |
9150 | 971 GtkWidget *vbox, *hbox, *entry; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
972 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
973 GtkSizeGroup *sg; |
9150 | 974 GaimProxyInfo *proxy_info; |
8231
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 ret = gtk_vbox_new(FALSE, 18); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
977 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
978 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
979 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
980 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
981 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
982 "/core/network/auto_ip", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
983 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
984 table = gtk_table_new(2, 1, FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
985 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
986 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
987 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
988 gtk_container_add(GTK_CONTAINER(vbox), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
989 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
990 label = gtk_label_new_with_mnemonic(_("Public _IP:")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
991 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
992 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
|
993 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
994 entry = gtk_entry_new(); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
995 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
996 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
|
997 g_signal_connect(G_OBJECT(entry), "changed", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
998 G_CALLBACK(network_ip_changed), NULL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
999 |
8834 | 1000 if (gaim_network_get_public_ip() != NULL) |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1001 gtk_entry_set_text(GTK_ENTRY(entry), |
8834 | 1002 gaim_network_get_public_ip()); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1003 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1004 gaim_set_accessible_label (entry, label); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1005 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1006 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1007 if (gaim_prefs_get_bool("/core/network/auto_ip")) { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1008 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1009 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1010 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1011 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1012 G_CALLBACK(gaim_gtk_toggle_sensitive), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1013 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1014 vbox = gaim_gtk_make_frame (ret, _("Ports")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1015 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1016 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1017 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
|
1018 "/core/network/ports_range_use", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1019 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1020 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1021 "/core/network/ports_range_start", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1022 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1023 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1024 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1025 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1026 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1027 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1028 "/core/network/ports_range_end", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1029 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1030 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1031 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1032 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1033 |
9150 | 1034 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
1035 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
7987 | 1036 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
9150 | 1037 "/core/proxy/type", |
1038 _("No proxy"), "none", | |
1039 "SOCKS 4", "socks4", | |
1040 "SOCKS 5", "socks5", | |
1041 "HTTP", "http", | |
1042 _("Use Environmental Settings"), "envvar", | |
1043 NULL); | |
1044 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
|
1045 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1046 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1047 if (proxy_info == NULL || |
6621 | 1048 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1049 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
|
1050 |
6001 | 1051 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1052 } |
10087 | 1053 gaim_prefs_connect_callback(prefs, "/core/proxy/type", |
1054 proxy_changed_cb, prefs_proxy_frame); | |
9150 | 1055 |
1056 table = gtk_table_new(4, 2, FALSE); | |
5440 | 1057 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1058 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1059 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
9150 | 1060 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); |
5440 | 1061 |
1062 | |
7797 | 1063 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1064 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1065 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1066 | |
1067 entry = gtk_entry_new(); | |
1068 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1069 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1070 g_signal_connect(G_OBJECT(entry), "changed", | |
1071 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1072 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1073 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1074 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1075 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1076 |
1077 hbox = gtk_hbox_new(TRUE, 5); | |
1078 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1079 gaim_set_accessible_label (entry, label); |
5440 | 1080 |
7870 | 1081 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1082 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1083 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1084 |
1085 entry = gtk_entry_new(); | |
1086 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1087 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1088 g_signal_connect(G_OBJECT(entry), "changed", |
1089 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1090 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1091 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1092 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1093 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1094 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1095 |
5440 | 1096 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1097 } | |
8137 | 1098 gaim_set_accessible_label (entry, label); |
5440 | 1099 |
7797 | 1100 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1101 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1102 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 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, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1107 g_signal_connect(G_OBJECT(entry), "changed", |
1108 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1109 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1110 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
|
1111 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1112 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1113 |
1114 hbox = gtk_hbox_new(TRUE, 5); | |
1115 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1116 gaim_set_accessible_label (entry, label); |
5440 | 1117 |
7797 | 1118 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1119 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1120 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1121 |
1122 entry = gtk_entry_new(); | |
1123 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1124 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
5440 | 1125 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1126 g_signal_connect(G_OBJECT(entry), "changed", | |
1127 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1128 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1129 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
|
1130 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1131 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1132 gaim_set_accessible_label (entry, label); |
5440 | 1133 |
1134 gtk_widget_show_all(ret); | |
1135 return ret; | |
1136 } | |
1137 | |
1138 #ifndef _WIN32 | |
1139 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1140 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1141 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1142 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1143 |
1144 /* carry on normally */ | |
1145 return FALSE; | |
1146 } | |
1147 | |
5633 | 1148 static GList *get_available_browsers() |
5440 | 1149 { |
1150 struct browser { | |
1151 char *name; | |
1152 char *command; | |
1153 }; | |
1154 | |
1155 static struct browser possible_browsers[] = { | |
9405 | 1156 {N_("Epiphany"), "epiphany"}, |
8267 | 1157 {N_("Firebird"), "mozilla-firebird"}, |
8356 | 1158 {N_("Firefox"), "firefox"}, |
9405 | 1159 {N_("Galeon"), "galeon"}, |
1160 {N_("Gnome Default"), "gnome-open"}, | |
1161 {N_("Konqueror"), "kfmclient"}, | |
1162 {N_("Mozilla"), "mozilla"}, | |
1163 {N_("Netscape"), "netscape"}, | |
1164 {N_("Opera"), "opera"} | |
5440 | 1165 }; |
9405 | 1166 static const int num_possible_browsers = 9; |
5440 | 1167 |
1168 GList *browsers = NULL; | |
1169 int i = 0; | |
5819 | 1170 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1171 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1172 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1173 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1174 |
5440 | 1175 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1176 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1177 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1178 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1179 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1180 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1181 browser_setting = NULL; |
5440 | 1182 } |
1183 } | |
1184 | |
5819 | 1185 if(browser_setting) |
1186 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1187 | |
5440 | 1188 return browsers; |
1189 } | |
1190 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1191 static void |
8274 | 1192 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
1193 gpointer data) | |
1194 { | |
1195 GtkWidget *hbox = data; | |
1196 const char *browser = value; | |
1197 | |
1198 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom")); | |
1199 } | |
1200 | |
1201 static void | |
1202 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1203 gpointer data) |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1204 { |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1205 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1206 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1207 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1208 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1209 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1210 |
5440 | 1211 GtkWidget *browser_page() { |
1212 GtkWidget *ret; | |
1213 GtkWidget *vbox; | |
1214 GtkWidget *hbox; | |
1215 GtkWidget *label; | |
6007 | 1216 GtkWidget *entry; |
5440 | 1217 GtkSizeGroup *sg; |
1218 GList *browsers = NULL; | |
1219 | |
1220 ret = gtk_vbox_new(FALSE, 18); | |
1221 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1222 | |
1223 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1224 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1225 |
1226 browsers = get_available_browsers(); | |
1227 if (browsers != NULL) { | |
7987 | 1228 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
|
1229 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1230 browsers); |
5440 | 1231 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1232 gtk_size_group_add_widget(sg, label); | |
8274 | 1233 |
1234 hbox = gtk_hbox_new(FALSE, 0); | |
1235 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT, | |
1236 "/gaim/gtk/browsers/place", | |
1237 _("Browser default"), GAIM_BROWSER_DEFAULT, | |
1238 _("Existing window"), GAIM_BROWSER_CURRENT, | |
1239 _("New window"), GAIM_BROWSER_NEW_WINDOW, | |
1240 _("New tab"), GAIM_BROWSER_NEW_TAB, | |
1241 NULL); | |
1242 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1243 gtk_size_group_add_widget(sg, label); | |
1244 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1245 | |
1246 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) | |
1247 gtk_widget_set_sensitive(hbox, FALSE); | |
10087 | 1248 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1249 browser_changed1_cb, hbox); | |
5440 | 1250 } |
1251 | |
1252 hbox = gtk_hbox_new(FALSE, 5); | |
1253 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1254 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1255 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1256 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1257 gtk_size_group_add_widget(sg, label); | |
1258 | |
6007 | 1259 entry = gtk_entry_new(); |
1260 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1261 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1262 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1263 gtk_widget_set_sensitive(hbox, FALSE); |
10087 | 1264 gaim_prefs_connect_callback(prefs, "/gaim/gtk/browsers/browser", |
1265 browser_changed2_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1266 |
6007 | 1267 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1268 | |
1269 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1270 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1271 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1272 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1273 gaim_set_accessible_label (entry, label); |
5440 | 1274 |
1275 gtk_widget_show_all(ret); | |
1276 return ret; | |
1277 } | |
1278 #endif /*_WIN32*/ | |
1279 | |
1280 GtkWidget *logging_page() { | |
1281 GtkWidget *ret; | |
1282 GtkWidget *vbox; | |
7431 | 1283 GList *names; |
8573 | 1284 GtkWidget *sys_box; |
1285 GtkWidget *box; | |
1286 int syslog_enabled = gaim_prefs_get_bool("/core/logging/log_system"); | |
1287 | |
5440 | 1288 ret = gtk_vbox_new(FALSE, 18); |
1289 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1290 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1291 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1292 names = gaim_log_logger_get_options(); |
1293 | |
7987 | 1294 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1295 "/core/logging/format", names); | |
1296 | |
1297 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1298 "/core/logging/log_ims", vbox); |
7987 | 1299 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1300 "/core/logging/log_chats", vbox); |
8573 | 1301 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1302 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
8573 | 1303 |
1304 sys_box = gaim_gtk_prefs_checkbox(_("_Enable system log"), | |
1305 "/core/logging/log_system", vbox); | |
1306 | |
10272 | 1307 box = gaim_gtk_prefs_checkbox(_("Log when buddies log in/log _out"), |
8573 | 1308 "/core/logging/log_signon_signoff", 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 | |
1313 box = gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), | |
1314 "/core/logging/log_idle_state", vbox); | |
1315 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1316 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1317 gtk_widget_set_sensitive(box, syslog_enabled); | |
1318 | |
1319 box = gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), | |
1320 "/core/logging/log_away_state", vbox); | |
1321 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1322 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1323 gtk_widget_set_sensitive(box, syslog_enabled); | |
1324 | |
10272 | 1325 box = gaim_gtk_prefs_checkbox(_("Log your own _signons/idleness/awayness"), |
8573 | 1326 "/core/logging/log_own_states", vbox); |
1327 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1328 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1329 gtk_widget_set_sensitive(box, syslog_enabled); | |
1330 | |
5440 | 1331 gtk_widget_show_all(ret); |
1332 return ret; | |
1333 } | |
1334 | |
1335 #ifndef _WIN32 | |
1336 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1337 { | |
5684 | 1338 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1339 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1340 return TRUE; |
1341 } | |
6005 | 1342 |
1343 static void | |
10074 | 1344 sound_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
6005 | 1345 gpointer data) |
1346 { | |
1347 GtkWidget *hbox = data; | |
1348 const char *method = value; | |
1349 | |
1350 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1351 } | |
10074 | 1352 |
1353 static void | |
1354 sound_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
1355 gpointer data) | |
1356 { | |
1357 GtkWidget *vbox = data; | |
1358 const char *method = value; | |
1359 | |
1360 gtk_widget_set_sensitive(vbox, strcmp(method, "none")); | |
1361 } | |
5440 | 1362 #endif |
1363 | |
9150 | 1364 |
1365 static void | |
1366 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1367 { | |
1368 GtkTreeModel *model = (GtkTreeModel *)data; | |
1369 GtkTreeIter iter; | |
1370 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1371 const char *pref; | |
1372 | |
1373 gtk_tree_model_get_iter (model, &iter, path); | |
1374 gtk_tree_model_get (model, &iter, | |
1375 2, &pref, | |
1376 -1); | |
1377 | |
1378 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1379 | |
1380 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1381 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1382 -1); | |
1383 | |
1384 gtk_tree_path_free(path); | |
1385 } | |
1386 | |
1387 static void | |
1388 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1389 { | |
1390 char *pref; | |
1391 gboolean temp_value1, temp_value2; | |
1392 | |
1393 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1394 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1395 | |
1396 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1397 temp_value2 = gaim_prefs_get_bool(pref); | |
1398 | |
1399 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1400 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1401 | |
1402 gaim_sound_play_event(sound_row_sel); | |
1403 | |
1404 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1405 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1406 | |
1407 g_free(pref); | |
1408 } | |
1409 | |
9508 | 1410 /* |
1411 * Resets a sound file back to default. | |
1412 */ | |
9150 | 1413 static void |
1414 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1415 { | |
9508 | 1416 gchar *pref; |
1417 | |
1418 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1419 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
9150 | 1420 gaim_prefs_set_string(pref, ""); |
1421 g_free(pref); | |
1422 | |
1423 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1424 } | |
1425 | |
9508 | 1426 static void |
1427 sound_chosen_cb(void *user_data, const char *filename) | |
9150 | 1428 { |
9508 | 1429 gchar *pref; |
1430 int sound; | |
1431 | |
1432 sound = GPOINTER_TO_INT(user_data); | |
9150 | 1433 |
1434 /* Set it -- and forget it */ | |
1435 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
9508 | 1436 gaim_gtk_sound_get_event_option(sound)); |
1437 gaim_prefs_set_string(pref, filename); | |
9150 | 1438 g_free(pref); |
1439 | |
9508 | 1440 /* |
1441 * If the sound we just changed is still the currently selected | |
1442 * sound, then update the box showing the file name. | |
1443 */ | |
1444 if (sound == sound_row_sel) | |
1445 gtk_entry_set_text(GTK_ENTRY(sound_entry), filename); | |
9150 | 1446 } |
1447 | |
9508 | 1448 static void select_sound(GtkWidget *button, gpointer being_NULL_is_fun) |
9150 | 1449 { |
9508 | 1450 gchar *pref; |
1451 const char *filename; | |
1452 | |
1453 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1454 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1455 filename = gaim_prefs_get_string(pref); | |
1456 g_free(pref); | |
1457 | |
1458 if (*filename == '\0') | |
1459 filename = NULL; | |
1460 | |
1461 gaim_request_file(prefs, _("Sound Selection"), filename, FALSE, | |
1462 G_CALLBACK(sound_chosen_cb), NULL, GINT_TO_POINTER(sound_row_sel)); | |
9150 | 1463 } |
1464 | |
9508 | 1465 static void prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) { |
9150 | 1466 GtkTreeIter iter; |
1467 GValue val = { 0, }; | |
1468 const char *file; | |
1469 char *pref; | |
1470 | |
1471 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1472 return; | |
1473 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1474 sound_row_sel = g_value_get_uint(&val); | |
1475 | |
1476 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1477 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1478 file = gaim_prefs_get_string(pref); | |
1479 g_free(pref); | |
1480 if (sound_entry) | |
1481 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1482 g_value_unset (&val); | |
1483 } | |
1484 | |
5440 | 1485 GtkWidget *sound_page() { |
1486 GtkWidget *ret; | |
9150 | 1487 GtkWidget *vbox, *sw, *button; |
5440 | 1488 GtkSizeGroup *sg; |
9150 | 1489 GtkTreeIter iter; |
1490 GtkWidget *event_view; | |
1491 GtkListStore *event_store; | |
1492 GtkCellRenderer *rend; | |
1493 GtkTreeViewColumn *col; | |
1494 GtkTreeSelection *sel; | |
1495 GtkTreePath *path; | |
1496 GtkWidget *hbox; | |
1497 int j; | |
1498 const char *file; | |
1499 char *pref; | |
5440 | 1500 #ifndef _WIN32 |
1501 GtkWidget *dd; | |
1502 GtkWidget *label; | |
6007 | 1503 GtkWidget *entry; |
5684 | 1504 const char *cmd; |
5440 | 1505 #endif |
1506 | |
1507 ret = gtk_vbox_new(FALSE, 18); | |
1508 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1509 | |
1510 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1511 | |
1512 #ifndef _WIN32 | |
6033 | 1513 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1514 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1515 "/gaim/gtk/sound/method", | |
1516 _("Console beep"), "beep", | |
5440 | 1517 #ifdef USE_AO |
7987 | 1518 _("Automatic"), "automatic", |
1519 "ESD", "esd", | |
1520 "Arts", "arts", | |
5440 | 1521 #endif |
1522 #ifdef USE_NAS_AUDIO | |
7987 | 1523 "NAS", "nas", |
5440 | 1524 #endif |
7987 | 1525 _("Command"), "custom", |
10074 | 1526 _("No sounds"), "none", |
7987 | 1527 NULL); |
5440 | 1528 gtk_size_group_add_widget(sg, dd); |
1529 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1530 | |
1531 hbox = gtk_hbox_new(FALSE, 5); | |
1532 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1533 | |
6031 | 1534 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1535 gtk_size_group_add_widget(sg, label); |
1536 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1537 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1538 | |
6007 | 1539 entry = gtk_entry_new(); |
1540 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1541 | |
1542 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1543 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1544 if(cmd) |
6007 | 1545 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1546 gtk_widget_set_size_request(entry, 75, -1); | |
1547 | |
1548 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1549 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1550 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1551 |
1552 gtk_widget_set_sensitive(hbox, | |
1553 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1554 "custom")); | |
10087 | 1555 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1556 sound_changed1_cb, hbox); | |
6005 | 1557 |
8141 | 1558 gaim_set_accessible_label (entry, label); |
5440 | 1559 #endif /* _WIN32 */ |
9150 | 1560 |
10074 | 1561 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
1562 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"), | |
1563 "/gaim/gtk/sound/conv_focus", vbox); | |
1564 gaim_gtk_prefs_checkbox(_("_Sounds while away"), | |
1565 "/core/sound/while_away", vbox); | |
1566 | |
10075 | 1567 #ifndef _WIN32 |
10074 | 1568 gtk_widget_set_sensitive(vbox, |
1569 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1570 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1571 sound_changed2_cb, vbox); | |
10075 | 1572 #endif |
10074 | 1573 |
9150 | 1574 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); |
1575 | |
1576 /* The following is an ugly hack to make the frame expand so the | |
1577 * sound events list is big enough to be usable */ | |
1578 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1579 GTK_PACK_START); | |
1580 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1581 TRUE, 0, GTK_PACK_START); | |
1582 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1583 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1584 | |
1585 sw = gtk_scrolled_window_new(NULL,NULL); | |
1586 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1587 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1588 | |
1589 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1590 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1591 | |
1592 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1593 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1594 gaim_gtk_sound_get_event_option(j)); | |
1595 const char *label = gaim_gtk_sound_get_event_label(j); | |
1596 | |
1597 if (label == NULL) { | |
1598 g_free(pref); | |
1599 continue; | |
1600 } | |
1601 | |
1602 gtk_list_store_append (event_store, &iter); | |
1603 gtk_list_store_set(event_store, &iter, | |
1604 0, gaim_prefs_get_bool(pref), | |
1605 1, _(label), | |
1606 2, pref, | |
1607 3, j, | |
1608 -1); | |
1609 g_free(pref); | |
1610 } | |
1611 | |
1612 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1613 | |
1614 rend = gtk_cell_renderer_toggle_new(); | |
1615 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1616 g_signal_connect (G_OBJECT (sel), "changed", | |
1617 G_CALLBACK (prefs_sound_sel), | |
1618 NULL); | |
1619 g_signal_connect (G_OBJECT(rend), "toggled", | |
1620 G_CALLBACK(event_toggled), event_store); | |
1621 path = gtk_tree_path_new_first(); | |
1622 gtk_tree_selection_select_path(sel, path); | |
1623 gtk_tree_path_free(path); | |
1624 | |
1625 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1626 rend, | |
1627 "active", 0, | |
1628 NULL); | |
1629 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1630 | |
1631 rend = gtk_cell_renderer_text_new(); | |
1632 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1633 rend, | |
1634 "text", 1, | |
1635 NULL); | |
1636 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1637 g_object_unref(G_OBJECT(event_store)); | |
1638 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1639 | |
1640 hbox = gtk_hbox_new(FALSE, 6); | |
1641 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1642 sound_entry = gtk_entry_new(); | |
1643 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1644 gaim_gtk_sound_get_event_option(0)); | |
1645 file = gaim_prefs_get_string(pref); | |
1646 g_free(pref); | |
1647 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1648 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1649 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1650 | |
1651 button = gtk_button_new_with_label(_("Test")); | |
1652 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1653 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1654 | |
1655 button = gtk_button_new_with_label(_("Reset")); | |
1656 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1657 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1658 | |
1659 button = gtk_button_new_with_label(_("Choose...")); | |
9508 | 1660 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(select_sound), NULL); |
9150 | 1661 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); |
5440 | 1662 gtk_widget_show_all(ret); |
9118 | 1663 |
10075 | 1664 #ifndef _WIN32 |
10074 | 1665 gtk_widget_set_sensitive(vbox, |
1666 strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), "none")); | |
10087 | 1667 gaim_prefs_connect_callback(prefs, "/gaim/gtk/sound/method", |
1668 sound_changed2_cb, vbox); | |
10075 | 1669 #endif |
10074 | 1670 |
5440 | 1671 return ret; |
1672 } | |
1673 | |
10182 | 1674 /* XXX CORE/UI */ |
1675 #if 0 | |
1676 static void | |
1677 set_default_away(GtkWidget *w, gpointer data) | |
1678 { | |
1679 struct away_message *default_away = NULL; | |
1680 int length = g_slist_length(away_messages); | |
1681 int i = GPOINTER_TO_INT(data); | |
1682 | |
1683 if (away_messages == NULL) | |
1684 default_away = NULL; | |
1685 else if (i >= length) | |
1686 default_away = g_slist_nth_data(away_messages, length - 1); | |
1687 else | |
1688 default_away = g_slist_nth_data(away_messages, i); | |
1689 | |
1690 if(default_away) | |
1691 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
1692 else | |
1693 gaim_prefs_set_string("/core/away/default_message", ""); | |
1694 } | |
1695 #endif | |
1696 | |
5440 | 1697 GtkWidget *away_page() { |
1698 GtkWidget *ret; | |
1699 GtkWidget *vbox; | |
1700 GtkWidget *hbox; | |
1701 GtkWidget *label; | |
1702 GtkWidget *button; | |
1703 GtkWidget *select; | |
1704 GtkWidget *dd; | |
1705 GtkSizeGroup *sg; | |
1706 | |
1707 ret = gtk_vbox_new(FALSE, 18); | |
1708 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1709 | |
1710 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1711 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1712 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1713 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1714 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1715 |
9596 | 1716 label = gaim_gtk_prefs_dropdown(vbox, _("_Auto-reply:"), |
1717 GAIM_PREF_STRING, "/core/away/auto_reply", | |
1718 _("Never"), "never", | |
9736 | 1719 _("When away"), "away", |
1720 _("When away and idle"), "awayidle", | |
9596 | 1721 NULL); |
6142 | 1722 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1723 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1724 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1725 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1726 _("None"), "none", | |
1727 _("Gaim usage"), "gaim", | |
5440 | 1728 #ifdef USE_SCREENSAVER |
1729 #ifndef _WIN32 | |
7987 | 1730 _("X usage"), "system", |
5440 | 1731 #else |
7987 | 1732 _("Windows usage"), "system", |
5440 | 1733 #endif |
1734 #endif | |
7987 | 1735 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1736 |
5440 | 1737 gtk_size_group_add_widget(sg, dd); |
1738 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1739 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1740 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1741 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1742 "/core/away/away_when_idle", vbox); |
8238 | 1743 |
7987 | 1744 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1745 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1746 1, 24 * 60, sg); | |
5440 | 1747 g_signal_connect(G_OBJECT(button), "clicked", |
1748 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1749 | |
8238 | 1750 hbox = gtk_hbox_new(FALSE, 0); |
1751 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1752 | |
5440 | 1753 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); |
1754 gtk_size_group_add_widget(sg, label); | |
1755 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
8238 | 1756 g_signal_connect(G_OBJECT(button), "clicked", |
1757 G_CALLBACK(gaim_gtk_toggle_sensitive), label); | |
5440 | 1758 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
8238 | 1759 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1760 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1761 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
8238 | 1762 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1763 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1764 |
5440 | 1765 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1766 |
5440 | 1767 return ret; |
1768 } | |
1769 | |
1770 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; | |
1771 | |
1772 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1773 { | |
1774 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1775 GtkTreeIter iter; | |
1776 GValue val = { 0, }; | |
1777 GaimPlugin *plug; | |
1778 | |
1779 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1780 return; | |
8104 | 1781 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1782 plug = g_value_get_pointer(&val); |
8998 | 1783 |
5440 | 1784 pname = g_markup_escape_text(_(plug->info->name), -1); |
9307 | 1785 pdesc = (plug->info->description) ? |
1786 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1787 pauth = (plug->info->author) ? | |
1788 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1789 pweb = (plug->info->homepage) ? | |
1790 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1791 | |
5440 | 1792 if (plug->error != NULL) { |
1793 perr = g_markup_escape_text(_(plug->error), -1); | |
1794 buf = g_strdup_printf( | |
1795 "<span size=\"larger\">%s %s</span>\n\n" | |
1796 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1797 "%s", | |
10386 | 1798 pname, plug->info->version, perr, pdesc ? pdesc : ""); |
5440 | 1799 g_free(perr); |
1800 } | |
1801 else { | |
1802 buf = g_strdup_printf( | |
1803 "<span size=\"larger\">%s %s</span>\n\n%s", | |
10386 | 1804 pname, plug->info->version, pdesc ? pdesc : ""); |
5440 | 1805 } |
1806 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1807 g_free(buf); | |
1808 | |
1809 buf = g_strdup_printf( | |
1810 #ifndef _WIN32 | |
1811 _("<span size=\"larger\">%s %s</span>\n\n" | |
1812 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1813 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1814 "<span weight=\"bold\">File name:</span>\t%s"), | |
1815 #else | |
1816 _("<span size=\"larger\">%s %s</span>\n\n" | |
1817 "<span weight=\"bold\">Written by:</span> %s\n" | |
1818 "<span weight=\"bold\">URL:</span> %s\n" | |
1819 "<span weight=\"bold\">File name:</span> %s"), | |
1820 #endif | |
10386 | 1821 pname, plug->info->version, pauth ? pauth : "", pweb ? pweb : "", plug->path); |
5440 | 1822 |
1823 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1824 g_value_unset(&val); | |
1825 g_free(buf); | |
1826 g_free(pname); | |
1827 g_free(pdesc); | |
1828 g_free(pauth); | |
1829 g_free(pweb); | |
1830 } | |
1831 | |
1832 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1833 { | |
1834 GtkTreeModel *model = (GtkTreeModel *)data; | |
1835 GtkTreeIter iter; | |
1836 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1837 GaimPlugin *plug; | |
1838 gchar buf[1024]; | |
6040 | 1839 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1840 |
5440 | 1841 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1842 gdk_window_set_cursor(prefs->window, wait); | |
1843 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1844 |
5440 | 1845 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1846 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1847 |
5440 | 1848 if (!gaim_plugin_is_loaded(plug)) { |
1849 gaim_plugin_load(plug); | |
1850 | |
1851 /* | |
1852 * NOTE: This is basically the same check as before | |
1853 * (plug->type == plugin), but now there aren't plugin types. | |
1854 * Not yet, anyway. I want to do a V2 of the plugin API. | |
1855 * The thing is, we should have a flag specifying the UI type, | |
1856 * or just whether it's a general plugin or a UI-specific | |
1857 * plugin. We should only load this if it's UI-specific. | |
1858 * | |
1859 * -- ChipX86 | |
1860 */ | |
1861 if (GAIM_IS_GTK_PLUGIN(plug)) | |
1862 { | |
1863 GtkWidget *config_frame; | |
1864 GaimGtkPluginUiInfo *ui_info; | |
1865 | |
1866 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1867 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1868 | |
1869 if (config_frame != NULL) { | |
1870 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1871 prefs_notebook_add_page(_(plug->info->name), NULL, | |
10078 | 1872 config_frame, ui_info->iter, |
1873 &plugin_iter, notebook_page++); | |
5440 | 1874 } |
1875 } | |
8713 | 1876 |
1877 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8998 | 1878 GtkTreeIter iter; |
8713 | 1879 GtkWidget *pref_frame; |
1880 GaimPluginUiInfo *prefs_info; | |
1881 | |
1882 if(plug->info->type == GAIM_PLUGIN_PROTOCOL) | |
1883 iter = proto_iter; | |
1884 else | |
1885 iter = plugin_iter; | |
1886 | |
1887 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 1888 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
1889 pref_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8713 | 1890 |
1891 if(pref_frame != NULL) { | |
1892 prefs_info->iter = g_new0(GtkTreeIter, 1); | |
1893 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1894 pref_frame, prefs_info->iter, | |
1895 &iter, notebook_page++); | |
1896 } | |
1897 } | |
5440 | 1898 } |
1899 else { | |
1900 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
1901 GaimGtkPluginUiInfo *ui_info; | |
1902 | |
1903 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1904 | |
1905 if (ui_info != NULL && ui_info->iter != NULL) { | |
1906 g_free(ui_info->iter); | |
1907 ui_info->iter = NULL; | |
1908 } | |
8745 | 1909 } |
1910 | |
1911 if (GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8713 | 1912 GaimPluginUiInfo *prefs_info; |
1913 | |
1914 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
1915 | |
8745 | 1916 if(prefs_info != NULL) { |
8814 | 1917 if(prefs_info->frame != NULL) { |
1918 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
1919 prefs_info->frame = NULL; | |
1920 } | |
1921 | |
8745 | 1922 if(prefs_info->iter != NULL) { |
1923 g_free(prefs_info->iter); | |
1924 prefs_info->iter = NULL; | |
1925 } | |
8713 | 1926 } |
5440 | 1927 } |
1928 | |
1929 gaim_plugin_unload(plug); | |
1930 } | |
1931 | |
1932 gdk_window_set_cursor(prefs->window, NULL); | |
1933 | |
6040 | 1934 name = g_markup_escape_text(_(plug->info->name), -1); |
1935 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 1936 if (plug->error != NULL) { |
6040 | 1937 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 1938 g_snprintf(buf, sizeof(buf), |
1939 "<span size=\"larger\">%s %s</span>\n\n" | |
1940 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1941 "%s", | |
6040 | 1942 name, plug->info->version, error, description); |
1943 g_free(error); | |
1944 } else { | |
5440 | 1945 g_snprintf(buf, sizeof(buf), |
1946 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 1947 name, plug->info->version, description); |
5440 | 1948 } |
6040 | 1949 g_free(name); |
1950 g_free(description); | |
5440 | 1951 |
1952 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1953 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
1954 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1955 |
5440 | 1956 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
1957 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1958 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
1959 gaim_gtk_plugins_save(); |
5440 | 1960 } |
1961 | |
1962 static void | |
1963 update_plugin_list(void *data) | |
1964 { | |
1965 GtkListStore *ls = GTK_LIST_STORE(data); | |
1966 GtkTreeIter iter; | |
1967 GList *probes; | |
1968 GaimPlugin *plug; | |
1969 | |
1970 gtk_list_store_clear(ls); | |
1971 | |
1972 for (probes = gaim_plugins_get_all(); | |
1973 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1974 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1975 { |
5440 | 1976 plug = probes->data; |
1977 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1978 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
1979 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1980 { |
5440 | 1981 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1982 } |
5440 | 1983 |
1984 gtk_list_store_append (ls, &iter); | |
1985 gtk_list_store_set(ls, &iter, | |
1986 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1987 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 1988 2, _(plug->info->summary), |
8104 | 1989 3, plug, -1); |
5440 | 1990 } |
1991 } | |
1992 | |
1993 static GtkWidget *plugin_page () | |
1994 { | |
1995 GtkWidget *ret; | |
1996 GtkWidget *sw, *vp; | |
1997 GtkWidget *event_view; | |
1998 GtkListStore *ls; | |
1999 GtkCellRenderer *rend, *rendt; | |
2000 GtkTreeViewColumn *col; | |
2001 GtkTreeSelection *sel; | |
2002 GtkTreePath *path; | |
2003 GtkWidget *nb; | |
2004 | |
2005 ret = gtk_vbox_new(FALSE, 18); | |
2006 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2007 | |
2008 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 2009 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 2010 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
2011 | |
2012 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2013 | |
8104 | 2014 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 2015 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
2016 1, GTK_SORT_ASCENDING); | |
5440 | 2017 |
2018 update_plugin_list(ls); | |
2019 | |
2020 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
2021 | |
2022 rend = gtk_cell_renderer_toggle_new(); | |
2023 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2024 | |
2025 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
2026 rend, | |
2027 "active", 0, | |
2028 NULL); | |
2029 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2030 | |
2031 rendt = gtk_cell_renderer_text_new(); | |
2032 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2033 rendt, | |
2034 "text", 1, | |
2035 NULL); | |
2036 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8998 | 2037 |
8104 | 2038 rendt = gtk_cell_renderer_text_new(); |
2039 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2040 rendt, | |
2041 "text", 2, | |
2042 NULL); | |
2043 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
8998 | 2044 |
5440 | 2045 g_object_unref(G_OBJECT(ls)); |
2046 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
8998 | 2047 |
5440 | 2048 |
2049 nb = gtk_notebook_new(); | |
2050 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2051 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
8998 | 2052 |
5440 | 2053 /* Description */ |
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_description = 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_description); | |
2063 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2064 | |
8998 | 2065 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); |
5440 | 2066 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); |
2067 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
2068 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
2069 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
2070 | |
2071 /* Details */ | |
2072 sw = gtk_scrolled_window_new(NULL, NULL); | |
2073 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2074 plugin_details = gtk_label_new(NULL); | |
8998 | 2075 |
5440 | 2076 vp = gtk_viewport_new(NULL, NULL); |
2077 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2078 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2079 | |
2080 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
2081 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2082 | |
8998 | 2083 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); |
5440 | 2084 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
2085 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
8998 | 2086 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); |
5440 | 2087 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); |
2088 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2089 | |
2090 g_signal_connect (G_OBJECT (sel), "changed", | |
2091 G_CALLBACK (prefs_plugin_sel), | |
8998 | 2092 NULL); |
5440 | 2093 g_signal_connect (G_OBJECT(rend), "toggled", |
2094 G_CALLBACK(plugin_load), ls); | |
2095 | |
2096 path = gtk_tree_path_new_first(); | |
2097 gtk_tree_selection_select_path(sel, path); | |
2098 gtk_tree_path_free(path); | |
2099 | |
2100 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2101 | |
2102 gtk_widget_show_all(ret); | |
2103 return ret; | |
2104 } | |
2105 | |
2106 GtkTreeIter *prefs_notebook_add_page(const char *text, | |
2107 GdkPixbuf *pixbuf, | |
2108 GtkWidget *page, | |
2109 GtkTreeIter *iter, | |
2110 GtkTreeIter *parent, | |
2111 int ind) { | |
2112 GdkPixbuf *icon = NULL; | |
2113 | |
2114 if (pixbuf) | |
2115 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2116 | |
2117 if (pixbuf) | |
2118 g_object_unref(pixbuf); | |
2119 if (icon) | |
2120 g_object_unref(icon); | |
2121 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
2122 return iter; | |
2123 } | |
2124 | |
2125 void prefs_notebook_init() { | |
9267 | 2126 GtkTreeIter p, c, c2; |
5440 | 2127 GList *l; |
2128 GaimPlugin *plug; | |
2129 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
9150 | 2130 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
9267 | 2131 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c2, &c, notebook_page++); |
2132 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c2, &c, notebook_page++); | |
2133 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | |
9150 | 2134 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
8238 | 2135 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
5440 | 2136 #ifndef _WIN32 |
2137 /* We use the registered default browser in windows */ | |
10060 | 2138 /* if the user is running gnome 2.x, hide the browsers tab */ |
10061 | 2139 if (gaim_running_gnome() == FALSE) { |
10060 | 2140 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); |
2141 } | |
5440 | 2142 #endif |
2143 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2144 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2145 | |
2146 if (gaim_plugins_enabled()) { | |
2147 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2148 | |
2149 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
8713 | 2150 plug = (GaimPlugin *)l->data; |
5440 | 2151 |
2152 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
2153 GtkWidget *config_frame; | |
2154 GaimGtkPluginUiInfo *ui_info; | |
2155 | |
2156 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
2157 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
2158 | |
2159 if (config_frame != NULL) { | |
2160 ui_info->iter = g_new0(GtkTreeIter, 1); | |
2161 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2162 config_frame, ui_info->iter, | |
2163 &plugin_iter, notebook_page++); | |
2164 } | |
2165 } | |
8713 | 2166 |
2167 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8745 | 2168 GtkWidget *gtk_frame; |
8713 | 2169 GaimPluginUiInfo *prefs_info; |
2170 | |
2171 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 2172 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
2173 gtk_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8745 | 2174 |
2175 if(GTK_IS_WIDGET(gtk_frame)) { | |
8713 | 2176 prefs_info->iter = g_new0(GtkTreeIter, 1); |
2177 prefs_notebook_add_page(_(plug->info->name), NULL, | |
8745 | 2178 gtk_frame, prefs_info->iter, |
9150 | 2179 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, |
8713 | 2180 notebook_page++); |
8814 | 2181 } else if(prefs_info->frame) { |
2182 /* in the event that there is a pref frame and we can | |
2183 * not make a widget out of it, we free the | |
2184 * pluginpref frame --Gary | |
2185 */ | |
2186 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
8713 | 2187 } |
2188 } | |
5440 | 2189 } |
2190 } | |
2191 } | |
2192 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2193 void gaim_gtk_prefs_show(void) |
5440 | 2194 { |
10078 | 2195 GtkWidget *vbox; |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2196 GtkWidget *bbox; |
5440 | 2197 GtkWidget *notebook; |
2198 GtkWidget *button; | |
2199 | |
2200 if (prefs) { | |
2201 gtk_window_present(GTK_WINDOW(prefs)); | |
2202 return; | |
2203 } | |
2204 | |
2205 /* copy the preferences to tmp values... | |
2206 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2207 /* (that should have been "effect," right?) */ |
2208 | |
5440 | 2209 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2210 | |
2211 /* Create the window */ | |
2212 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2213 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2214 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2215 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2216 gtk_container_set_border_width(GTK_CONTAINER(prefs), 12); |
5440 | 2217 g_signal_connect(G_OBJECT(prefs), "destroy", |
2218 G_CALLBACK(delete_prefs), NULL); | |
2219 | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2220 vbox = gtk_vbox_new(FALSE, 12); |
5440 | 2221 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
2222 gtk_widget_show(vbox); | |
2223 | |
2224 /* The notebook */ | |
2225 prefsnotebook = notebook = gtk_notebook_new (); | |
10078 | 2226 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_LEFT); |
2227 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE); | |
5440 | 2228 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); |
10078 | 2229 gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0); |
2230 | |
5440 | 2231 |
8713 | 2232 /* The buttons to press! */ |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2233 bbox = gtk_hbutton_box_new(); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2234 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2235 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
|
2236 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2237 gtk_widget_show (bbox); |
5440 | 2238 |
2239 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2240 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2241 G_CALLBACK(gtk_widget_destroy), prefs); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2242 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5440 | 2243 gtk_widget_show(button); |
2244 | |
2245 prefs_notebook_init(); | |
2246 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2247 /* Show everything. */ |
10078 | 2248 gtk_widget_show_all(prefs); |
5440 | 2249 } |
2250 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2251 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2252 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2253 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2254 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2255 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2256 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2257 |
7976 | 2258 GtkWidget * |
7987 | 2259 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2260 { |
2261 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2262 |
5440 | 2263 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2264 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2265 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2266 |
5440 | 2267 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
|
2268 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2269 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2270 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2271 |
5440 | 2272 gtk_widget_show(button); |
2273 | |
2274 return button; | |
2275 } | |
2276 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2277 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2278 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2279 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2280 { |
5841 | 2281 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2282 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2283 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2284 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2285 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2286 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2287 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2288 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2289 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2290 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2291 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2292 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2293 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2294 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2295 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2296 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2297 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2298 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2299 |
8283 | 2300 #ifndef _WIN32 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2301 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2302 gaim_prefs_add_none("/gaim/gtk/browsers"); |
8272 | 2303 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
|
2304 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2305 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
8283 | 2306 #endif |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2307 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2308 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2309 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2310 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2311 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2312 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2313 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2314 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2315 |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2316 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2317 gaim_prefs_add_none("/gaim/gtk/smileys"); |
9707 | 2318 gaim_prefs_add_string("/gaim/gtk/smileys/theme", "default"); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2319 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2320 /* Smiley Callbacks */ |
10087 | 2321 gaim_prefs_connect_callback(prefs, "/gaim/gtk/smileys/theme", |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2322 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2323 } |
8905 | 2324 |
2325 void gaim_gtk_prefs_update_old() { | |
2326 /* Rename some old prefs */ | |
2327 gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); | |
2328 gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); | |
2329 gaim_prefs_rename("/core/conversations/placement", | |
8998 | 2330 "/gaim/gtk/conversations/placement"); |
8905 | 2331 |
9025 | 2332 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2333 "/gaim/gtk/conversations/send_formatting"); | |
2334 | |
10307 | 2335 gaim_prefs_rename("/gaim/gtk/debug/timestamps", "/core/debug/timestamps"); |
2336 | |
8905 | 2337 /* Remove some no-longer-used prefs */ |
10398 | 2338 gaim_prefs_remove("/gaim/gtk/blist/auto_expand_contacts"); |
10133 | 2339 gaim_prefs_remove("/gaim/gtk/blist/button_style"); |
10168 | 2340 gaim_prefs_remove("/gaim/gtk/blist/grey_idle_buddies"); |
10133 | 2341 gaim_prefs_remove("/gaim/gtk/blist/raise_on_events"); |
8945 | 2342 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
10353 | 2343 gaim_prefs_remove("/gaim/gtk/blist/show_idle_time"); |
2344 gaim_prefs_remove("/gaim/gtk/blist/show_warning_level"); | |
10358 | 2345 gaim_prefs_remove("/gaim/gtk/conversations/button_type"); |
10398 | 2346 gaim_prefs_remove("/gaim/gtk/conversations/ctrl_enter_sends"); |
2347 gaim_prefs_remove("/gaim/gtk/conversations/enter_sends"); | |
10164 | 2348 gaim_prefs_remove("/gaim/gtk/conversations/html_shortcuts"); |
8946 | 2349 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
10398 | 2350 gaim_prefs_remove("/gaim/gtk/conversations/show_smileys"); |
2351 gaim_prefs_remove("/gaim/gtk/conversations/show_timestamps"); | |
8905 | 2352 gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links"); |
10164 | 2353 gaim_prefs_remove("/gaim/gtk/conversations/smiley_shortcuts"); |
9025 | 2354 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor"); |
2355 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor"); | |
2356 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size"); | |
10398 | 2357 gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete"); |
2358 gaim_prefs_remove("/gaim/gtk/conversations/chat/tab_completion"); | |
9301 | 2359 gaim_prefs_remove("/gaim/gtk/conversations/im/hide_on_send"); |
10398 | 2360 gaim_prefs_remove("/gaim/gtk/conversations/im/raise_on_events"); |
2361 gaim_prefs_remove("/gaim/gtk/conversations/chat/color_nicks"); | |
2362 gaim_prefs_remove("/gaim/gtk/conversations/chat/raise_on_events"); | |
2363 gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); | |
2364 gaim_prefs_remove("/gaim/gtk/sound/signon"); | |
2365 gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); | |
8905 | 2366 } |