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