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