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