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