Mercurial > pidgin.yaz
annotate src/gtkprefs.c @ 9318:01c50436203e
[gaim-migrate @ 10126]
i think this is more intelligent scaling. it would certainly be hard for it to be less intelligent scaling
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sat, 19 Jun 2004 17:34:29 +0000 |
parents | 2138b3a07cb8 |
children | 7b48e7c07bcf |
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 | |
9301 | 972 gaim_gtk_prefs_checkbox(_("Enable \"_slash\" commands"), |
973 "/gaim/gtk/conversations/enable_commands", vbox); | |
974 | |
8600 | 975 gaim_gtk_prefs_checkbox(_("Show _formatting toolbar"), |
7326
00a9ab26d607
[gaim-migrate @ 7912]
Christian Hammond <chipx86@chipx86.com>
parents:
7305
diff
changeset
|
976 "/gaim/gtk/conversations/show_formatting_toolbar", vbox); |
9155 | 977 gaim_gtk_prefs_checkbox(_("Show _aliases in tabs/titles"), |
8015 | 978 "/core/conversations/use_alias_for_title", vbox); |
9150 | 979 gaim_gtk_prefs_checkbox(_("Show buddy _icons"), |
980 "/gaim/gtk/conversations/im/show_buddy_icons", vbox); | |
9155 | 981 gaim_gtk_prefs_checkbox(_("Enable buddy ic_on animation"), |
9150 | 982 "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); |
9155 | 983 gaim_gtk_prefs_checkbox(_("_Notify buddies that you are typing to them"), |
9150 | 984 "/core/conversations/im/send_typing", vbox); |
9301 | 985 gaim_gtk_prefs_checkbox(_("_Raise IM window on events"), |
986 "/gaim/gtk/conversations/im/raise_on_events", vbox); | |
987 | |
9303 | 988 gaim_gtk_prefs_checkbox(_("Raise chat _window on events"), |
9301 | 989 "/gaim/gtk/conversations/chat/raise_on_events", vbox); |
9155 | 990 gaim_gtk_prefs_checkbox(_("Use _multi-colored screen names in chats"), |
991 "/gaim/gtk/conversations/chat/color_nicks", vbox); | |
992 | |
993 /* All the tab options! */ | |
994 vbox = gaim_gtk_make_frame(ret, _("Tab Options")); | |
995 | |
996 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
|
997 "/gaim/gtk/conversations/tabs", vbox); |
9155 | 998 |
999 /* | |
1000 * Connect a signal to the above preference. When conversations are not | |
1001 * shown in a tabbed window then all tabbing options should be disabled. | |
1002 */ | |
1003 vbox2 = gtk_vbox_new(FALSE, 0); | |
1004 gtk_box_pack_start(GTK_BOX(vbox), vbox2, FALSE, FALSE, 0); | |
1005 placement_pref_id = gaim_prefs_connect_callback("/gaim/gtk/conversations/tabs", | |
1006 conversation_usetabs_cb, | |
1007 vbox2); | |
1008 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) | |
1009 gtk_widget_set_sensitive(vbox2, FALSE); | |
1010 | |
1011 gaim_gtk_prefs_checkbox(_("Show _close button on tabs"), | |
1012 "/gaim/gtk/conversations/close_on_tabs", vbox2); | |
1013 | |
1014 label = gaim_gtk_prefs_dropdown(vbox2, _("Tab p_lacement:"), GAIM_PREF_INT, | |
8988 | 1015 "/gaim/gtk/conversations/tab_side", |
1016 _("Top"), GTK_POS_TOP, | |
1017 _("Bottom"), GTK_POS_BOTTOM, | |
1018 _("Left"), GTK_POS_LEFT, | |
1019 _("Right"), GTK_POS_RIGHT, | |
1020 NULL); | |
1021 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1022 gtk_size_group_add_widget(sg, label); | |
1023 | |
9155 | 1024 names = gaim_conv_placement_get_options(); |
9251 | 1025 label = gaim_gtk_prefs_dropdown_from_list(vbox2, _("New conversation _placement:"), |
9155 | 1026 GAIM_PREF_STRING, "/gaim/gtk/conversations/placement", names); |
1027 gtk_size_group_add_widget(sg, label); | |
1028 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1029 g_list_free(names); | |
1030 | |
5440 | 1031 gtk_widget_show_all(ret); |
1032 | |
1033 return ret; | |
1034 } | |
1035 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1036 static void network_ip_changed(GtkEntry *entry, gpointer data) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1037 { |
8834 | 1038 gaim_network_set_public_ip(gtk_entry_get_text(entry)); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1039 } |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1040 |
9150 | 1041 static void |
1042 proxy_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
1043 gpointer data) | |
1044 { | |
1045 GtkWidget *frame = data; | |
1046 const char *proxy = value; | |
1047 | |
1048 if (strcmp(proxy, "none") && strcmp(proxy, "envvar")) | |
1049 gtk_widget_set_sensitive(frame, TRUE); | |
1050 else | |
1051 gtk_widget_set_sensitive(frame, FALSE); | |
1052 } | |
1053 | |
1054 static void proxy_print_option(GtkEntry *entry, int entrynum) | |
1055 { | |
1056 if (entrynum == PROXYHOST) | |
1057 gaim_prefs_set_string("/core/proxy/host", gtk_entry_get_text(entry)); | |
1058 else if (entrynum == PROXYPORT) | |
1059 gaim_prefs_set_int("/core/proxy/port", atoi(gtk_entry_get_text(entry))); | |
1060 else if (entrynum == PROXYUSER) | |
1061 gaim_prefs_set_string("/core/proxy/username", gtk_entry_get_text(entry)); | |
1062 else if (entrynum == PROXYPASS) | |
1063 gaim_prefs_set_string("/core/proxy/password", gtk_entry_get_text(entry)); | |
1064 } | |
1065 | |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1066 GtkWidget *network_page() { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1067 GtkWidget *ret; |
9150 | 1068 GtkWidget *vbox, *hbox, *entry; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1069 GtkWidget *table, *label, *auto_ip_checkbox, *ports_checkbox, *spin_button; |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1070 GtkSizeGroup *sg; |
9150 | 1071 GaimProxyInfo *proxy_info; |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1072 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1073 ret = gtk_vbox_new(FALSE, 18); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1074 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1075 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1076 vbox = gaim_gtk_make_frame (ret, _("IP Address")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1077 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1078 auto_ip_checkbox = gaim_gtk_prefs_checkbox(_("_Autodetect IP Address"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1079 "/core/network/auto_ip", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1080 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1081 table = gtk_table_new(2, 1, FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1082 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1083 gtk_table_set_col_spacings(GTK_TABLE(table), 5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1084 gtk_table_set_row_spacings(GTK_TABLE(table), 10); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1085 gtk_container_add(GTK_CONTAINER(vbox), table); |
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 label = gtk_label_new_with_mnemonic(_("Public _IP:")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1088 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1089 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
|
1090 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1091 entry = gtk_entry_new(); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1092 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1093 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
|
1094 g_signal_connect(G_OBJECT(entry), "changed", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1095 G_CALLBACK(network_ip_changed), NULL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1096 |
8834 | 1097 if (gaim_network_get_public_ip() != NULL) |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1098 gtk_entry_set_text(GTK_ENTRY(entry), |
8834 | 1099 gaim_network_get_public_ip()); |
8231
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1100 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1101 gaim_set_accessible_label (entry, label); |
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 if (gaim_prefs_get_bool("/core/network/auto_ip")) { |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1105 gtk_widget_set_sensitive(GTK_WIDGET(table), FALSE); |
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 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1108 g_signal_connect(G_OBJECT(auto_ip_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1109 G_CALLBACK(gaim_gtk_toggle_sensitive), table); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1110 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1111 vbox = gaim_gtk_make_frame (ret, _("Ports")); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1112 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1113 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1114 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
|
1115 "/core/network/ports_range_use", vbox); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1116 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1117 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_Start Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1118 "/core/network/ports_range_start", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1119 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1120 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1121 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1122 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1123 |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1124 spin_button = gaim_gtk_prefs_labeled_spin_button(vbox, _("_End Port:"), |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1125 "/core/network/ports_range_end", 0, 65535, sg); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1126 if (!gaim_prefs_get_bool("/core/network/ports_range_use")) |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1127 gtk_widget_set_sensitive(GTK_WIDGET(spin_button), FALSE); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1128 g_signal_connect(G_OBJECT(ports_checkbox), "clicked", |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1129 G_CALLBACK(gaim_gtk_toggle_sensitive), spin_button); |
f50c059b6384
[gaim-migrate @ 8954]
Christian Hammond <chipx86@chipx86.com>
parents:
8188
diff
changeset
|
1130 |
9150 | 1131 vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); |
1132 prefs_proxy_frame = gtk_vbox_new(FALSE, 0); | |
7987 | 1133 gaim_gtk_prefs_dropdown(vbox, _("Proxy _type:"), GAIM_PREF_STRING, |
9150 | 1134 "/core/proxy/type", |
1135 _("No proxy"), "none", | |
1136 "SOCKS 4", "socks4", | |
1137 "SOCKS 5", "socks5", | |
1138 "HTTP", "http", | |
1139 _("Use Environmental Settings"), "envvar", | |
1140 NULL); | |
1141 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
|
1142 proxy_info = gaim_global_proxy_get_info(); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1143 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1144 if (proxy_info == NULL || |
6621 | 1145 gaim_proxy_info_get_type(proxy_info) == GAIM_PROXY_NONE || |
1146 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
|
1147 |
6001 | 1148 gtk_widget_set_sensitive(GTK_WIDGET(prefs_proxy_frame), FALSE); |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1149 } |
6001 | 1150 proxy_pref_id = gaim_prefs_connect_callback("/core/proxy/type", |
9150 | 1151 proxy_changed_cb, prefs_proxy_frame); |
1152 | |
1153 table = gtk_table_new(4, 2, FALSE); | |
5440 | 1154 gtk_container_set_border_width(GTK_CONTAINER(table), 5); |
1155 gtk_table_set_col_spacings(GTK_TABLE(table), 5); | |
1156 gtk_table_set_row_spacings(GTK_TABLE(table), 10); | |
9150 | 1157 gtk_container_add(GTK_CONTAINER(prefs_proxy_frame), table); |
5440 | 1158 |
1159 | |
7797 | 1160 label = gtk_label_new_with_mnemonic(_("_Host:")); |
5440 | 1161 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
1162 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); | |
1163 | |
1164 entry = gtk_entry_new(); | |
1165 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1166 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); | |
1167 g_signal_connect(G_OBJECT(entry), "changed", | |
1168 G_CALLBACK(proxy_print_option), (void *)PROXYHOST); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1169 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1170 if (proxy_info != NULL && gaim_proxy_info_get_host(proxy_info)) |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1171 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1172 gaim_proxy_info_get_host(proxy_info)); |
5440 | 1173 |
1174 hbox = gtk_hbox_new(TRUE, 5); | |
1175 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1176 gaim_set_accessible_label (entry, label); |
5440 | 1177 |
7870 | 1178 label = gtk_label_new_with_mnemonic(_("_Port:")); |
5440 | 1179 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1180 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1181 |
1182 entry = gtk_entry_new(); | |
1183 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1184 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 0, 1, GTK_FILL, 0, 0, 0); |
5440 | 1185 g_signal_connect(G_OBJECT(entry), "changed", |
1186 G_CALLBACK(proxy_print_option), (void *)PROXYPORT); | |
1187 | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1188 if (proxy_info != NULL && gaim_proxy_info_get_port(proxy_info) != 0) { |
5440 | 1189 char buf[128]; |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1190 g_snprintf(buf, sizeof(buf), "%d", |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1191 gaim_proxy_info_get_port(proxy_info)); |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1192 |
5440 | 1193 gtk_entry_set_text(GTK_ENTRY(entry), buf); |
1194 } | |
8137 | 1195 gaim_set_accessible_label (entry, label); |
5440 | 1196 |
7797 | 1197 label = gtk_label_new_with_mnemonic(_("_User:")); |
5440 | 1198 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1199 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1200 |
1201 entry = gtk_entry_new(); | |
1202 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1203 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1204 g_signal_connect(G_OBJECT(entry), "changed", |
1205 G_CALLBACK(proxy_print_option), (void *)PROXYUSER); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1206 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1207 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
|
1208 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1209 gaim_proxy_info_get_username(proxy_info)); |
5440 | 1210 |
1211 hbox = gtk_hbox_new(TRUE, 5); | |
1212 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
8137 | 1213 gaim_set_accessible_label (entry, label); |
5440 | 1214 |
7797 | 1215 label = gtk_label_new_with_mnemonic(_("Pa_ssword:")); |
5440 | 1216 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5); |
9150 | 1217 gtk_table_attach(GTK_TABLE(table), label, 2, 3, 1, 2, GTK_FILL, 0, 0, 0); |
5440 | 1218 |
1219 entry = gtk_entry_new(); | |
1220 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
9150 | 1221 gtk_table_attach(GTK_TABLE(table), entry, 3, 4, 1, 2, GTK_FILL , 0, 0, 0); |
5440 | 1222 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); |
1223 g_signal_connect(G_OBJECT(entry), "changed", | |
1224 G_CALLBACK(proxy_print_option), (void *)PROXYPASS); | |
5681
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1225 |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1226 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
|
1227 gtk_entry_set_text(GTK_ENTRY(entry), |
46d7ad0dfa26
[gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents:
5673
diff
changeset
|
1228 gaim_proxy_info_get_password(proxy_info)); |
8137 | 1229 gaim_set_accessible_label (entry, label); |
5440 | 1230 |
1231 gtk_widget_show_all(ret); | |
1232 return ret; | |
1233 } | |
1234 | |
1235 #ifndef _WIN32 | |
1236 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { | |
1237 const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); | |
1238 | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1239 gaim_prefs_set_string("/gaim/gtk/browsers/command", program); |
5440 | 1240 |
1241 /* carry on normally */ | |
1242 return FALSE; | |
1243 } | |
1244 | |
5633 | 1245 static GList *get_available_browsers() |
5440 | 1246 { |
1247 struct browser { | |
1248 char *name; | |
1249 char *command; | |
1250 }; | |
1251 | |
1252 static struct browser possible_browsers[] = { | |
5633 | 1253 {N_("Opera"), "opera"}, |
1254 {N_("Netscape"), "netscape"}, | |
1255 {N_("Mozilla"), "mozilla"}, | |
6070 | 1256 {N_("Konqueror"), "kfmclient"}, |
7916 | 1257 {N_("Galeon"), "galeon"}, |
8267 | 1258 {N_("Firebird"), "mozilla-firebird"}, |
8356 | 1259 {N_("Firefox"), "firefox"}, |
1260 {N_("Gnome Default"), "gnome-open"} | |
5440 | 1261 }; |
8356 | 1262 static const int num_possible_browsers = 8; |
5440 | 1263 |
1264 GList *browsers = NULL; | |
1265 int i = 0; | |
5819 | 1266 char *browser_setting = (char *)gaim_prefs_get_string("/gaim/gtk/browsers/browser"); |
5440 | 1267 |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1268 browsers = g_list_prepend(browsers, "custom"); |
5440 | 1269 browsers = g_list_prepend(browsers, _("Manual")); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1270 |
5440 | 1271 for (i = 0; i < num_possible_browsers; i++) { |
7108
6faeeecab0dc
[gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents:
7095
diff
changeset
|
1272 if (gaim_program_is_valid(possible_browsers[i].command)) { |
5633 | 1273 browsers = g_list_prepend(browsers, |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
1274 possible_browsers[i].command); |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1275 browsers = g_list_prepend(browsers, _(possible_browsers[i].name)); |
5825 | 1276 if(browser_setting && !strcmp(possible_browsers[i].command, browser_setting)) |
5819 | 1277 browser_setting = NULL; |
5440 | 1278 } |
1279 } | |
1280 | |
5819 | 1281 if(browser_setting) |
1282 gaim_prefs_set_string("/gaim/gtk/browsers/browser", "custom"); | |
1283 | |
5440 | 1284 return browsers; |
1285 } | |
1286 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1287 static void |
8274 | 1288 browser_changed1_cb(const char *name, GaimPrefType type, gpointer value, |
1289 gpointer data) | |
1290 { | |
1291 GtkWidget *hbox = data; | |
1292 const char *browser = value; | |
1293 | |
1294 gtk_widget_set_sensitive(hbox, strcmp(browser, "custom")); | |
1295 } | |
1296 | |
1297 static void | |
1298 browser_changed2_cb(const char *name, GaimPrefType type, gpointer value, | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1299 gpointer data) |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1300 { |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1301 GtkWidget *hbox = data; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1302 const char *browser = value; |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1303 |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1304 gtk_widget_set_sensitive(hbox, !strcmp(browser, "custom")); |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1305 } |
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
1306 |
5440 | 1307 GtkWidget *browser_page() { |
1308 GtkWidget *ret; | |
1309 GtkWidget *vbox; | |
1310 GtkWidget *hbox; | |
1311 GtkWidget *label; | |
6007 | 1312 GtkWidget *entry; |
5440 | 1313 GtkSizeGroup *sg; |
1314 GList *browsers = NULL; | |
1315 | |
1316 ret = gtk_vbox_new(FALSE, 18); | |
1317 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1318 | |
1319 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1320 vbox = gaim_gtk_make_frame (ret, _("Browser Selection")); |
5440 | 1321 |
1322 browsers = get_available_browsers(); | |
1323 if (browsers != NULL) { | |
7987 | 1324 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
|
1325 "/gaim/gtk/browsers/browser", |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1326 browsers); |
5440 | 1327 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); |
1328 gtk_size_group_add_widget(sg, label); | |
8274 | 1329 |
1330 hbox = gtk_hbox_new(FALSE, 0); | |
1331 label = gaim_gtk_prefs_dropdown(hbox, _("_Open link in:"), GAIM_PREF_INT, | |
1332 "/gaim/gtk/browsers/place", | |
1333 _("Browser default"), GAIM_BROWSER_DEFAULT, | |
1334 _("Existing window"), GAIM_BROWSER_CURRENT, | |
1335 _("New window"), GAIM_BROWSER_NEW_WINDOW, | |
1336 _("New tab"), GAIM_BROWSER_NEW_TAB, | |
1337 NULL); | |
1338 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1339 gtk_size_group_add_widget(sg, label); | |
1340 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1341 | |
1342 if (!strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) | |
1343 gtk_widget_set_sensitive(hbox, FALSE); | |
1344 browser_pref1_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser", | |
1345 browser_changed1_cb, hbox); | |
5440 | 1346 } |
1347 | |
1348 hbox = gtk_hbox_new(FALSE, 5); | |
1349 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
6031 | 1350 label = gtk_label_new_with_mnemonic(_("_Manual:\n(%s for URL)")); |
5440 | 1351 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); |
1352 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1353 gtk_size_group_add_widget(sg, label); | |
1354 | |
6007 | 1355 entry = gtk_entry_new(); |
1356 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1357 |
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1358 if (strcmp(gaim_prefs_get_string("/gaim/gtk/browsers/browser"), "custom")) |
5440 | 1359 gtk_widget_set_sensitive(hbox, FALSE); |
8274 | 1360 browser_pref2_id = gaim_prefs_connect_callback("/gaim/gtk/browsers/browser", |
1361 browser_changed2_cb, hbox); | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1362 |
6007 | 1363 gtk_box_pack_start (GTK_BOX (hbox), entry, FALSE, FALSE, 0); |
1364 | |
1365 gtk_entry_set_text(GTK_ENTRY(entry), | |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1366 gaim_prefs_get_string("/gaim/gtk/browsers/command")); |
6007 | 1367 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
5560
b7319c094153
[gaim-migrate @ 5961]
Christian Hammond <chipx86@chipx86.com>
parents:
5554
diff
changeset
|
1368 G_CALLBACK(manual_browser_set), NULL); |
8188
cd9ea20cd8ed
[gaim-migrate @ 8909]
Christian Hammond <chipx86@chipx86.com>
parents:
8170
diff
changeset
|
1369 gaim_set_accessible_label (entry, label); |
5440 | 1370 |
1371 gtk_widget_show_all(ret); | |
1372 return ret; | |
1373 } | |
1374 #endif /*_WIN32*/ | |
1375 | |
1376 GtkWidget *logging_page() { | |
1377 GtkWidget *ret; | |
1378 GtkWidget *vbox; | |
7431 | 1379 GList *names; |
8573 | 1380 GtkWidget *sys_box; |
1381 GtkWidget *box; | |
1382 int syslog_enabled = gaim_prefs_get_bool("/core/logging/log_system"); | |
1383 | |
5440 | 1384 ret = gtk_vbox_new(FALSE, 18); |
1385 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1386 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1387 vbox = gaim_gtk_make_frame (ret, _("Message Logs")); |
7431 | 1388 names = gaim_log_logger_get_options(); |
1389 | |
7987 | 1390 gaim_gtk_prefs_dropdown_from_list(vbox, _("Log _Format:"), GAIM_PREF_STRING, |
1391 "/core/logging/format", names); | |
1392 | |
1393 gaim_gtk_prefs_checkbox(_("_Log all instant messages"), | |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1394 "/core/logging/log_ims", vbox); |
7987 | 1395 gaim_gtk_prefs_checkbox(_("Log all c_hats"), |
7562
b859cfb5f31a
[gaim-migrate @ 8176]
Christian Hammond <chipx86@chipx86.com>
parents:
7561
diff
changeset
|
1396 "/core/logging/log_chats", vbox); |
8573 | 1397 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1398 vbox = gaim_gtk_make_frame (ret, _("System Logs")); |
8573 | 1399 |
1400 sys_box = gaim_gtk_prefs_checkbox(_("_Enable system log"), | |
1401 "/core/logging/log_system", vbox); | |
1402 | |
1403 box = gaim_gtk_prefs_checkbox(_("Log when buddies _sign on/sign off"), | |
1404 "/core/logging/log_signon_signoff", vbox); | |
1405 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1406 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1407 gtk_widget_set_sensitive(box, syslog_enabled); | |
1408 | |
1409 box = gaim_gtk_prefs_checkbox(_("Log when buddies become _idle/un-idle"), | |
1410 "/core/logging/log_idle_state", vbox); | |
1411 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1412 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1413 gtk_widget_set_sensitive(box, syslog_enabled); | |
1414 | |
1415 box = gaim_gtk_prefs_checkbox(_("Log when buddies go away/come _back"), | |
1416 "/core/logging/log_away_state", vbox); | |
1417 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1418 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1419 gtk_widget_set_sensitive(box, syslog_enabled); | |
1420 | |
1421 box = gaim_gtk_prefs_checkbox(_("Log your _own signons/idleness/awayness"), | |
1422 "/core/logging/log_own_states", vbox); | |
1423 g_signal_connect(G_OBJECT(sys_box), "clicked", | |
1424 G_CALLBACK(gaim_gtk_toggle_sensitive), box); | |
1425 gtk_widget_set_sensitive(box, syslog_enabled); | |
1426 | |
5440 | 1427 gtk_widget_show_all(ret); |
1428 return ret; | |
1429 } | |
1430 | |
1431 #ifndef _WIN32 | |
1432 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) | |
1433 { | |
5684 | 1434 gaim_prefs_set_string("/gaim/gtk/sound/command", |
6007 | 1435 gtk_entry_get_text(GTK_ENTRY(entry))); |
5440 | 1436 return TRUE; |
1437 } | |
6005 | 1438 |
1439 static void | |
1440 sound_changed_cb(const char *name, GaimPrefType type, gpointer value, | |
1441 gpointer data) | |
1442 { | |
1443 GtkWidget *hbox = data; | |
1444 const char *method = value; | |
1445 | |
1446 gtk_widget_set_sensitive(hbox, !strcmp(method, "custom")); | |
1447 } | |
5440 | 1448 #endif |
1449 | |
9150 | 1450 |
1451 static void | |
1452 event_toggled(GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1453 { | |
1454 GtkTreeModel *model = (GtkTreeModel *)data; | |
1455 GtkTreeIter iter; | |
1456 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1457 const char *pref; | |
1458 | |
1459 gtk_tree_model_get_iter (model, &iter, path); | |
1460 gtk_tree_model_get (model, &iter, | |
1461 2, &pref, | |
1462 -1); | |
1463 | |
1464 gaim_prefs_set_bool(pref, !gtk_cell_renderer_toggle_get_active(cell)); | |
1465 | |
1466 gtk_list_store_set(GTK_LIST_STORE (model), &iter, | |
1467 0, !gtk_cell_renderer_toggle_get_active(cell), | |
1468 -1); | |
1469 | |
1470 gtk_tree_path_free(path); | |
1471 } | |
1472 | |
1473 static void | |
1474 test_sound(GtkWidget *button, gpointer i_am_NULL) | |
1475 { | |
1476 char *pref; | |
1477 gboolean temp_value1, temp_value2; | |
1478 | |
1479 pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1480 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1481 | |
1482 temp_value1 = gaim_prefs_get_bool("/core/sound/while_away"); | |
1483 temp_value2 = gaim_prefs_get_bool(pref); | |
1484 | |
1485 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", TRUE); | |
1486 if (!temp_value2) gaim_prefs_set_bool(pref, TRUE); | |
1487 | |
1488 gaim_sound_play_event(sound_row_sel); | |
1489 | |
1490 if (!temp_value1) gaim_prefs_set_bool("/core/sound/while_away", FALSE); | |
1491 if (!temp_value2) gaim_prefs_set_bool(pref, FALSE); | |
1492 | |
1493 g_free(pref); | |
1494 } | |
1495 | |
1496 static void | |
1497 reset_sound(GtkWidget *button, gpointer i_am_also_NULL) | |
1498 { | |
1499 char *pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1500 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1501 | |
1502 /* This just resets a sound file back to default */ | |
1503 gaim_prefs_set_string(pref, ""); | |
1504 g_free(pref); | |
1505 | |
1506 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); | |
1507 } | |
1508 | |
1509 void close_sounddialog(GtkWidget *w, GtkWidget *w2) | |
1510 { | |
1511 | |
1512 GtkWidget *dest; | |
1513 | |
1514 if (!GTK_IS_WIDGET(w2)) | |
1515 dest = w; | |
1516 else | |
1517 dest = w2; | |
1518 | |
1519 sounddialog = NULL; | |
1520 | |
1521 gtk_widget_destroy(dest); | |
1522 } | |
1523 | |
1524 void do_select_sound(GtkWidget *w, gpointer data) | |
1525 { | |
1526 const char *file; | |
1527 char *pref; | |
1528 int snd; | |
1529 | |
1530 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog)); | |
1531 snd = GPOINTER_TO_INT(data); | |
1532 | |
1533 /* If they type in a directory, change there */ | |
1534 if (gaim_gtk_check_if_dir(file, GTK_FILE_SELECTION(sounddialog))) | |
1535 return; | |
1536 | |
1537 /* Set it -- and forget it */ | |
1538 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1539 gaim_gtk_sound_get_event_option(snd)); | |
1540 gaim_prefs_set_string(pref, file); | |
1541 g_free(pref); | |
1542 | |
1543 /* Set our text entry */ | |
1544 gtk_entry_set_text(GTK_ENTRY(sound_entry), file); | |
1545 | |
1546 /* Close the window! It's getting cold in here! */ | |
1547 close_sounddialog(NULL, sounddialog); | |
1548 | |
1549 if (last_sound_dir) | |
1550 g_free(last_sound_dir); | |
1551 last_sound_dir = g_path_get_dirname(file); | |
1552 } | |
1553 | |
1554 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) | |
1555 { | |
1556 char *buf = g_malloc(BUF_LEN); | |
1557 | |
1558 if (!sounddialog) { | |
1559 sounddialog = gtk_file_selection_new(_("Sound Selection")); | |
1560 | |
1561 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog)); | |
1562 | |
1563 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir()); | |
1564 | |
1565 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf); | |
1566 | |
1567 g_signal_connect(G_OBJECT(sounddialog), "destroy", | |
1568 G_CALLBACK(close_sounddialog), sounddialog); | |
1569 | |
1570 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), | |
1571 "clicked", | |
1572 G_CALLBACK(do_select_sound), GINT_TO_POINTER(sound_row_sel)); | |
1573 | |
1574 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), | |
1575 "clicked", | |
1576 G_CALLBACK(close_sounddialog), sounddialog); | |
1577 } | |
1578 | |
1579 g_free(buf); | |
1580 gtk_widget_show(sounddialog); | |
1581 gdk_window_raise(sounddialog->window); | |
1582 } | |
1583 | |
1584 | |
1585 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { | |
1586 GtkTreeIter iter; | |
1587 GValue val = { 0, }; | |
1588 const char *file; | |
1589 char *pref; | |
1590 | |
1591 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1592 return; | |
1593 gtk_tree_model_get_value (model, &iter, 3, &val); | |
1594 sound_row_sel = g_value_get_uint(&val); | |
1595 | |
1596 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1597 gaim_gtk_sound_get_event_option(sound_row_sel)); | |
1598 file = gaim_prefs_get_string(pref); | |
1599 g_free(pref); | |
1600 if (sound_entry) | |
1601 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1602 g_value_unset (&val); | |
1603 if (sounddialog) | |
1604 gtk_widget_destroy(sounddialog); | |
1605 } | |
1606 | |
5440 | 1607 GtkWidget *sound_page() { |
1608 GtkWidget *ret; | |
9150 | 1609 GtkWidget *vbox, *sw, *button; |
5440 | 1610 GtkSizeGroup *sg; |
9150 | 1611 GtkTreeIter iter; |
1612 GtkWidget *event_view; | |
1613 GtkListStore *event_store; | |
1614 GtkCellRenderer *rend; | |
1615 GtkTreeViewColumn *col; | |
1616 GtkTreeSelection *sel; | |
1617 GtkTreePath *path; | |
1618 GtkWidget *hbox; | |
1619 int j; | |
1620 const char *file; | |
1621 char *pref; | |
5440 | 1622 #ifndef _WIN32 |
1623 GtkWidget *dd; | |
1624 GtkWidget *label; | |
6007 | 1625 GtkWidget *entry; |
5684 | 1626 const char *cmd; |
5440 | 1627 #endif |
1628 | |
1629 ret = gtk_vbox_new(FALSE, 18); | |
1630 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1631 | |
1632 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1633 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1634 vbox = gaim_gtk_make_frame (ret, _("Sound Options")); |
8633 | 1635 gaim_gtk_prefs_checkbox(_("Sounds when conversation has _focus"), |
1636 "/gaim/gtk/sound/conv_focus", vbox); | |
7987 | 1637 gaim_gtk_prefs_checkbox(_("_Sounds while away"), |
5684 | 1638 "/core/sound/while_away", vbox); |
5440 | 1639 |
1640 #ifndef _WIN32 | |
6033 | 1641 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); |
7987 | 1642 dd = gaim_gtk_prefs_dropdown(vbox, _("_Method:"), GAIM_PREF_STRING, |
1643 "/gaim/gtk/sound/method", | |
1644 _("Console beep"), "beep", | |
5440 | 1645 #ifdef USE_AO |
7987 | 1646 _("Automatic"), "automatic", |
1647 "ESD", "esd", | |
1648 "Arts", "arts", | |
5440 | 1649 #endif |
1650 #ifdef USE_NAS_AUDIO | |
7987 | 1651 "NAS", "nas", |
5440 | 1652 #endif |
7987 | 1653 _("Command"), "custom", |
1654 NULL); | |
5440 | 1655 gtk_size_group_add_widget(sg, dd); |
1656 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1657 | |
1658 hbox = gtk_hbox_new(FALSE, 5); | |
1659 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); | |
1660 | |
6031 | 1661 label = gtk_label_new_with_mnemonic(_("Sound c_ommand:\n(%s for filename)")); |
5440 | 1662 gtk_size_group_add_widget(sg, label); |
1663 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
1664 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); | |
1665 | |
6007 | 1666 entry = gtk_entry_new(); |
1667 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); | |
1668 | |
1669 gtk_editable_set_editable(GTK_EDITABLE(entry), TRUE); | |
5684 | 1670 cmd = gaim_prefs_get_string("/gaim/gtk/sound/command"); |
5440 | 1671 if(cmd) |
6007 | 1672 gtk_entry_set_text(GTK_ENTRY(entry), cmd); |
1673 gtk_widget_set_size_request(entry, 75, -1); | |
1674 | |
1675 gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 5); | |
1676 g_signal_connect(G_OBJECT(entry), "changed", | |
5440 | 1677 G_CALLBACK(sound_cmd_yeah), NULL); |
6005 | 1678 |
1679 gtk_widget_set_sensitive(hbox, | |
1680 !strcmp(gaim_prefs_get_string("/gaim/gtk/sound/method"), | |
1681 "custom")); | |
1682 sound_pref_id = gaim_prefs_connect_callback("/gaim/gtk/sound/method", | |
1683 sound_changed_cb, hbox); | |
1684 | |
8141 | 1685 gaim_set_accessible_label (entry, label); |
5440 | 1686 #endif /* _WIN32 */ |
9150 | 1687 |
1688 vbox = gaim_gtk_make_frame(ret, _("Sound Events")); | |
1689 | |
1690 /* The following is an ugly hack to make the frame expand so the | |
1691 * sound events list is big enough to be usable */ | |
1692 gtk_box_set_child_packing(GTK_BOX(vbox->parent), vbox, TRUE, TRUE, 0, | |
1693 GTK_PACK_START); | |
1694 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent), vbox->parent, TRUE, | |
1695 TRUE, 0, GTK_PACK_START); | |
1696 gtk_box_set_child_packing(GTK_BOX(vbox->parent->parent->parent), | |
1697 vbox->parent->parent, TRUE, TRUE, 0, GTK_PACK_START); | |
1698 | |
1699 sw = gtk_scrolled_window_new(NULL,NULL); | |
1700 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); | |
1701 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
1702 | |
1703 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
1704 event_store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT); | |
1705 | |
1706 for (j=0; j < GAIM_NUM_SOUNDS; j++) { | |
1707 char *pref = g_strdup_printf("/gaim/gtk/sound/enabled/%s", | |
1708 gaim_gtk_sound_get_event_option(j)); | |
1709 const char *label = gaim_gtk_sound_get_event_label(j); | |
1710 | |
1711 if (label == NULL) { | |
1712 g_free(pref); | |
1713 continue; | |
1714 } | |
1715 | |
1716 gtk_list_store_append (event_store, &iter); | |
1717 gtk_list_store_set(event_store, &iter, | |
1718 0, gaim_prefs_get_bool(pref), | |
1719 1, _(label), | |
1720 2, pref, | |
1721 3, j, | |
1722 -1); | |
1723 g_free(pref); | |
1724 } | |
1725 | |
1726 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); | |
1727 | |
1728 rend = gtk_cell_renderer_toggle_new(); | |
1729 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
1730 g_signal_connect (G_OBJECT (sel), "changed", | |
1731 G_CALLBACK (prefs_sound_sel), | |
1732 NULL); | |
1733 g_signal_connect (G_OBJECT(rend), "toggled", | |
1734 G_CALLBACK(event_toggled), event_store); | |
1735 path = gtk_tree_path_new_first(); | |
1736 gtk_tree_selection_select_path(sel, path); | |
1737 gtk_tree_path_free(path); | |
1738 | |
1739 col = gtk_tree_view_column_new_with_attributes (_("Play"), | |
1740 rend, | |
1741 "active", 0, | |
1742 NULL); | |
1743 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1744 | |
1745 rend = gtk_cell_renderer_text_new(); | |
1746 col = gtk_tree_view_column_new_with_attributes (_("Event"), | |
1747 rend, | |
1748 "text", 1, | |
1749 NULL); | |
1750 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
1751 g_object_unref(G_OBJECT(event_store)); | |
1752 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
1753 | |
1754 hbox = gtk_hbox_new(FALSE, 6); | |
1755 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
1756 sound_entry = gtk_entry_new(); | |
1757 pref = g_strdup_printf("/gaim/gtk/sound/file/%s", | |
1758 gaim_gtk_sound_get_event_option(0)); | |
1759 file = gaim_prefs_get_string(pref); | |
1760 g_free(pref); | |
1761 gtk_entry_set_text(GTK_ENTRY(sound_entry), (file && *file != '\0') ? file : "(default)"); | |
1762 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE); | |
1763 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); | |
1764 | |
1765 button = gtk_button_new_with_label(_("Test")); | |
1766 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL); | |
1767 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1768 | |
1769 button = gtk_button_new_with_label(_("Reset")); | |
1770 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL); | |
1771 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
1772 | |
1773 button = gtk_button_new_with_label(_("Choose...")); | |
1774 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL); | |
1775 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); | |
5440 | 1776 gtk_widget_show_all(ret); |
9118 | 1777 |
5440 | 1778 return ret; |
1779 } | |
1780 | |
1781 GtkWidget *away_page() { | |
1782 GtkWidget *ret; | |
1783 GtkWidget *vbox; | |
1784 GtkWidget *hbox; | |
1785 GtkWidget *label; | |
1786 GtkWidget *button; | |
1787 GtkWidget *select; | |
1788 GtkWidget *dd; | |
1789 GtkSizeGroup *sg; | |
1790 | |
1791 ret = gtk_vbox_new(FALSE, 18); | |
1792 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
1793 | |
1794 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); | |
1795 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1796 vbox = gaim_gtk_make_frame (ret, _("Away")); |
7987 | 1797 gaim_gtk_prefs_checkbox(_("_Queue new messages when away"), |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
1798 "/gaim/gtk/away/queue_messages", vbox); |
5440 | 1799 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1800 vbox = gaim_gtk_make_frame (ret, _("Auto-response")); |
7987 | 1801 gaim_gtk_prefs_checkbox(_("_Send auto-response"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1802 "/core/away/auto_response/enabled", vbox); |
7987 | 1803 gaim_gtk_prefs_checkbox(_("_Only send auto-response when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1804 "/core/away/auto_response/idle_only", vbox); |
6142 | 1805 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1806 vbox = gaim_gtk_make_frame (ret, _("Idle")); |
7987 | 1807 dd = gaim_gtk_prefs_dropdown(vbox, _("Idle _time reporting:"), |
1808 GAIM_PREF_STRING, "/gaim/gtk/idle/reporting_method", | |
1809 _("None"), "none", | |
1810 _("Gaim usage"), "gaim", | |
5440 | 1811 #ifdef USE_SCREENSAVER |
1812 #ifndef _WIN32 | |
7987 | 1813 _("X usage"), "system", |
5440 | 1814 #else |
7987 | 1815 _("Windows usage"), "system", |
5440 | 1816 #endif |
1817 #endif | |
7987 | 1818 NULL); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1819 |
5440 | 1820 gtk_size_group_add_widget(sg, dd); |
1821 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); | |
1822 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
1823 vbox = gaim_gtk_make_frame (ret, _("Auto-away")); |
7987 | 1824 button = gaim_gtk_prefs_checkbox(_("Set away _when idle"), |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
1825 "/core/away/away_when_idle", vbox); |
8238 | 1826 |
7987 | 1827 select = gaim_gtk_prefs_labeled_spin_button(vbox, |
1828 _("_Minutes before setting away:"), "/core/away/mins_before_away", | |
1829 1, 24 * 60, sg); | |
5440 | 1830 g_signal_connect(G_OBJECT(button), "clicked", |
1831 G_CALLBACK(gaim_gtk_toggle_sensitive), select); | |
1832 | |
8238 | 1833 hbox = gtk_hbox_new(FALSE, 0); |
1834 gtk_container_add(GTK_CONTAINER(vbox), hbox); | |
1835 | |
5440 | 1836 label = gtk_label_new_with_mnemonic(_("Away m_essage:")); |
1837 gtk_size_group_add_widget(sg, label); | |
1838 gtk_misc_set_alignment(GTK_MISC(label), 0, 0); | |
8238 | 1839 g_signal_connect(G_OBJECT(button), "clicked", |
1840 G_CALLBACK(gaim_gtk_toggle_sensitive), label); | |
5440 | 1841 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); |
8238 | 1842 |
5440 | 1843 prefs_away_menu = gtk_option_menu_new(); |
1844 gtk_label_set_mnemonic_widget(GTK_LABEL(label), prefs_away_menu); | |
1845 g_signal_connect(G_OBJECT(button), "clicked", | |
1846 G_CALLBACK(gaim_gtk_toggle_sensitive), prefs_away_menu); | |
1847 default_away_menu_init(prefs_away_menu); | |
1848 gtk_widget_show(prefs_away_menu); | |
1849 gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); | |
8238 | 1850 gaim_set_accessible_label (prefs_away_menu, label); |
1851 | |
5440 | 1852 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1853 if (!gaim_prefs_get_bool("/core/away/away_when_idle")) { |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1854 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); |
8238 | 1855 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1856 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1857 } |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1858 |
5440 | 1859 gtk_widget_show_all(ret); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
1860 |
5440 | 1861 return ret; |
1862 } | |
1863 | |
9150 | 1864 #if 0 |
8170 | 1865 static GtkWidget * |
1866 protocol_page() { | |
1867 GtkWidget *ret; | |
8998 | 1868 |
8170 | 1869 ret = gtk_label_new(NULL); |
1870 gtk_widget_show(ret); | |
8998 | 1871 |
8170 | 1872 return ret; |
1873 } | |
9150 | 1874 #endif |
8170 | 1875 |
5440 | 1876 static GtkWidget *plugin_description=NULL, *plugin_details=NULL; |
1877 | |
1878 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model) | |
1879 { | |
1880 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb; | |
1881 GtkTreeIter iter; | |
1882 GValue val = { 0, }; | |
1883 GaimPlugin *plug; | |
1884 | |
1885 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
1886 return; | |
8104 | 1887 gtk_tree_model_get_value (model, &iter, 3, &val); |
5440 | 1888 plug = g_value_get_pointer(&val); |
8998 | 1889 |
5440 | 1890 pname = g_markup_escape_text(_(plug->info->name), -1); |
9307 | 1891 pdesc = (plug->info->description) ? |
1892 g_markup_escape_text(_(plug->info->description), -1) : NULL; | |
1893 pauth = (plug->info->author) ? | |
1894 g_markup_escape_text(_(plug->info->author), -1) : NULL; | |
1895 pweb = (plug->info->homepage) ? | |
1896 g_markup_escape_text(_(plug->info->homepage), -1) : NULL; | |
1897 | |
5440 | 1898 if (plug->error != NULL) { |
1899 perr = g_markup_escape_text(_(plug->error), -1); | |
1900 buf = g_strdup_printf( | |
1901 "<span size=\"larger\">%s %s</span>\n\n" | |
1902 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
1903 "%s", | |
1904 pname, plug->info->version, perr, pdesc); | |
1905 g_free(perr); | |
1906 } | |
1907 else { | |
1908 buf = g_strdup_printf( | |
1909 "<span size=\"larger\">%s %s</span>\n\n%s", | |
1910 pname, plug->info->version, pdesc); | |
1911 } | |
1912 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
1913 g_free(buf); | |
1914 | |
1915 buf = g_strdup_printf( | |
1916 #ifndef _WIN32 | |
1917 _("<span size=\"larger\">%s %s</span>\n\n" | |
1918 "<span weight=\"bold\">Written by:</span>\t%s\n" | |
1919 "<span weight=\"bold\">Web site:</span>\t\t%s\n" | |
1920 "<span weight=\"bold\">File name:</span>\t%s"), | |
1921 #else | |
1922 _("<span size=\"larger\">%s %s</span>\n\n" | |
1923 "<span weight=\"bold\">Written by:</span> %s\n" | |
1924 "<span weight=\"bold\">URL:</span> %s\n" | |
1925 "<span weight=\"bold\">File name:</span> %s"), | |
1926 #endif | |
1927 pname, plug->info->version, pauth, pweb, plug->path); | |
1928 | |
1929 gtk_label_set_markup(GTK_LABEL(plugin_details), buf); | |
1930 g_value_unset(&val); | |
1931 g_free(buf); | |
1932 g_free(pname); | |
1933 g_free(pdesc); | |
1934 g_free(pauth); | |
1935 g_free(pweb); | |
1936 } | |
1937 | |
1938 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data) | |
1939 { | |
1940 GtkTreeModel *model = (GtkTreeModel *)data; | |
1941 GtkTreeIter iter; | |
1942 GtkTreePath *path = gtk_tree_path_new_from_string(pth); | |
1943 GaimPlugin *plug; | |
1944 gchar buf[1024]; | |
6040 | 1945 gchar *name = NULL, *description = NULL; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1946 |
5440 | 1947 GdkCursor *wait = gdk_cursor_new (GDK_WATCH); |
1948 gdk_window_set_cursor(prefs->window, wait); | |
1949 gdk_cursor_unref(wait); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1950 |
5440 | 1951 gtk_tree_model_get_iter (model, &iter, path); |
8104 | 1952 gtk_tree_model_get (model, &iter, 3, &plug, -1); |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1953 |
5440 | 1954 if (!gaim_plugin_is_loaded(plug)) { |
1955 gaim_plugin_load(plug); | |
1956 | |
1957 /* | |
1958 * NOTE: This is basically the same check as before | |
1959 * (plug->type == plugin), but now there aren't plugin types. | |
1960 * Not yet, anyway. I want to do a V2 of the plugin API. | |
1961 * The thing is, we should have a flag specifying the UI type, | |
1962 * or just whether it's a general plugin or a UI-specific | |
1963 * plugin. We should only load this if it's UI-specific. | |
1964 * | |
1965 * -- ChipX86 | |
1966 */ | |
1967 if (GAIM_IS_GTK_PLUGIN(plug)) | |
1968 { | |
1969 GtkWidget *config_frame; | |
1970 GaimGtkPluginUiInfo *ui_info; | |
1971 | |
1972 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
1973 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
1974 | |
1975 if (config_frame != NULL) { | |
1976 ui_info->iter = g_new0(GtkTreeIter, 1); | |
1977 prefs_notebook_add_page(_(plug->info->name), NULL, | |
1978 config_frame, ui_info->iter, | |
1979 &plugin_iter, notebook_page++); | |
1980 | |
1981 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), | |
1982 &plugin_iter) == 1) { | |
1983 | |
1984 /* Expand the tree for the first plugin added */ | |
1985 GtkTreePath *path2; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
1986 |
5440 | 1987 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), |
1988 &plugin_iter); | |
1989 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), | |
1990 path2, TRUE); | |
1991 gtk_tree_path_free(path2); | |
1992 } | |
1993 } | |
1994 } | |
8713 | 1995 |
1996 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8998 | 1997 GtkTreeIter iter; |
8713 | 1998 GtkWidget *pref_frame; |
1999 GaimPluginUiInfo *prefs_info; | |
2000 | |
2001 if(plug->info->type == GAIM_PLUGIN_PROTOCOL) | |
2002 iter = proto_iter; | |
2003 else | |
2004 iter = plugin_iter; | |
2005 | |
2006 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 2007 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
2008 pref_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8713 | 2009 |
2010 if(pref_frame != NULL) { | |
2011 prefs_info->iter = g_new0(GtkTreeIter, 1); | |
2012 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2013 pref_frame, prefs_info->iter, | |
2014 &iter, notebook_page++); | |
2015 | |
2016 if(gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree), &iter) == 1) | |
2017 { | |
2018 GtkTreePath *path2; | |
2019 | |
2020 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree), &iter); | |
2021 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v), path2, TRUE); | |
2022 gtk_tree_path_free(path2); | |
2023 } | |
2024 } | |
2025 } | |
5440 | 2026 } |
2027 else { | |
2028 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
2029 GaimGtkPluginUiInfo *ui_info; | |
2030 | |
2031 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
2032 | |
2033 if (ui_info != NULL && ui_info->iter != NULL) { | |
2034 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), ui_info->iter); | |
2035 g_free(ui_info->iter); | |
2036 ui_info->iter = NULL; | |
2037 } | |
8745 | 2038 } |
2039 | |
2040 if (GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8713 | 2041 GaimPluginUiInfo *prefs_info; |
2042 | |
2043 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
2044 | |
8745 | 2045 if(prefs_info != NULL) { |
8814 | 2046 if(prefs_info->frame != NULL) { |
2047 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
2048 prefs_info->frame = NULL; | |
2049 } | |
2050 | |
8745 | 2051 if(prefs_info->iter != NULL) { |
2052 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), prefs_info->iter); | |
2053 g_free(prefs_info->iter); | |
2054 prefs_info->iter = NULL; | |
2055 } | |
8713 | 2056 } |
5440 | 2057 } |
2058 | |
2059 gaim_plugin_unload(plug); | |
2060 } | |
2061 | |
2062 gdk_window_set_cursor(prefs->window, NULL); | |
2063 | |
6040 | 2064 name = g_markup_escape_text(_(plug->info->name), -1); |
2065 description = g_markup_escape_text(_(plug->info->description), -1); | |
5440 | 2066 if (plug->error != NULL) { |
6040 | 2067 gchar *error = g_markup_escape_text(plug->error, -1); |
5440 | 2068 g_snprintf(buf, sizeof(buf), |
2069 "<span size=\"larger\">%s %s</span>\n\n" | |
2070 "<span weight=\"bold\" color=\"red\">%s</span>\n\n" | |
2071 "%s", | |
6040 | 2072 name, plug->info->version, error, description); |
2073 g_free(error); | |
2074 } else { | |
5440 | 2075 g_snprintf(buf, sizeof(buf), |
2076 "<span size=\"larger\">%s %s</span>\n\n%s", | |
6040 | 2077 name, plug->info->version, description); |
5440 | 2078 } |
6040 | 2079 g_free(name); |
2080 g_free(description); | |
5440 | 2081 |
2082 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); | |
2083 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, | |
2084 gaim_plugin_is_loaded(plug), -1); | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2085 |
5440 | 2086 gtk_label_set_markup(GTK_LABEL(plugin_description), buf); |
2087 gtk_tree_path_free(path); | |
5981
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
2088 |
81564bb4db68
[gaim-migrate @ 6429]
Christian Hammond <chipx86@chipx86.com>
parents:
5966
diff
changeset
|
2089 gaim_gtk_plugins_save(); |
5440 | 2090 } |
2091 | |
2092 static void | |
2093 update_plugin_list(void *data) | |
2094 { | |
2095 GtkListStore *ls = GTK_LIST_STORE(data); | |
2096 GtkTreeIter iter; | |
2097 GList *probes; | |
2098 GaimPlugin *plug; | |
2099 | |
2100 gtk_list_store_clear(ls); | |
2101 | |
2102 for (probes = gaim_plugins_get_all(); | |
2103 probes != NULL; | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2104 probes = probes->next) |
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2105 { |
5440 | 2106 plug = probes->data; |
2107 | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2108 if (plug->info->type != GAIM_PLUGIN_STANDARD || |
6930
31c45d99e1a8
[gaim-migrate @ 7477]
Christian Hammond <chipx86@chipx86.com>
parents:
6928
diff
changeset
|
2109 (plug->info->flags & GAIM_PLUGIN_FLAG_INVISIBLE)) |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2110 { |
5440 | 2111 continue; |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2112 } |
5440 | 2113 |
2114 gtk_list_store_append (ls, &iter); | |
2115 gtk_list_store_set(ls, &iter, | |
2116 0, gaim_plugin_is_loaded(plug), | |
6928
6ed0a1c045b4
[gaim-migrate @ 7475]
Christian Hammond <chipx86@chipx86.com>
parents:
6861
diff
changeset
|
2117 1, plug->info->name ? _(plug->info->name) : plug->path, |
8162 | 2118 2, _(plug->info->summary), |
8104 | 2119 3, plug, -1); |
5440 | 2120 } |
2121 } | |
2122 | |
2123 static GtkWidget *plugin_page () | |
2124 { | |
2125 GtkWidget *ret; | |
2126 GtkWidget *sw, *vp; | |
2127 GtkWidget *event_view; | |
2128 GtkListStore *ls; | |
2129 GtkCellRenderer *rend, *rendt; | |
2130 GtkTreeViewColumn *col; | |
2131 GtkTreeSelection *sel; | |
2132 GtkTreePath *path; | |
2133 GtkWidget *nb; | |
2134 | |
2135 ret = gtk_vbox_new(FALSE, 18); | |
2136 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2137 | |
2138 sw = gtk_scrolled_window_new(NULL,NULL); | |
8104 | 2139 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 2140 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
2141 | |
2142 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); | |
2143 | |
8104 | 2144 ls = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); |
7939 | 2145 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), |
2146 1, GTK_SORT_ASCENDING); | |
5440 | 2147 |
2148 update_plugin_list(ls); | |
2149 | |
2150 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls)); | |
2151 | |
2152 rend = gtk_cell_renderer_toggle_new(); | |
2153 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
2154 | |
2155 col = gtk_tree_view_column_new_with_attributes (_("Load"), | |
2156 rend, | |
2157 "active", 0, | |
2158 NULL); | |
2159 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2160 | |
2161 rendt = gtk_cell_renderer_text_new(); | |
2162 col = gtk_tree_view_column_new_with_attributes (_("Name"), | |
2163 rendt, | |
2164 "text", 1, | |
2165 NULL); | |
2166 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
8998 | 2167 |
8104 | 2168 rendt = gtk_cell_renderer_text_new(); |
2169 col = gtk_tree_view_column_new_with_attributes(_("Summary"), | |
2170 rendt, | |
2171 "text", 2, | |
2172 NULL); | |
2173 gtk_tree_view_append_column(GTK_TREE_VIEW(event_view), col); | |
8998 | 2174 |
5440 | 2175 g_object_unref(G_OBJECT(ls)); |
2176 gtk_container_add(GTK_CONTAINER(sw), event_view); | |
8998 | 2177 |
5440 | 2178 |
2179 nb = gtk_notebook_new(); | |
2180 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM); | |
2181 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb)); | |
8998 | 2182 |
5440 | 2183 /* Description */ |
2184 sw = gtk_scrolled_window_new(NULL, NULL); | |
2185 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2186 plugin_description = gtk_label_new(NULL); | |
8998 | 2187 |
5440 | 2188 vp = gtk_viewport_new(NULL, NULL); |
2189 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2190 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2191 | |
2192 gtk_container_add(GTK_CONTAINER(vp), plugin_description); | |
2193 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2194 | |
8998 | 2195 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE); |
5440 | 2196 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE); |
2197 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0); | |
2198 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6); | |
2199 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description"))); | |
2200 | |
2201 /* Details */ | |
2202 sw = gtk_scrolled_window_new(NULL, NULL); | |
2203 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); | |
2204 plugin_details = gtk_label_new(NULL); | |
8998 | 2205 |
5440 | 2206 vp = gtk_viewport_new(NULL, NULL); |
2207 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE); | |
2208 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE); | |
2209 | |
2210 gtk_container_add(GTK_CONTAINER(vp), plugin_details); | |
2211 gtk_container_add(GTK_CONTAINER(sw), vp); | |
2212 | |
8998 | 2213 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE); |
5440 | 2214 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE); |
2215 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0); | |
8998 | 2216 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6); |
5440 | 2217 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details"))); |
2218 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0); | |
2219 | |
2220 g_signal_connect (G_OBJECT (sel), "changed", | |
2221 G_CALLBACK (prefs_plugin_sel), | |
8998 | 2222 NULL); |
5440 | 2223 g_signal_connect (G_OBJECT(rend), "toggled", |
2224 G_CALLBACK(plugin_load), ls); | |
2225 | |
2226 path = gtk_tree_path_new_first(); | |
2227 gtk_tree_selection_select_path(sel, path); | |
2228 gtk_tree_path_free(path); | |
2229 | |
2230 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls); | |
2231 | |
2232 gtk_widget_show_all(ret); | |
2233 return ret; | |
2234 } | |
2235 | |
6979 | 2236 static void away_message_sel_cb(GtkTreeSelection *sel, GtkTreeModel *model) |
5440 | 2237 { |
2238 GtkTreeIter iter; | |
2239 GValue val = { 0, }; | |
2240 gchar buffer[BUF_LONG]; | |
2241 char *tmp; | |
2242 struct away_message *am; | |
2243 | |
2244 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2245 return; | |
2246 gtk_tree_model_get_value (model, &iter, 1, &val); | |
2247 am = g_value_get_pointer(&val); | |
2248 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
2249 strncpy(buffer, am->message, BUF_LONG); | |
2250 tmp = stylize(buffer, BUF_LONG); | |
6982 | 2251 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, GTK_IMHTML_NO_TITLE | |
5440 | 2252 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
6982 | 2253 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", GTK_IMHTML_NO_TITLE | |
5440 | 2254 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); |
2255 g_free(tmp); | |
2256 g_value_unset (&val); | |
2257 | |
2258 } | |
2259 | |
6979 | 2260 static gboolean away_message_click_cb(GtkWidget *tv, GdkEventButton *event, gpointer null) |
2261 { | |
2262 /* Only respond to double click on button 1 */ | |
2263 if ((event->button != 1) || (event->type != GDK_2BUTTON_PRESS)) | |
2264 return FALSE; | |
2265 | |
2266 /* Show the edit away message dialog */ | |
2267 create_away_mess(NULL, tv); | |
2268 | |
2269 return FALSE; | |
2270 } | |
2271 | |
5440 | 2272 void remove_away_message(GtkWidget *widget, GtkTreeView *tv) { |
6016 | 2273 struct away_message *am; |
5440 | 2274 GtkTreeIter iter; |
2275 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); | |
2276 GtkTreeModel *model = GTK_TREE_MODEL(prefs_away_store); | |
2277 GValue val = { 0, }; | |
2278 | |
2279 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
2280 return; | |
2281 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store), &iter, 1, &val); | |
2282 am = g_value_get_pointer (&val); | |
2283 gtk_imhtml_clear(GTK_IMHTML(away_text)); | |
2284 rem_away_mess(NULL, am); | |
2285 } | |
2286 | |
2287 GtkWidget *away_message_page() { | |
2288 GtkWidget *ret; | |
2289 GtkWidget *hbox; | |
2290 GtkWidget *button; | |
2291 GtkWidget *sw; | |
2292 GtkTreeIter iter; | |
2293 GtkWidget *event_view; | |
2294 GtkCellRenderer *rend; | |
2295 GtkTreeViewColumn *col; | |
2296 GtkTreeSelection *sel; | |
2297 GSList *awy = away_messages; | |
2298 struct away_message *a; | |
2299 GtkSizeGroup *sg; | |
2300 | |
2301 ret = gtk_vbox_new(FALSE, 18); | |
2302 gtk_container_set_border_width (GTK_CONTAINER (ret), 12); | |
2303 | |
2304 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | |
2305 | |
2306 sw = gtk_scrolled_window_new(NULL,NULL); | |
7931 | 2307 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
7929 | 2308 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
5440 | 2309 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
2310 | |
7940 | 2311 prefs_away_store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_POINTER); |
5440 | 2312 while (awy) { |
2313 a = (struct away_message *)awy->data; | |
2314 gtk_list_store_append (prefs_away_store, &iter); | |
2315 gtk_list_store_set(prefs_away_store, &iter, | |
2316 0, a->name, | |
2317 1, a, -1); | |
2318 awy = awy->next; | |
2319 } | |
7939 | 2320 event_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(prefs_away_store)); |
5440 | 2321 |
2322 rend = gtk_cell_renderer_text_new(); | |
2323 col = gtk_tree_view_column_new_with_attributes ("NULL", | |
2324 rend, | |
2325 "text", 0, | |
2326 NULL); | |
2327 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); | |
2328 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); | |
2329 gtk_widget_show(event_view); | |
7931 | 2330 gtk_container_add(GTK_CONTAINER(sw), event_view); |
5440 | 2331 |
7929 | 2332 sw = gtk_scrolled_window_new(NULL, NULL); |
7931 | 2333 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); |
7929 | 2334 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), |
5440 | 2335 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); |
7929 | 2336 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0); |
2337 | |
2338 away_text = gtk_imhtml_new(NULL, NULL); | |
7931 | 2339 gtk_container_add(GTK_CONTAINER(sw), away_text); |
2340 | |
5440 | 2341 gaim_setup_imhtml(away_text); |
2342 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); | |
6979 | 2343 g_signal_connect(G_OBJECT(sel), "changed", |
2344 G_CALLBACK(away_message_sel_cb), NULL); | |
2345 g_signal_connect(G_OBJECT(event_view), "button-press-event", | |
2346 G_CALLBACK(away_message_click_cb), NULL); | |
5440 | 2347 hbox = gtk_hbox_new(TRUE, 5); |
2348 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0); | |
2349 button = gtk_button_new_from_stock (GTK_STOCK_ADD); | |
2350 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2351 gtk_size_group_add_widget(sg, button); | |
2352 g_signal_connect(G_OBJECT(button), "clicked", | |
2353 G_CALLBACK(create_away_mess), NULL); | |
2354 | |
2355 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); | |
2356 gtk_size_group_add_widget(sg, button); | |
2357 g_signal_connect(G_OBJECT(button), "clicked", | |
2358 G_CALLBACK(remove_away_message), event_view); | |
2359 | |
2360 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2361 | |
2362 button = gaim_pixbuf_button_from_stock(_("_Edit"), GAIM_STOCK_EDIT, GAIM_BUTTON_HORIZONTAL); | |
2363 gtk_size_group_add_widget(sg, button); | |
2364 g_signal_connect(G_OBJECT(button), "clicked", | |
2365 G_CALLBACK(create_away_mess), event_view); | |
2366 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
2367 | |
2368 gtk_widget_show_all(ret); | |
2369 return ret; | |
2370 } | |
2371 | |
2372 GtkTreeIter *prefs_notebook_add_page(const char *text, | |
2373 GdkPixbuf *pixbuf, | |
2374 GtkWidget *page, | |
2375 GtkTreeIter *iter, | |
2376 GtkTreeIter *parent, | |
2377 int ind) { | |
2378 GdkPixbuf *icon = NULL; | |
2379 | |
2380 if (pixbuf) | |
2381 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); | |
2382 | |
2383 gtk_tree_store_append (prefstree, iter, parent); | |
2384 gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1); | |
2385 | |
2386 if (pixbuf) | |
2387 g_object_unref(pixbuf); | |
2388 if (icon) | |
2389 g_object_unref(icon); | |
2390 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); | |
2391 return iter; | |
2392 } | |
2393 | |
2394 void prefs_notebook_init() { | |
9267 | 2395 GtkTreeIter p, c, c2; |
5440 | 2396 GList *l; |
2397 GaimPlugin *plug; | |
2398 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++); | |
2399 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++); | |
9150 | 2400 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &c, &p, notebook_page++); |
9267 | 2401 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c2, &c, notebook_page++); |
2402 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c2, &c, notebook_page++); | |
2403 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c2, &c, notebook_page++); | |
9150 | 2404 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &c, &p, notebook_page++); |
8238 | 2405 prefs_notebook_add_page(_("Network"), NULL, network_page(), &p, NULL, notebook_page++); |
5440 | 2406 #ifndef _WIN32 |
2407 /* We use the registered default browser in windows */ | |
2408 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++); | |
2409 #endif | |
2410 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++); | |
2411 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++); | |
2412 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++); | |
2413 | |
2414 if (gaim_plugins_enabled()) { | |
2415 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++); | |
2416 | |
2417 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) { | |
8713 | 2418 plug = (GaimPlugin *)l->data; |
5440 | 2419 |
2420 if (GAIM_IS_GTK_PLUGIN(plug)) { | |
2421 GtkWidget *config_frame; | |
2422 GaimGtkPluginUiInfo *ui_info; | |
2423 | |
2424 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug); | |
2425 config_frame = gaim_gtk_plugin_get_config_frame(plug); | |
2426 | |
2427 if (config_frame != NULL) { | |
2428 ui_info->iter = g_new0(GtkTreeIter, 1); | |
2429 prefs_notebook_add_page(_(plug->info->name), NULL, | |
2430 config_frame, ui_info->iter, | |
2431 &plugin_iter, notebook_page++); | |
2432 } | |
2433 } | |
8713 | 2434 |
2435 if(GAIM_PLUGIN_HAS_PREF_FRAME(plug)) { | |
8745 | 2436 GtkWidget *gtk_frame; |
8713 | 2437 GaimPluginUiInfo *prefs_info; |
2438 | |
2439 prefs_info = GAIM_PLUGIN_UI_INFO(plug); | |
8814 | 2440 prefs_info->frame = prefs_info->get_plugin_pref_frame(plug); |
2441 gtk_frame = gaim_gtk_plugin_pref_create_frame(prefs_info->frame); | |
8745 | 2442 |
2443 if(GTK_IS_WIDGET(gtk_frame)) { | |
8713 | 2444 prefs_info->iter = g_new0(GtkTreeIter, 1); |
2445 prefs_notebook_add_page(_(plug->info->name), NULL, | |
8745 | 2446 gtk_frame, prefs_info->iter, |
9150 | 2447 (plug->info->type == GAIM_PLUGIN_PROTOCOL) ? NULL : &plugin_iter, |
8713 | 2448 notebook_page++); |
8814 | 2449 } else if(prefs_info->frame) { |
2450 /* in the event that there is a pref frame and we can | |
2451 * not make a widget out of it, we free the | |
2452 * pluginpref frame --Gary | |
2453 */ | |
2454 gaim_plugin_pref_frame_destroy(prefs_info->frame); | |
8713 | 2455 } |
2456 } | |
5440 | 2457 } |
2458 } | |
2459 } | |
2460 | |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2461 void gaim_gtk_prefs_show(void) |
5440 | 2462 { |
2463 GtkWidget *vbox, *vbox2; | |
2464 GtkWidget *hbox; | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2465 GtkWidget *bbox; |
5440 | 2466 GtkWidget *frame; |
8335 | 2467 GtkWidget *scrolled_window; |
5440 | 2468 GtkTreeViewColumn *column; |
2469 GtkCellRenderer *cell; | |
2470 GtkTreeSelection *sel; | |
2471 GtkWidget *notebook; | |
2472 GtkWidget *sep; | |
2473 GtkWidget *button; | |
2474 | |
2475 if (prefs) { | |
2476 gtk_window_present(GTK_WINDOW(prefs)); | |
2477 return; | |
2478 } | |
2479 | |
2480 /* copy the preferences to tmp values... | |
2481 * I liked "take affect immediately" Oh well :-( */ | |
6016 | 2482 /* (that should have been "effect," right?) */ |
2483 | |
5440 | 2484 /* Back to instant-apply! I win! BU-HAHAHA! */ |
2485 | |
2486 /* Create the window */ | |
2487 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); | |
2488 gtk_window_set_role(GTK_WINDOW(prefs), "preferences"); | |
2489 gtk_widget_realize(prefs); | |
2490 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences")); | |
2491 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2492 gtk_container_set_border_width(GTK_CONTAINER(prefs), 12); |
5440 | 2493 g_signal_connect(G_OBJECT(prefs), "destroy", |
2494 G_CALLBACK(delete_prefs), NULL); | |
2495 | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2496 vbox = gtk_vbox_new(FALSE, 12); |
5440 | 2497 gtk_container_add(GTK_CONTAINER(prefs), vbox); |
2498 gtk_widget_show(vbox); | |
2499 | |
2500 hbox = gtk_hbox_new (FALSE, 6); | |
2501 gtk_container_add (GTK_CONTAINER(vbox), hbox); | |
2502 gtk_widget_show (hbox); | |
2503 | |
2504 frame = gtk_frame_new (NULL); | |
2505 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
2506 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); | |
2507 gtk_widget_show (frame); | |
2508 | |
8335 | 2509 scrolled_window = gtk_scrolled_window_new(NULL, NULL); |
2510 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled_window), | |
8340 | 2511 GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); |
8335 | 2512 gtk_container_add(GTK_CONTAINER(frame), scrolled_window); |
2513 gtk_widget_show(scrolled_window); | |
8998 | 2514 |
5440 | 2515 /* The tree -- much inspired by the Gimp */ |
2516 prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); | |
2517 tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree)); | |
8335 | 2518 gtk_container_add(GTK_CONTAINER(scrolled_window), tree_v); |
5440 | 2519 |
2520 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE); | |
2521 gtk_widget_show(tree_v); | |
2522 /* icons */ | |
2523 /* XXX: to be used at a later date | |
2524 cell = gtk_cell_renderer_pixbuf_new (); | |
2525 column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL); | |
2526 */ | |
2527 | |
2528 /* text */ | |
2529 cell = gtk_cell_renderer_text_new (); | |
2530 column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL); | |
2531 | |
2532 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column); | |
2533 | |
2534 /* The right side */ | |
2535 frame = gtk_frame_new (NULL); | |
2536 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); | |
2537 gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); | |
2538 gtk_widget_show (frame); | |
2539 | |
2540 vbox2 = gtk_vbox_new (FALSE, 4); | |
2541 gtk_container_add (GTK_CONTAINER (frame), vbox2); | |
2542 gtk_widget_show (vbox2); | |
2543 | |
2544 frame = gtk_frame_new (NULL); | |
2545 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); | |
2546 gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0); | |
2547 gtk_widget_show (frame); | |
2548 | |
2549 hbox = gtk_hbox_new (FALSE, 4); | |
2550 gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); | |
2551 gtk_container_add (GTK_CONTAINER (frame), hbox); | |
2552 gtk_widget_show (hbox); | |
2553 | |
2554 preflabel = gtk_label_new(NULL); | |
2555 gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0); | |
2556 gtk_widget_show (preflabel); | |
2557 | |
2558 /* The notebook */ | |
2559 prefsnotebook = notebook = gtk_notebook_new (); | |
2560 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); | |
2561 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); | |
2562 gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0); | |
2563 | |
2564 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v)); | |
2565 g_signal_connect (G_OBJECT (sel), "changed", | |
2566 G_CALLBACK (pref_nb_select), | |
2567 notebook); | |
2568 gtk_widget_show(notebook); | |
2569 sep = gtk_hseparator_new(); | |
2570 gtk_widget_show(sep); | |
2571 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); | |
2572 | |
8713 | 2573 /* The buttons to press! */ |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2574 bbox = gtk_hbutton_box_new(); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2575 gtk_box_set_spacing(GTK_BOX(bbox), 6); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2576 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
|
2577 gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0); |
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2578 gtk_widget_show (bbox); |
5440 | 2579 |
2580 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE); | |
2581 g_signal_connect_swapped(G_OBJECT(button), "clicked", | |
2582 G_CALLBACK(gtk_widget_destroy), prefs); | |
8292
90ed519c6645
[gaim-migrate @ 9016]
Christian Hammond <chipx86@chipx86.com>
parents:
8283
diff
changeset
|
2583 gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); |
5440 | 2584 gtk_widget_show(button); |
2585 | |
2586 prefs_notebook_init(); | |
2587 | |
5568
fb4f7bd7525c
[gaim-migrate @ 5970]
Christian Hammond <chipx86@chipx86.com>
parents:
5567
diff
changeset
|
2588 /* Show everything. */ |
5440 | 2589 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); |
2590 gtk_widget_show(prefs); | |
2591 } | |
2592 | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2593 static void |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2594 set_bool_pref(GtkWidget *w, const char *key) |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2595 { |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2596 gaim_prefs_set_bool(key, |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2597 gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2598 } |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2599 |
7976 | 2600 GtkWidget * |
7987 | 2601 gaim_gtk_prefs_checkbox(const char *text, const char *key, GtkWidget *page) |
5440 | 2602 { |
2603 GtkWidget *button; | |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2604 |
5440 | 2605 button = gtk_check_button_new_with_mnemonic(text); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2607 gaim_prefs_get_bool(key)); |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2608 |
5440 | 2609 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
|
2610 |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2611 g_signal_connect(G_OBJECT(button), "clicked", |
5551
51699de873af
[gaim-migrate @ 5952]
Christian Hammond <chipx86@chipx86.com>
parents:
5550
diff
changeset
|
2612 G_CALLBACK(set_bool_pref), (char *)key); |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2613 |
5440 | 2614 gtk_widget_show(button); |
2615 | |
2616 return button; | |
2617 } | |
2618 | |
2619 void default_away_menu_init(GtkWidget *omenu) | |
2620 { | |
2621 GtkWidget *menu, *opt; | |
6216 | 2622 int index = 0, default_index = 0; |
5440 | 2623 GSList *awy = away_messages; |
2624 struct away_message *a; | |
6216 | 2625 const char *default_name; |
5440 | 2626 |
2627 menu = gtk_menu_new(); | |
2628 | |
6216 | 2629 default_name = gaim_prefs_get_string("/core/away/default_message"); |
2630 | |
5440 | 2631 while (awy) { |
2632 a = (struct away_message *)awy->data; | |
2633 opt = gtk_menu_item_new_with_label(a->name); | |
2634 g_signal_connect(G_OBJECT(opt), "activate", | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2635 G_CALLBACK(set_default_away), GINT_TO_POINTER(index)); |
5440 | 2636 gtk_widget_show(opt); |
2637 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); | |
2638 | |
6216 | 2639 if(!strcmp(default_name, a->name)) |
2640 default_index = index; | |
2641 | |
5440 | 2642 awy = awy->next; |
2643 index++; | |
2644 } | |
2645 | |
2646 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); | |
2647 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); | |
6216 | 2648 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), default_index); |
5440 | 2649 } |
2650 | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2651 void set_default_away(GtkWidget *w, gpointer data) |
5440 | 2652 { |
6216 | 2653 struct away_message *default_away = NULL; |
5440 | 2654 int length = g_slist_length(away_messages); |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2655 int i = GPOINTER_TO_INT(data); |
5440 | 2656 |
2657 if (away_messages == NULL) | |
2658 default_away = NULL; | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2659 else if (i >= length) |
5440 | 2660 default_away = g_slist_nth_data(away_messages, length - 1); |
2661 else | |
6478
338147ea6896
[gaim-migrate @ 6991]
Christian Hammond <chipx86@chipx86.com>
parents:
6455
diff
changeset
|
2662 default_away = g_slist_nth_data(away_messages, i); |
6216 | 2663 |
2664 if(default_away) | |
2665 gaim_prefs_set_string("/core/away/default_message", default_away->name); | |
2666 else | |
2667 gaim_prefs_set_string("/core/away/default_message", ""); | |
5440 | 2668 } |
2669 | |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2670 static void |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2671 smiley_theme_pref_cb(const char *name, GaimPrefType type, gpointer value, |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2672 gpointer data) |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2673 { |
5841 | 2674 if (!strcmp(name, "/gaim/gtk/smileys/theme")) |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2675 load_smiley_theme((const char *)value, TRUE); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2676 } |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2677 |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2678 void |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2679 gaim_gtk_prefs_init(void) |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2680 { |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2681 gaim_prefs_add_none("/gaim"); |
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2682 gaim_prefs_add_none("/gaim/gtk"); |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2683 gaim_prefs_add_none("/plugins/gtk"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2684 |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2685 /* XXX Move this! HACK! :( Aww... */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2686 gaim_prefs_add_none("/plugins/gtk/docklet"); |
5554
7b36d02031a2
[gaim-migrate @ 5955]
Christian Hammond <chipx86@chipx86.com>
parents:
5551
diff
changeset
|
2687 gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2688 |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2689 /* Accounts Dialog */ |
5567
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
2690 gaim_prefs_add_none("/gaim/gtk/accounts"); |
cc9ddec20010
[gaim-migrate @ 5969]
Christian Hammond <chipx86@chipx86.com>
parents:
5563
diff
changeset
|
2691 gaim_prefs_add_none("/gaim/gtk/accounts/dialog"); |
5563
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2692 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/width", 550); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2693 gaim_prefs_add_int("/gaim/gtk/accounts/dialog/height", 250); |
9eb5b13fd412
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5560
diff
changeset
|
2694 |
5573
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2695 /* Away Queueing */ |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2696 gaim_prefs_add_none("/gaim/gtk/away"); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2697 gaim_prefs_add_bool("/gaim/gtk/away/queue_messages", FALSE); |
5e7de337a053
[gaim-migrate @ 5976]
Christian Hammond <chipx86@chipx86.com>
parents:
5568
diff
changeset
|
2698 |
8283 | 2699 #ifndef _WIN32 |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2700 /* Browsers */ |
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2701 gaim_prefs_add_none("/gaim/gtk/browsers"); |
8272 | 2702 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
|
2703 gaim_prefs_add_string("/gaim/gtk/browsers/command", ""); |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2704 gaim_prefs_add_string("/gaim/gtk/browsers/browser", "mozilla"); |
8283 | 2705 #endif |
5545
7a64114641c3
[gaim-migrate @ 5946]
Christian Hammond <chipx86@chipx86.com>
parents:
5539
diff
changeset
|
2706 |
5550
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2707 /* Idle */ |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2708 gaim_prefs_add_none("/gaim/gtk/idle"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2709 gaim_prefs_add_string("/gaim/gtk/idle/reporting_method", "system"); |
b18c2a37cc96
[gaim-migrate @ 5951]
Christian Hammond <chipx86@chipx86.com>
parents:
5547
diff
changeset
|
2710 |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2711 /* Plugins */ |
5982
35d3c1ac5ece
[gaim-migrate @ 6430]
Christian Hammond <chipx86@chipx86.com>
parents:
5981
diff
changeset
|
2712 gaim_prefs_add_none("/gaim/gtk/plugins"); |
5949
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2713 gaim_prefs_add_string_list("/gaim/gtk/plugins/loaded", NULL); |
90d0849abd3c
[gaim-migrate @ 6393]
Christian Hammond <chipx86@chipx86.com>
parents:
5872
diff
changeset
|
2714 |
5539
de09863bd4b5
[gaim-migrate @ 5939]
Christian Hammond <chipx86@chipx86.com>
parents:
5535
diff
changeset
|
2715 /* Smiley Themes */ |
5546
22cf337e8b8f
[gaim-migrate @ 5947]
Christian Hammond <chipx86@chipx86.com>
parents:
5545
diff
changeset
|
2716 gaim_prefs_add_none("/gaim/gtk/smileys"); |
5771
f63a008726c6
[gaim-migrate @ 6196]
Christian Hammond <chipx86@chipx86.com>
parents:
5770
diff
changeset
|
2717 gaim_prefs_add_string("/gaim/gtk/smileys/theme", ""); |
5770
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2718 |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2719 /* Smiley Callbacks */ |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2720 gaim_prefs_connect_callback("/gaim/gtk/smileys/theme", |
a86051df9122
[gaim-migrate @ 6195]
Christian Hammond <chipx86@chipx86.com>
parents:
5753
diff
changeset
|
2721 smiley_theme_pref_cb, NULL); |
5530
2c4c975620f0
[gaim-migrate @ 5930]
Christian Hammond <chipx86@chipx86.com>
parents:
5440
diff
changeset
|
2722 } |
8905 | 2723 |
2724 void gaim_gtk_prefs_update_old() { | |
2725 /* Rename some old prefs */ | |
2726 gaim_prefs_rename("/gaim/gtk/logging/log_ims", "/core/logging/log_ims"); | |
2727 gaim_prefs_rename("/gaim/gtk/logging/log_chats", "/core/logging/log_chats"); | |
2728 gaim_prefs_rename("/core/conversations/placement", | |
8998 | 2729 "/gaim/gtk/conversations/placement"); |
8905 | 2730 |
9025 | 2731 gaim_prefs_rename("/gaim/gtk/conversations/use_custom_font", |
2732 "/gaim/gtk/conversations/send_formatting"); | |
2733 | |
9150 | 2734 gaim_prefs_rename("/gaim/gtk/conversations/im/button_type", |
2735 "/gaim/gtk/conversations/button_type"); | |
2736 | |
8905 | 2737 /* Remove some no-longer-used prefs */ |
8945 | 2738 gaim_prefs_remove("/gaim/gtk/blist/show_group_count"); |
8946 | 2739 gaim_prefs_remove("/gaim/gtk/conversations/icons_on_tabs"); |
9049 | 2740 #if 0 /* PREFSLASH04 */ |
8944 | 2741 gaim_prefs_remove("/gaim/gtk/conversations/ignore_colors"); |
2742 gaim_prefs_remove("/gaim/gtk/conversations/ignore_fonts"); | |
2743 gaim_prefs_remove("/gaim/gtk/conversations/ignore_font_sizes"); | |
9049 | 2744 #endif |
8905 | 2745 gaim_prefs_remove("/gaim/gtk/conversations/show_urls_as_links"); |
2746 gaim_prefs_remove("/gaim/gtk/conversations/show_smileys"); | |
8941 | 2747 gaim_prefs_remove("/gaim/gtk/conversations/chat/tab_completion"); |
2748 gaim_prefs_remove("/gaim/gtk/conversations/chat/old_tab_complete"); | |
8947 | 2749 gaim_prefs_remove("/gaim/gtk/sound/signon"); |
2750 gaim_prefs_remove("/gaim/gtk/sound/silent_signon"); | |
8998 | 2751 gaim_prefs_remove("/gaim/gtk/logging/individual_logs"); |
9025 | 2752 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_bgcolor"); |
2753 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_fgcolor"); | |
2754 gaim_prefs_remove("/gaim/gtk/conversations/use_custom_size"); | |
9301 | 2755 gaim_prefs_remove("/gaim/gtk/conversations/im/hide_on_send"); |
8905 | 2756 } |