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