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