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