5440
|
1 /*
|
|
2 * gaim
|
|
3 *
|
|
4 * Copyright (C) 1998-2002, Mark Spencer <markster@marko.net>
|
|
5 *
|
|
6 * This program is free software; you can redistribute it and/or modify
|
|
7 * it under the terms of the GNU General Public License as published by
|
|
8 * the Free Software Foundation; either version 2 of the License, or
|
|
9 * (at your option) any later version.
|
|
10 *
|
|
11 * This program is distributed in the hope that it will be useful,
|
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 * GNU General Public License for more details.
|
|
15 *
|
|
16 * You should have received a copy of the GNU General Public License
|
|
17 * along with this program; if not, write to the Free Software
|
|
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
19 *
|
|
20 */
|
|
21
|
|
22 #ifdef HAVE_CONFIG_H
|
|
23 #include <config.h>
|
|
24 #endif
|
|
25 #include <string.h>
|
|
26 #include <sys/time.h>
|
|
27
|
|
28 #include <sys/types.h>
|
|
29 #include <sys/stat.h>
|
|
30
|
|
31 #include <unistd.h>
|
|
32 #include <stdio.h>
|
|
33 #include <stdlib.h>
|
|
34 #include <stdarg.h>
|
|
35 #include <ctype.h>
|
|
36 #include <gtk/gtk.h>
|
|
37 #include "gtkimhtml.h"
|
|
38 #include "gaim.h"
|
|
39 #include "gtkblist.h"
|
|
40 #include "gtkplugin.h"
|
|
41 #include "gtkdebug.h"
|
|
42 #include "prpl.h"
|
|
43 #include "proxy.h"
|
|
44 #include "sound.h"
|
|
45 #include "notify.h"
|
|
46
|
|
47 #ifdef _WIN32
|
|
48 #include "win32dep.h"
|
|
49 #endif
|
|
50
|
|
51 GtkWidget *tree_v = NULL;
|
|
52 GtkWidget *prefs_away_menu = NULL;
|
|
53 GtkWidget *fontseld = NULL;
|
|
54
|
|
55 GtkListStore *prefs_away_store = NULL;
|
|
56
|
|
57 static int sound_row_sel = 0;
|
|
58 static char *last_sound_dir = NULL;
|
|
59
|
|
60 static GtkWidget *sounddialog = NULL;
|
|
61 static GtkWidget *browser_entry = NULL;
|
|
62 static GtkWidget *sound_entry = NULL;
|
|
63 static GtkWidget *away_text = NULL;
|
|
64 static GtkListStore *smiley_theme_store = NULL;
|
|
65 GtkWidget *prefs_proxy_frame = NULL;
|
|
66 GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *);
|
|
67 GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int, GtkSizeGroup *);
|
|
68 static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...);
|
|
69 static GtkWidget *gaim_dropdown_from_list(GtkWidget *, const gchar *, int *, int, GList *);
|
|
70 static GtkWidget *show_color_pref(GtkWidget *, gboolean);
|
|
71 static void delete_prefs(GtkWidget *, void *);
|
|
72 void set_default_away(GtkWidget *, gpointer);
|
|
73 #ifndef _WIN32
|
|
74 static gboolean program_is_valid(const char *);
|
|
75 #endif
|
|
76
|
|
77 static GtkWidget *prefs = NULL;
|
|
78 GtkWidget *debugbutton = NULL;
|
|
79 static int notebook_page = 0;
|
|
80 static GtkTreeIter plugin_iter;
|
|
81
|
|
82 /*
|
|
83 * PROTOTYPES
|
|
84 */
|
|
85 GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int);
|
|
86
|
|
87 static void update_plugin_list(void *data);
|
|
88
|
|
89 void delete_prefs(GtkWidget *asdf, void *gdsa) {
|
|
90 GList *l;
|
|
91 GaimPlugin *plug;
|
|
92
|
|
93 gaim_plugins_unregister_probe_notify_cb(update_plugin_list);
|
|
94
|
|
95 save_prefs();
|
|
96 prefs = NULL;
|
|
97 tree_v = NULL;
|
|
98 sound_entry = NULL;
|
|
99 browser_entry = NULL;
|
|
100 debugbutton = NULL;
|
|
101 prefs_away_menu = NULL;
|
|
102 notebook_page = 0;
|
|
103 smiley_theme_store = NULL;
|
|
104 if(sounddialog)
|
|
105 gtk_widget_destroy(sounddialog);
|
|
106 g_object_unref(G_OBJECT(prefs_away_store));
|
|
107 prefs_away_store = NULL;
|
|
108
|
|
109 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
|
|
110 plug = l->data;
|
|
111
|
|
112 if (GAIM_IS_GTK_PLUGIN(plug)) {
|
|
113 GaimGtkPluginUiInfo *ui_info;
|
|
114
|
|
115 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug);
|
|
116
|
|
117 if (ui_info->iter != NULL) {
|
|
118 g_free(ui_info->iter);
|
|
119 ui_info->iter = NULL;
|
|
120 }
|
|
121 }
|
|
122 }
|
|
123 }
|
|
124
|
|
125 GtkWidget *preflabel;
|
|
126 GtkWidget *prefsnotebook;
|
|
127 GtkTreeStore *prefstree;
|
|
128
|
|
129 static void set_misc_option();
|
|
130 static void set_logging_option();
|
|
131 static void set_blist_option();
|
|
132 static void set_convo_option();
|
|
133 static void set_im_option();
|
|
134 static void set_chat_option();
|
|
135 static void set_font_option();
|
|
136 static void set_sound_option();
|
|
137 static void set_away_option();
|
|
138
|
|
139 #define PROXYHOST 0
|
|
140 #define PROXYPORT 1
|
|
141 #define PROXYTYPE 2
|
|
142 #define PROXYUSER 3
|
|
143 #define PROXYPASS 4
|
|
144 static void proxy_print_option(GtkEntry *entry, int entrynum)
|
|
145 {
|
|
146 if (entrynum == PROXYHOST)
|
|
147 g_snprintf(global_proxy_info.proxyhost, sizeof(global_proxy_info.proxyhost), "%s", gtk_entry_get_text(entry));
|
|
148 else if (entrynum == PROXYPORT)
|
|
149 global_proxy_info.proxyport = atoi(gtk_entry_get_text(entry));
|
|
150 else if (entrynum == PROXYUSER)
|
|
151 g_snprintf(global_proxy_info.proxyuser, sizeof(global_proxy_info.proxyuser), "%s", gtk_entry_get_text(entry));
|
|
152 else if (entrynum == PROXYPASS)
|
|
153 g_snprintf(global_proxy_info.proxypass, sizeof(global_proxy_info.proxypass), "%s", gtk_entry_get_text(entry));
|
|
154 proxy_info_is_from_gaimrc = 1; /* If the user specifies it, we want
|
|
155 to save it */
|
|
156 }
|
|
157
|
|
158
|
|
159 GtkWidget *make_frame(GtkWidget *ret, char *text) {
|
|
160 GtkWidget *vbox, *label, *hbox;
|
|
161 char labeltext[256];
|
|
162
|
|
163 vbox = gtk_vbox_new(FALSE, 6);
|
|
164 gtk_box_pack_start(GTK_BOX(ret), vbox, FALSE, FALSE, 0);
|
|
165 label = gtk_label_new(NULL);
|
|
166 g_snprintf(labeltext, sizeof(labeltext), "<span weight=\"bold\">%s</span>", text);
|
|
167 gtk_label_set_markup(GTK_LABEL(label), labeltext);
|
|
168 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
169 gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
|
170 hbox = gtk_hbox_new(FALSE, 6);
|
|
171 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
172 label = gtk_label_new(" ");
|
|
173 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
|
174 vbox = gtk_vbox_new(FALSE, 6);
|
|
175 gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
|
|
176 return vbox;
|
|
177 }
|
|
178
|
|
179 /* OK, Apply and Cancel */
|
|
180
|
|
181 static void pref_nb_select(GtkTreeSelection *sel, GtkNotebook *nb) {
|
|
182 GtkTreeIter iter;
|
|
183 char text[128];
|
|
184 GValue val = { 0, };
|
|
185 GtkTreeModel *model = GTK_TREE_MODEL(prefstree);
|
|
186
|
|
187 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
188 return;
|
|
189 gtk_tree_model_get_value (model, &iter, 1, &val);
|
|
190 g_snprintf(text, sizeof(text), "<span weight=\"bold\" size=\"larger\">%s</span>",
|
|
191 g_value_get_string(&val));
|
|
192 gtk_label_set_markup (GTK_LABEL(preflabel), text);
|
|
193 g_value_unset (&val);
|
|
194 gtk_tree_model_get_value (model, &iter, 2, &val);
|
|
195 gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook), g_value_get_int (&val));
|
|
196
|
|
197 }
|
|
198
|
|
199 /* These are the pages in the preferences notebook */
|
|
200 GtkWidget *interface_page() {
|
|
201 GtkWidget *ret;
|
|
202 GtkWidget *vbox;
|
|
203 ret = gtk_vbox_new(FALSE, 18);
|
|
204 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
205
|
|
206 vbox = make_frame(ret, _("Interface Options"));
|
|
207
|
|
208 gaim_button(_("D_isplay remote nicknames if no alias is set"), &misc_options, OPT_MISC_USE_SERVER_ALIAS, vbox);
|
|
209
|
|
210
|
|
211 gtk_widget_show_all(ret);
|
|
212 return ret;
|
|
213 }
|
|
214
|
|
215 static void smiley_sel (GtkTreeSelection *sel, GtkTreeModel *model) {
|
|
216 GtkTreeIter iter;
|
|
217 const char *filename;
|
|
218 GValue val = { 0, };
|
|
219
|
|
220 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
221 return;
|
|
222 gtk_tree_model_get_value (model, &iter, 2, &val);
|
|
223 filename = g_value_get_string(&val);
|
|
224 load_smiley_theme(filename, TRUE);
|
|
225 g_value_unset (&val);
|
|
226 save_prefs();
|
|
227 }
|
|
228
|
|
229 GtkTreePath *theme_refresh_theme_list()
|
|
230 {
|
|
231 GdkPixbuf *pixbuf;
|
|
232 GSList *themes;
|
|
233 GtkTreeIter iter;
|
|
234 GtkTreePath *path = NULL;
|
|
235 int ind = 0;
|
|
236
|
|
237
|
|
238 smiley_theme_probe();
|
|
239
|
|
240 if (!smiley_themes)
|
|
241 return NULL;
|
|
242
|
|
243 themes = smiley_themes;
|
|
244
|
|
245 gtk_list_store_clear(smiley_theme_store);
|
|
246
|
|
247 while (themes) {
|
|
248 struct smiley_theme *theme = themes->data;
|
|
249 char *description = g_strdup_printf("<span size='larger' weight='bold'>%s</span> - %s\n"
|
|
250 "<span size='smaller' foreground='dim grey'>%s</span>",
|
|
251 theme->name, theme->author, theme->desc);
|
|
252 gtk_list_store_append (smiley_theme_store, &iter);
|
|
253 pixbuf = gdk_pixbuf_new_from_file(theme->icon, NULL);
|
|
254
|
|
255 gtk_list_store_set(smiley_theme_store, &iter,
|
|
256 0, pixbuf,
|
|
257 1, description,
|
|
258 2, theme->path,
|
|
259 -1);
|
|
260 g_object_unref(G_OBJECT(pixbuf));
|
|
261 g_free(description);
|
|
262 themes = themes->next;
|
|
263 if (current_smiley_theme && !strcmp(theme->path, current_smiley_theme->path)) {
|
|
264 /* path = gtk_tree_path_new_from_indices(ind); */
|
|
265 char *iwishihadgtk2_2 = g_strdup_printf("%d", ind);
|
|
266 path = gtk_tree_path_new_from_string(iwishihadgtk2_2);
|
|
267 g_free(iwishihadgtk2_2);
|
|
268 }
|
|
269 ind++;
|
|
270 }
|
|
271
|
|
272 return path;
|
|
273 }
|
|
274
|
|
275 void theme_install_theme(char *path, char *extn) {
|
|
276 #ifndef _WIN32
|
|
277 gchar *command;
|
|
278 #endif
|
|
279 gchar *destdir;
|
|
280 gchar *tail;
|
|
281
|
|
282 /* Just to be safe */
|
|
283 g_strchomp(path);
|
|
284
|
|
285 /* I dont know what you are, get out of here */
|
|
286 if (extn != NULL)
|
|
287 tail = extn;
|
|
288 else if ((tail = strrchr(path, '.')) == NULL)
|
|
289 return;
|
|
290
|
|
291 destdir = g_strconcat(gaim_user_dir(), G_DIR_SEPARATOR_S "smileys", NULL);
|
|
292
|
|
293 /* We'll check this just to make sure. This also lets us do something different on
|
|
294 * other platforms, if need be */
|
|
295 if (!g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz")) {
|
|
296 #ifndef _WIN32
|
|
297 command = g_strdup_printf("tar > /dev/null xzf \"%s\" -C %s", path, destdir);
|
|
298 #else
|
|
299 if(!wgaim_gz_untar(path, destdir)) {
|
|
300 g_free(destdir);
|
|
301 return;
|
|
302 }
|
|
303 #endif
|
|
304 }
|
|
305 else {
|
|
306 g_free(destdir);
|
|
307 return;
|
|
308 }
|
|
309
|
|
310 #ifndef _WIN32
|
|
311 /* Fire! */
|
|
312 system(command);
|
|
313
|
|
314 g_free(command);
|
|
315 #endif
|
|
316 g_free(destdir);
|
|
317
|
|
318 theme_refresh_theme_list();
|
|
319 }
|
|
320
|
|
321 static void theme_got_url(gpointer data, char *themedata, unsigned long len) {
|
|
322 FILE *f;
|
|
323 gchar *path;
|
|
324
|
|
325 f = gaim_mkstemp(&path);
|
|
326 fwrite(themedata, len, 1, f);
|
|
327 fclose(f);
|
|
328
|
|
329 theme_install_theme(path, data);
|
|
330
|
|
331 unlink(path);
|
|
332 g_free(path);
|
|
333 }
|
|
334
|
|
335 void theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, GtkSelectionData *sd,
|
|
336 guint info, guint t, gpointer data) {
|
|
337 gchar *name = sd->data;
|
|
338
|
|
339 if ((sd->length >= 0) && (sd->format == 8)) {
|
|
340 /* Well, it looks like the drag event was cool.
|
|
341 * Let's do something with it */
|
|
342
|
|
343 if (!g_ascii_strncasecmp(name, "file://", 7)) {
|
|
344 GError *converr = NULL;
|
|
345 gchar *tmp;
|
|
346 /* It looks like we're dealing with a local file. Let's
|
|
347 * just untar it in the right place */
|
|
348 if(!(tmp = g_filename_from_uri(name, NULL, &converr))) {
|
|
349 gaim_debug(GAIM_DEBUG_ERROR, "theme dnd", "%s\n",
|
|
350 (converr ? converr->message :
|
|
351 "g_filename_from_uri error"));
|
|
352 return;
|
|
353 }
|
|
354 theme_install_theme(tmp, NULL);
|
|
355 g_free(tmp);
|
|
356 } else if (!g_ascii_strncasecmp(name, "http://", 7)) {
|
|
357 /* Oo, a web drag and drop. This is where things
|
|
358 * will start to get interesting */
|
|
359 gchar *tail;
|
|
360
|
|
361 if ((tail = strrchr(name, '.')) == NULL)
|
|
362 return;
|
|
363
|
|
364 /* We'll check this just to make sure. This also lets us do something different on
|
|
365 * other platforms, if need be */
|
|
366 grab_url(name, TRUE, theme_got_url, ".tgz");
|
|
367 }
|
|
368
|
|
369 gtk_drag_finish(dc, TRUE, FALSE, t);
|
|
370 }
|
|
371
|
|
372 gtk_drag_finish(dc, FALSE, FALSE, t);
|
|
373 }
|
|
374
|
|
375 GtkWidget *theme_page() {
|
|
376 GtkWidget *ret;
|
|
377 GtkWidget *sw;
|
|
378 GtkWidget *view;
|
|
379 GtkCellRenderer *rend;
|
|
380 GtkTreeViewColumn *col;
|
|
381 GtkTreeSelection *sel;
|
|
382 GtkTreePath *path = NULL;
|
|
383 GtkWidget *label;
|
|
384 GtkTargetEntry te[3] = {{"text/plain", 0, 0},{"text/uri-list", 0, 1},{"STRING", 0, 2}};
|
|
385
|
|
386 ret = gtk_vbox_new(FALSE, 18);
|
|
387 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
388
|
|
389 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."));
|
|
390
|
|
391 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
|
|
392 gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
|
|
393 gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
|
|
394
|
|
395 gtk_box_pack_start(GTK_BOX(ret), label, FALSE, TRUE, 0);
|
|
396 gtk_widget_show(label);
|
|
397
|
|
398 sw = gtk_scrolled_window_new(NULL,NULL);
|
|
399 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
|
400 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
|
|
401
|
|
402 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0);
|
|
403 smiley_theme_store = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
|
|
404
|
|
405 path = theme_refresh_theme_list();
|
|
406
|
|
407 view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(smiley_theme_store));
|
|
408
|
|
409 gtk_drag_dest_set(view, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te,
|
|
410 sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE);
|
|
411
|
|
412 g_signal_connect(G_OBJECT(view), "drag_data_received", G_CALLBACK(theme_dnd_recv), smiley_theme_store);
|
|
413
|
|
414 rend = gtk_cell_renderer_pixbuf_new();
|
|
415 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
|
|
416
|
|
417 if(path) {
|
|
418 gtk_tree_selection_select_path(sel, path);
|
|
419 gtk_tree_path_free(path);
|
|
420 }
|
|
421
|
|
422 col = gtk_tree_view_column_new_with_attributes (_("Icon"),
|
|
423 rend,
|
|
424 "pixbuf", 0,
|
|
425 NULL);
|
|
426 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
|
|
427
|
|
428 rend = gtk_cell_renderer_text_new();
|
|
429 col = gtk_tree_view_column_new_with_attributes (_("Description"),
|
|
430 rend,
|
|
431 "markup", 1,
|
|
432 NULL);
|
|
433 gtk_tree_view_append_column (GTK_TREE_VIEW(view), col);
|
|
434 g_object_unref(G_OBJECT(smiley_theme_store));
|
|
435 gtk_container_add(GTK_CONTAINER(sw), view);
|
|
436
|
|
437 g_signal_connect (G_OBJECT (sel), "changed",
|
|
438 G_CALLBACK (smiley_sel),
|
|
439 NULL);
|
|
440
|
|
441
|
|
442 gtk_widget_show_all(ret);
|
|
443 return ret;
|
|
444 }
|
|
445
|
|
446 GtkWidget *font_page() {
|
|
447 GtkWidget *ret;
|
|
448 GtkWidget *button;
|
|
449 GtkWidget *vbox, *hbox;
|
|
450 GtkWidget *select = NULL;
|
|
451 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
452
|
|
453 ret = gtk_vbox_new(FALSE, 18);
|
|
454 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
455
|
|
456 vbox = make_frame(ret, _("Style"));
|
|
457 gaim_button(_("_Bold"), &font_options, OPT_FONT_BOLD, vbox);
|
|
458 gaim_button(_("_Italics"), &font_options, OPT_FONT_ITALIC, vbox);
|
|
459 gaim_button(_("_Underline"), &font_options, OPT_FONT_UNDERLINE, vbox);
|
|
460 gaim_button(_("_Strikethrough"), &font_options, OPT_FONT_STRIKE, vbox);
|
|
461
|
|
462 vbox = make_frame(ret, _("Face"));
|
|
463 hbox = gtk_hbox_new(FALSE, 6);
|
|
464 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
465 button = gaim_button(_("Use custo_m face"), &font_options, OPT_FONT_FACE, hbox);
|
|
466 gtk_size_group_add_widget(sg, button);
|
|
467 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT);
|
|
468
|
|
469 if (!(font_options & OPT_FONT_FACE))
|
|
470 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE);
|
|
471 g_signal_connect(G_OBJECT(button), "clicked",
|
|
472 G_CALLBACK(gaim_gtk_toggle_sensitive), select);
|
|
473 g_signal_connect(G_OBJECT(select), "clicked",
|
|
474 G_CALLBACK(show_font_dialog), NULL);
|
|
475 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0);
|
|
476
|
|
477 hbox = gtk_hbox_new(FALSE, 5);
|
|
478 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
479 button = gaim_button(_("Use custom si_ze"), &font_options, OPT_FONT_SIZE, hbox);
|
|
480 gtk_size_group_add_widget(sg, button);
|
|
481 select = gaim_labeled_spin_button(hbox, NULL, &fontsize, 1, 7, NULL);
|
|
482 if (!(font_options & OPT_FONT_SIZE))
|
|
483 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE);
|
|
484 g_signal_connect(G_OBJECT(button), "clicked",
|
|
485 G_CALLBACK(gaim_gtk_toggle_sensitive), select);
|
|
486
|
|
487 vbox = make_frame(ret, _("Color"));
|
|
488 hbox = gtk_hbox_new(FALSE, 5);
|
|
489 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
490
|
|
491
|
|
492 button = gaim_button(_("_Text color"), &font_options, OPT_FONT_FGCOL, hbox);
|
|
493 gtk_size_group_add_widget(sg, button);
|
|
494
|
|
495 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR);
|
|
496 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0);
|
|
497 pref_fg_picture = show_color_pref(hbox, TRUE);
|
|
498 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_color),
|
|
499 pref_fg_picture);
|
|
500
|
|
501 if (!(font_options & OPT_FONT_FGCOL))
|
|
502 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE);
|
|
503 g_signal_connect(G_OBJECT(button), "clicked",
|
|
504 G_CALLBACK(gaim_gtk_toggle_sensitive), select);
|
|
505 g_signal_connect(G_OBJECT(select), "clicked", G_CALLBACK(show_fgcolor_dialog), NULL);
|
|
506 hbox = gtk_hbox_new(FALSE, 5);
|
|
507 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
508
|
|
509 button = gaim_button(_("Bac_kground color"), &font_options, OPT_FONT_BGCOL, hbox);
|
|
510 gtk_size_group_add_widget(sg, button);
|
|
511 select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR);
|
|
512 gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0);
|
|
513 pref_bg_picture = show_color_pref(hbox, FALSE);
|
|
514 g_signal_connect(G_OBJECT(button), "clicked",
|
|
515 G_CALLBACK(update_color), pref_bg_picture);
|
|
516
|
|
517 if (!(font_options & OPT_FONT_BGCOL))
|
|
518 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE);
|
|
519 g_signal_connect(G_OBJECT(select), "clicked",
|
|
520 G_CALLBACK(show_bgcolor_dialog), NULL);
|
|
521 g_signal_connect(G_OBJECT(button), "clicked",
|
|
522 G_CALLBACK(gaim_gtk_toggle_sensitive), select);
|
|
523
|
|
524 gtk_widget_show_all(ret);
|
|
525 return ret;
|
|
526 }
|
|
527
|
|
528
|
|
529 GtkWidget *messages_page() {
|
|
530 GtkWidget *ret;
|
|
531 GtkWidget *vbox;
|
|
532 ret = gtk_vbox_new(FALSE, 18);
|
|
533 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
534
|
|
535 vbox = make_frame (ret, _("Display"));
|
|
536 gaim_button(_("Show graphical _smileys"), &convo_options, OPT_CONVO_SHOW_SMILEY, vbox);
|
|
537 gaim_button(_("Show _timestamp on messages"), &convo_options, OPT_CONVO_SHOW_TIME, vbox);
|
|
538 gaim_button(_("Show _URLs as links"), &convo_options, OPT_CONVO_SEND_LINKS, vbox);
|
|
539 #ifdef USE_GTKSPELL
|
|
540 gaim_button(_("_Highlight misspelled words"), &convo_options, OPT_CONVO_CHECK_SPELLING, vbox);
|
|
541 #endif
|
|
542 vbox = make_frame (ret, _("Ignore"));
|
|
543 gaim_button(_("Ignore c_olors"), &convo_options, OPT_CONVO_IGNORE_COLOUR, vbox);
|
|
544 gaim_button(_("Ignore font _faces"), &convo_options, OPT_CONVO_IGNORE_FONTS, vbox);
|
|
545 gaim_button(_("Ignore font si_zes"), &convo_options, OPT_CONVO_IGNORE_SIZES, vbox);
|
|
546
|
|
547 gtk_widget_show_all(ret);
|
|
548 return ret;
|
|
549 }
|
|
550
|
|
551 GtkWidget *hotkeys_page() {
|
|
552 GtkWidget *ret;
|
|
553 GtkWidget *vbox;
|
|
554 ret = gtk_vbox_new(FALSE, 18);
|
|
555 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
556
|
|
557 vbox = make_frame(ret, _("Send Message"));
|
|
558 gaim_button(_("_Enter sends message"), &convo_options, OPT_CONVO_ENTER_SENDS, vbox);
|
|
559 gaim_button(_("C_ontrol-Enter sends message"), &convo_options, OPT_CONVO_CTL_ENTER, vbox);
|
|
560
|
|
561 vbox = make_frame (ret, _("Window Closing"));
|
|
562 gaim_button(_("E_scape closes window"), &convo_options, OPT_CONVO_ESC_CAN_CLOSE, vbox);
|
|
563 gaim_button(_("Control-_W closes window"), &convo_options, OPT_CONVO_CTL_W_CLOSES, vbox);
|
|
564
|
|
565 vbox = make_frame(ret, _("Insertions"));
|
|
566 gaim_button(_("Control-{B/I/U/S} inserts _HTML tags"), &convo_options, OPT_CONVO_CTL_CHARS, vbox);
|
|
567 gaim_button(_("Control-(number) inserts _smileys"), &convo_options, OPT_CONVO_CTL_SMILEYS, vbox);
|
|
568
|
|
569 gtk_widget_show_all(ret);
|
|
570 return ret;
|
|
571 }
|
|
572
|
|
573 GtkWidget *list_page() {
|
|
574 GtkWidget *ret;
|
|
575 GtkWidget *vbox;
|
|
576 GtkWidget *button, *b2;
|
|
577 int r = 0;
|
|
578 gboolean fnd = FALSE;
|
|
579 GList *l= NULL;
|
|
580 GSList *sl = gaim_gtk_blist_sort_methods;
|
|
581 ret = gtk_vbox_new(FALSE, 18);
|
|
582 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
583
|
|
584
|
|
585 vbox = make_frame (ret, _("Buddy List Sorting"));
|
|
586 while (sl) {
|
|
587 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name);
|
|
588 l = g_list_append(l, ((struct gaim_gtk_blist_sort_method*)sl->data)->name);
|
|
589 if (!fnd && !gaim_utf8_strcasecmp(((struct gaim_gtk_blist_sort_method*)sl->data)->name, sort_method))
|
|
590 fnd = TRUE;
|
|
591 sl = sl->next;
|
|
592 if (!fnd) r++;
|
|
593 }
|
|
594 gaim_dropdown_from_list(vbox, _("Sorting:"),
|
|
595 (int*)&sort_method, r, l);
|
|
596
|
|
597 g_list_free(l);
|
|
598
|
|
599 vbox = make_frame (ret, _("Buddy List Toolbar"));
|
|
600 gaim_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT,
|
|
601 _("Pictures"), OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT,
|
|
602 _("Text"), 0,
|
|
603 _("Pictures and text"), OPT_BLIST_SHOW_BUTTON_XPM,
|
|
604 _("None"), OPT_BLIST_NO_BUTTON_TEXT, NULL);
|
|
605
|
|
606 vbox = make_frame (ret, _("Buddy List Window"));
|
|
607 gaim_button(_("_Raise window on events"), &blist_options, OPT_BLIST_POPUP, vbox);
|
|
608
|
|
609 vbox = make_frame (ret, _("Group Display"));
|
|
610 /* gaim_button(_("Hide _groups with no online buddies"), &blist_options, OPT_BLIST_NO_MT_GRP, vbox); */
|
|
611 gaim_button(_("Show _numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox);
|
|
612
|
|
613 vbox = make_frame (ret, _("Buddy Display"));
|
|
614 button = gaim_button(_("Show buddy _icons"), &blist_options, OPT_BLIST_SHOW_ICONS, vbox);
|
|
615 b2 = gaim_button(_("Show _warning levels"), &blist_options, OPT_BLIST_SHOW_WARN, vbox);
|
|
616 if (blist_options & OPT_BLIST_SHOW_ICONS)
|
|
617 gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE);
|
|
618 g_signal_connect(G_OBJECT(button), "clicked",
|
|
619 G_CALLBACK(gaim_gtk_toggle_sensitive), b2);
|
|
620 b2 = gaim_button(_("Show idle _times"), &blist_options, OPT_BLIST_SHOW_IDLETIME, vbox);
|
|
621 if (blist_options & OPT_BLIST_SHOW_ICONS)
|
|
622 gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE);
|
|
623 g_signal_connect(G_OBJECT(button), "clicked",
|
|
624 G_CALLBACK(gaim_gtk_toggle_sensitive), b2);
|
|
625 gaim_button(_("Dim i_dle buddies"), &blist_options, OPT_BLIST_GREY_IDLERS, vbox);
|
|
626
|
|
627 gtk_widget_show_all(ret);
|
|
628 return ret;
|
|
629 }
|
|
630
|
|
631 GtkWidget *conv_page() {
|
|
632 GtkWidget *ret;
|
|
633 GtkWidget *vbox;
|
|
634 GtkWidget *label;
|
|
635 GtkSizeGroup *sg;
|
|
636 GList *names = NULL;
|
|
637 int i;
|
|
638
|
|
639 ret = gtk_vbox_new(FALSE, 18);
|
|
640 gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
|
|
641
|
|
642 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
643 vbox = make_frame(ret, _("Conversations"));
|
|
644
|
|
645 /* Build a list of names. */
|
|
646 for (i = 0; i < gaim_conv_placement_get_fnc_count(); i++) {
|
|
647 names = g_list_append(names, (char *)gaim_conv_placement_get_name(i));
|
|
648 names = g_list_append(names, GINT_TO_POINTER(i));
|
|
649 }
|
|
650
|
|
651 label = gaim_dropdown_from_list(vbox, _("_Placement:"),
|
|
652 &conv_placement_option, -1, names);
|
|
653
|
|
654 g_list_free(names);
|
|
655
|
|
656 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
657 gtk_size_group_add_widget(sg, label);
|
|
658
|
|
659 gaim_button(_("Show IMs and chats in _same tabbed window."),
|
|
660 &convo_options, OPT_CONVO_COMBINE, vbox);
|
|
661
|
|
662 gtk_widget_show_all(ret);
|
|
663
|
|
664 return ret;
|
|
665 }
|
|
666
|
|
667 GtkWidget *im_page() {
|
|
668 GtkWidget *ret;
|
|
669 GtkWidget *vbox;
|
|
670 GtkWidget *typingbutton, *widge;
|
|
671 GtkSizeGroup *sg;
|
|
672
|
|
673 ret = gtk_vbox_new(FALSE, 18);
|
|
674 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
675
|
|
676 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
677
|
|
678 vbox = make_frame (ret, _("Window"));
|
|
679 widge = gaim_dropdown(vbox, _("Show _buttons as:"), &im_options, OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM,
|
|
680 _("Pictures"), OPT_IM_BUTTON_XPM,
|
|
681 _("Text"), OPT_IM_BUTTON_TEXT,
|
|
682 _("Pictures and text"), OPT_IM_BUTTON_XPM | OPT_IM_BUTTON_TEXT, NULL);
|
|
683 gtk_size_group_add_widget(sg, widge);
|
|
684 gtk_misc_set_alignment(GTK_MISC(widge), 0, 0);
|
|
685 gaim_labeled_spin_button(vbox, _("New window _width:"), &conv_size.width, 25, 9999, sg);
|
|
686 gaim_labeled_spin_button(vbox, _("New window _height:"), &conv_size.height, 25, 9999, sg);
|
|
687 gaim_labeled_spin_button(vbox, _("_Entry field height:"), &conv_size.entry_height, 25, 9999, sg);
|
|
688 gaim_button(_("_Raise windows on events"), &im_options, OPT_IM_POPUP, vbox);
|
|
689 gaim_button(_("Hide window on _send"), &im_options, OPT_IM_POPDOWN, vbox);
|
|
690 gtk_widget_show (vbox);
|
|
691
|
|
692 vbox = make_frame (ret, _("Buddy Icons"));
|
|
693 gaim_button(_("Hide buddy _icons"), &im_options, OPT_IM_HIDE_ICONS, vbox);
|
|
694 gaim_button(_("Disable buddy icon a_nimation"), &im_options, OPT_IM_NO_ANIMATION, vbox);
|
|
695
|
|
696 vbox = make_frame (ret, _("Display"));
|
|
697 gaim_button(_("Show _logins in window"), &im_options, OPT_IM_LOGON, vbox);
|
|
698 gaim_button(_("Show a_liases in tabs/titles"), &im_options, OPT_IM_ALIAS_TAB, vbox);
|
|
699
|
|
700 vbox = make_frame (ret, _("Typing Notification"));
|
|
701 typingbutton = gaim_button(_("Notify buddies that you are _typing to them"), &misc_options,
|
|
702 OPT_MISC_STEALTH_TYPING, vbox);
|
|
703 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton)));
|
|
704 misc_options ^= OPT_MISC_STEALTH_TYPING;
|
|
705
|
|
706 gtk_widget_show_all(ret);
|
|
707 return ret;
|
|
708 }
|
|
709
|
|
710 GtkWidget *chat_page() {
|
|
711 GtkWidget *ret;
|
|
712 GtkWidget *vbox;
|
|
713 GtkWidget *dd;
|
|
714 GtkSizeGroup *sg;
|
|
715
|
|
716 ret = gtk_vbox_new(FALSE, 18);
|
|
717 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
718
|
|
719 sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
|
720
|
|
721 vbox = make_frame (ret, _("Window"));
|
|
722 dd = gaim_dropdown(vbox, _("Show _buttons as:"), &chat_options, OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM,
|
|
723 _("Pictures"), OPT_CHAT_BUTTON_XPM,
|
|
724 _("Text"), OPT_CHAT_BUTTON_TEXT,
|
|
725 _("Pictures and text"), OPT_CHAT_BUTTON_XPM | OPT_CHAT_BUTTON_TEXT, NULL);
|
|
726 gtk_size_group_add_widget(sg, dd);
|
|
727 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0);
|
|
728 gaim_labeled_spin_button(vbox, _("New window _width:"), &buddy_chat_size.width, 25, 9999, sg);
|
|
729 gaim_labeled_spin_button(vbox, _("New window _height:"), &buddy_chat_size.height, 25, 9999, sg);
|
|
730 gaim_labeled_spin_button(vbox, _("_Entry field height:"), &buddy_chat_size.entry_height, 25, 9999, sg);
|
|
731 gaim_button(_("_Raise windows on events"), &chat_options, OPT_CHAT_POPUP, vbox);
|
|
732
|
|
733 vbox = make_frame (ret, _("Tab Completion"));
|
|
734 gaim_button(_("_Tab-complete nicks"), &chat_options, OPT_CHAT_TAB_COMPLETE, vbox);
|
|
735 gaim_button(_("_Old-style tab completion"), &chat_options, OPT_CHAT_OLD_STYLE_TAB, vbox);
|
|
736
|
|
737 vbox = make_frame (ret, _("Display"));
|
|
738 gaim_button(_("_Show people joining/leaving in window"), &chat_options, OPT_CHAT_LOGON, vbox);
|
|
739 gaim_button(_("Co_lorize screennames"), &chat_options, OPT_CHAT_COLORIZE, vbox);
|
|
740
|
|
741 gtk_widget_show_all(ret);
|
|
742 return ret;
|
|
743 }
|
|
744
|
|
745 GtkWidget *tab_page() {
|
|
746 GtkWidget *ret;
|
|
747 GtkWidget *vbox;
|
|
748 GtkWidget *dd;
|
|
749 GtkWidget *button;
|
|
750 GtkSizeGroup *sg;
|
|
751 ret = gtk_vbox_new(FALSE, 18);
|
|
752 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
753
|
|
754 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
755
|
|
756 vbox = make_frame (ret, _("IM Tabs"));
|
|
757 dd = gaim_dropdown(vbox, _("Tab _placement:"), &im_options, OPT_IM_SIDE_TAB | OPT_IM_BR_TAB,
|
|
758 _("Top"), 0,
|
|
759 _("Bottom"), OPT_IM_BR_TAB,
|
|
760 _("Left"), OPT_IM_SIDE_TAB,
|
|
761 _("Right"), OPT_IM_BR_TAB | OPT_IM_SIDE_TAB, NULL);
|
|
762 gtk_size_group_add_widget(sg, dd);
|
|
763 gaim_button(_("Show all _instant messages in one tabbed\nwindow"), &im_options, OPT_IM_ONE_WINDOW, vbox);
|
|
764
|
|
765
|
|
766 vbox = make_frame (ret, _("Chat Tabs"));
|
|
767 dd = gaim_dropdown(vbox, _("Tab _placement:"), &chat_options, OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB,
|
|
768 _("Top"), 0,
|
|
769 _("Bottom"), OPT_CHAT_BR_TAB,
|
|
770 _("Left"), OPT_CHAT_SIDE_TAB,
|
|
771 _("Right"), OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, NULL);
|
|
772 gtk_size_group_add_widget(sg, dd);
|
|
773 gaim_button(_("Show all c_hats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW,
|
|
774 vbox);
|
|
775
|
|
776 vbox = make_frame (ret, _("Tab Options"));
|
|
777 button = gaim_button(_("Show _close button on tabs."), &convo_options, OPT_CONVO_NO_X_ON_TAB, vbox);
|
|
778 convo_options ^= OPT_CONVO_NO_X_ON_TAB;
|
|
779 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)));
|
|
780
|
|
781
|
|
782 gtk_widget_show_all(ret);
|
|
783 return ret;
|
|
784 }
|
|
785
|
|
786 GtkWidget *proxy_page() {
|
|
787 GtkWidget *ret;
|
|
788 GtkWidget *vbox;
|
|
789 GtkWidget *entry;
|
|
790 GtkWidget *label;
|
|
791 GtkWidget *hbox;
|
|
792 GtkWidget *table;
|
|
793
|
|
794 ret = gtk_vbox_new(FALSE, 18);
|
|
795 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
796
|
|
797 vbox = make_frame (ret, _("Proxy Type"));
|
|
798 gaim_dropdown(vbox, _("Proxy _type:"), (int*)&global_proxy_info.proxytype, -1,
|
|
799 _("No proxy"), PROXY_NONE,
|
|
800 "SOCKS 4", PROXY_SOCKS4,
|
|
801 "SOCKS 5", PROXY_SOCKS5,
|
|
802 "HTTP", PROXY_HTTP, NULL);
|
|
803
|
|
804 vbox = make_frame(ret, _("Proxy Server"));
|
|
805 prefs_proxy_frame = vbox;
|
|
806
|
|
807 if (global_proxy_info.proxytype == PROXY_NONE)
|
|
808 gtk_widget_set_sensitive(GTK_WIDGET(vbox), FALSE);
|
|
809
|
|
810 table = gtk_table_new(2, 4, FALSE);
|
|
811 gtk_container_set_border_width(GTK_CONTAINER(table), 5);
|
|
812 gtk_table_set_col_spacings(GTK_TABLE(table), 5);
|
|
813 gtk_table_set_row_spacings(GTK_TABLE(table), 10);
|
|
814 gtk_container_add(GTK_CONTAINER(vbox), table);
|
|
815
|
|
816
|
|
817 label = gtk_label_new_with_mnemonic(_("_Host"));
|
|
818 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
|
819 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0);
|
|
820
|
|
821 entry = gtk_entry_new();
|
|
822 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
|
|
823 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0);
|
|
824 g_signal_connect(G_OBJECT(entry), "changed",
|
|
825 G_CALLBACK(proxy_print_option), (void *)PROXYHOST);
|
|
826 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxyhost);
|
|
827
|
|
828 hbox = gtk_hbox_new(TRUE, 5);
|
|
829 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
|
830
|
|
831 label = gtk_label_new_with_mnemonic(_("Port"));
|
|
832 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
|
833 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
|
|
834
|
|
835 entry = gtk_entry_new();
|
|
836 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
|
|
837 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0);
|
|
838 g_signal_connect(G_OBJECT(entry), "changed",
|
|
839 G_CALLBACK(proxy_print_option), (void *)PROXYPORT);
|
|
840
|
|
841 if (global_proxy_info.proxyport) {
|
|
842 char buf[128];
|
|
843 g_snprintf(buf, sizeof(buf), "%d", global_proxy_info.proxyport);
|
|
844 gtk_entry_set_text(GTK_ENTRY(entry), buf);
|
|
845 }
|
|
846
|
|
847 label = gtk_label_new_with_mnemonic(_("_User"));
|
|
848 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
|
849 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
|
|
850
|
|
851 entry = gtk_entry_new();
|
|
852 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
|
|
853 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0);
|
|
854 g_signal_connect(G_OBJECT(entry), "changed",
|
|
855 G_CALLBACK(proxy_print_option), (void *)PROXYUSER);
|
|
856 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxyuser);
|
|
857
|
|
858 hbox = gtk_hbox_new(TRUE, 5);
|
|
859 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
|
860
|
|
861 label = gtk_label_new_with_mnemonic(_("Pa_ssword"));
|
|
862 gtk_misc_set_alignment(GTK_MISC(label), 1.0, 0.5);
|
|
863 gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4, GTK_FILL, 0, 0, 0);
|
|
864
|
|
865 entry = gtk_entry_new();
|
|
866 gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry);
|
|
867 gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0);
|
|
868 gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
|
|
869 g_signal_connect(G_OBJECT(entry), "changed",
|
|
870 G_CALLBACK(proxy_print_option), (void *)PROXYPASS);
|
|
871 gtk_entry_set_text(GTK_ENTRY(entry), global_proxy_info.proxypass);
|
|
872
|
|
873 gtk_widget_show_all(ret);
|
|
874 return ret;
|
|
875 }
|
|
876
|
|
877 #ifndef _WIN32
|
|
878 static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) {
|
|
879 const char *program = gtk_entry_get_text(GTK_ENTRY(entry));
|
|
880
|
|
881 if (!program_is_valid(program)) {
|
|
882 char *error = g_strdup_printf(_("The entered manual browser "
|
|
883 "'%s' is not valid. Hyperlinks will "
|
|
884 "not work."), program);
|
|
885 gaim_notify_warning(NULL, NULL, error, NULL);
|
|
886 }
|
|
887
|
|
888 g_strlcpy(web_command, program, sizeof(web_command));
|
|
889
|
|
890 /* carry on normally */
|
|
891 return FALSE;
|
|
892 }
|
|
893
|
|
894 static GList *get_available_browsers()
|
|
895 {
|
|
896 struct browser {
|
|
897 char *name;
|
|
898 char *command;
|
|
899 int id;
|
|
900 };
|
|
901
|
|
902 static struct browser possible_browsers[] = {
|
|
903 {N_("Konqueror"), "kfmclient", BROWSER_KONQ},
|
|
904 {N_("Opera"), "opera", BROWSER_OPERA},
|
|
905 {N_("Galeon"), "galeon", BROWSER_GALEON},
|
|
906 {N_("Netscape"), "netscape", BROWSER_NETSCAPE},
|
|
907 {N_("Mozilla"), "mozilla", BROWSER_MOZILLA},
|
|
908 };
|
|
909 static const int num_possible_browsers = 5;
|
|
910
|
|
911 GList *browsers = NULL;
|
|
912 int i = 0;
|
|
913
|
|
914 browsers = g_list_prepend(browsers, GINT_TO_POINTER(BROWSER_MANUAL));
|
|
915 browsers = g_list_prepend(browsers, _("Manual"));
|
|
916 for (i = 0; i < num_possible_browsers; i++) {
|
|
917 if (program_is_valid(possible_browsers[i].command)) {
|
|
918 browsers = g_list_prepend(browsers,
|
|
919 GINT_TO_POINTER(possible_browsers[i].id));
|
|
920 browsers = g_list_prepend(browsers, possible_browsers[i].name);
|
|
921 }
|
|
922 }
|
|
923
|
|
924 return browsers;
|
|
925 }
|
|
926
|
|
927 GtkWidget *browser_page() {
|
|
928 GtkWidget *ret;
|
|
929 GtkWidget *vbox;
|
|
930 GtkWidget *hbox;
|
|
931 GtkWidget *label;
|
|
932 GtkSizeGroup *sg;
|
|
933 GList *browsers = NULL;
|
|
934
|
|
935 ret = gtk_vbox_new(FALSE, 18);
|
|
936 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
937
|
|
938 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
939 vbox = make_frame (ret, _("Browser Selection"));
|
|
940
|
|
941 browsers = get_available_browsers();
|
|
942 if (browsers != NULL) {
|
|
943 label = gaim_dropdown_from_list(vbox,_("_Browser"), &web_browser, -1,
|
|
944 browsers);
|
|
945 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
946 gtk_size_group_add_widget(sg, label);
|
|
947 }
|
|
948
|
|
949 hbox = gtk_hbox_new(FALSE, 5);
|
|
950 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
|
|
951 label = gtk_label_new_with_mnemonic(_("_Manual: "));
|
|
952 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
|
953 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
954 gtk_size_group_add_widget(sg, label);
|
|
955
|
|
956 browser_entry = gtk_entry_new();
|
|
957 gtk_label_set_mnemonic_widget(GTK_LABEL(label), browser_entry);
|
|
958 if (web_browser != BROWSER_MANUAL)
|
|
959 gtk_widget_set_sensitive(hbox, FALSE);
|
|
960 gtk_box_pack_start (GTK_BOX (hbox), browser_entry, FALSE, FALSE, 0);
|
|
961
|
|
962 gtk_entry_set_text(GTK_ENTRY(browser_entry), web_command);
|
|
963 g_signal_connect(G_OBJECT(browser_entry), "focus-out-event", G_CALLBACK(manual_browser_set), NULL);
|
|
964
|
|
965 if (browsers != NULL) {
|
|
966 vbox = make_frame (ret, _("Browser Options"));
|
|
967 label = gaim_button(_("Open new _window by default"), &misc_options, OPT_MISC_BROWSER_POPUP, vbox);
|
|
968 }
|
|
969
|
|
970 gtk_widget_show_all(ret);
|
|
971 return ret;
|
|
972 }
|
|
973 #endif /*_WIN32*/
|
|
974
|
|
975 GtkWidget *logging_page() {
|
|
976 GtkWidget *ret;
|
|
977 GtkWidget *vbox;
|
|
978 ret = gtk_vbox_new(FALSE, 18);
|
|
979 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
980
|
|
981 vbox = make_frame (ret, _("Message Logs"));
|
|
982 gaim_button(_("_Log all instant messages"), &logging_options, OPT_LOG_CONVOS, vbox);
|
|
983 gaim_button(_("Log all c_hats"), &logging_options, OPT_LOG_CHATS, vbox);
|
|
984 gaim_button(_("Strip _HTML from logs"), &logging_options, OPT_LOG_STRIP_HTML, vbox);
|
|
985
|
|
986 vbox = make_frame (ret, _("System Logs"));
|
|
987 gaim_button(_("Log when buddies _sign on/sign off"), &logging_options, OPT_LOG_BUDDY_SIGNON,
|
|
988 vbox);
|
|
989 gaim_button(_("Log when buddies become _idle/un-idle"), &logging_options, OPT_LOG_BUDDY_IDLE,
|
|
990 vbox);
|
|
991 gaim_button(_("Log when buddies go away/come _back"), &logging_options, OPT_LOG_BUDDY_AWAY, vbox);
|
|
992 gaim_button(_("Log your _own signons/idleness/awayness"), &logging_options, OPT_LOG_MY_SIGNON,
|
|
993 vbox);
|
|
994 gaim_button(_("I_ndividual log file for each buddy's signons"), &logging_options,
|
|
995 OPT_LOG_INDIVIDUAL, vbox);
|
|
996
|
|
997 gtk_widget_show_all(ret);
|
|
998 return ret;
|
|
999 }
|
|
1000
|
|
1001 static GtkWidget *sndcmd = NULL;
|
|
1002
|
|
1003 #ifndef _WIN32
|
|
1004 static gint sound_cmd_yeah(GtkEntry *entry, gpointer d)
|
|
1005 {
|
|
1006 gaim_sound_set_command(gtk_entry_get_text(GTK_ENTRY(sndcmd)));
|
|
1007 return TRUE;
|
|
1008 }
|
|
1009 #endif
|
|
1010
|
|
1011 GtkWidget *sound_page() {
|
|
1012 GtkWidget *ret;
|
|
1013 GtkWidget *vbox;
|
|
1014 GtkSizeGroup *sg;
|
|
1015 #ifndef _WIN32
|
|
1016 GtkWidget *dd;
|
|
1017 GtkWidget *hbox;
|
|
1018 GtkWidget *label;
|
|
1019 char *cmd;
|
|
1020 #endif
|
|
1021
|
|
1022 ret = gtk_vbox_new(FALSE, 18);
|
|
1023 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
1024
|
|
1025 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
1026
|
|
1027 vbox = make_frame (ret, _("Sound Options"));
|
|
1028 gaim_button(_("_No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox);
|
|
1029 gaim_button(_("_Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox);
|
|
1030
|
|
1031 #ifndef _WIN32
|
|
1032 vbox = make_frame (ret, _("Sound Method"));
|
|
1033 dd = gaim_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP |
|
|
1034 OPT_SOUND_ESD | OPT_SOUND_ARTS | OPT_SOUND_NAS |
|
|
1035 OPT_SOUND_NORMAL | OPT_SOUND_CMD,
|
|
1036 _("Console beep"), OPT_SOUND_BEEP,
|
|
1037 #ifdef USE_AO
|
|
1038 _("Automatic"), OPT_SOUND_NORMAL,
|
|
1039 "ESD", OPT_SOUND_ESD,
|
|
1040 "Arts", OPT_SOUND_ARTS,
|
|
1041 #endif
|
|
1042 #ifdef USE_NAS_AUDIO
|
|
1043 "NAS", OPT_SOUND_NAS,
|
|
1044 #endif
|
|
1045 _("Command"), OPT_SOUND_CMD, NULL);
|
|
1046 gtk_size_group_add_widget(sg, dd);
|
|
1047 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0);
|
|
1048
|
|
1049 hbox = gtk_hbox_new(FALSE, 5);
|
|
1050 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5);
|
|
1051
|
|
1052 hbox = gtk_hbox_new(FALSE, 5);
|
|
1053 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
1054 label = gtk_label_new_with_mnemonic(_("Sound c_ommand\n(%s for filename)"));
|
|
1055 gtk_size_group_add_widget(sg, label);
|
|
1056 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
1057 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5);
|
|
1058
|
|
1059 sndcmd = gtk_entry_new();
|
|
1060 gtk_label_set_mnemonic_widget(GTK_LABEL(label), sndcmd);
|
|
1061
|
|
1062 gtk_editable_set_editable(GTK_EDITABLE(sndcmd), TRUE);
|
|
1063 cmd = gaim_sound_get_command();
|
|
1064 if(cmd)
|
|
1065 gtk_entry_set_text(GTK_ENTRY(sndcmd), cmd);
|
|
1066 gtk_widget_set_size_request(sndcmd, 75, -1);
|
|
1067
|
|
1068 gtk_widget_set_sensitive(sndcmd, (sound_options & OPT_SOUND_CMD));
|
|
1069 gtk_box_pack_start(GTK_BOX(hbox), sndcmd, TRUE, TRUE, 5);
|
|
1070 g_signal_connect(G_OBJECT(sndcmd), "changed",
|
|
1071 G_CALLBACK(sound_cmd_yeah), NULL);
|
|
1072 #endif /* _WIN32 */
|
|
1073 gtk_widget_show_all(ret);
|
|
1074 return ret;
|
|
1075 }
|
|
1076
|
|
1077 GtkWidget *away_page() {
|
|
1078 GtkWidget *ret;
|
|
1079 GtkWidget *vbox;
|
|
1080 GtkWidget *hbox;
|
|
1081 GtkWidget *label;
|
|
1082 GtkWidget *button;
|
|
1083 GtkWidget *select;
|
|
1084 GtkWidget *dd;
|
|
1085 GtkSizeGroup *sg;
|
|
1086
|
|
1087 ret = gtk_vbox_new(FALSE, 18);
|
|
1088 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
1089
|
|
1090 sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
|
|
1091
|
|
1092 vbox = make_frame (ret, _("Away"));
|
|
1093 gaim_button(_("_Sending messages removes away status"), &away_options, OPT_AWAY_BACK_ON_IM, vbox);
|
|
1094 gaim_button(_("_Queue new messages when away"), &away_options, OPT_AWAY_QUEUE, vbox);
|
|
1095
|
|
1096 vbox = make_frame (ret, _("Auto-response"));
|
|
1097 hbox = gtk_hbox_new(FALSE, 0);
|
|
1098 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
1099 gaim_labeled_spin_button(hbox, _("Seconds before _resending:"),
|
|
1100 &away_resend, 1, 24 * 60 * 60, sg);
|
|
1101 gaim_button(_("_Don't send auto-response"), &away_options, OPT_AWAY_NO_AUTO_RESP, vbox);
|
|
1102 gaim_button(_("_Only send auto-response when idle"), &away_options, OPT_AWAY_IDLE_RESP, vbox);
|
|
1103 gaim_button(_("Do_n't send auto-response in active conversations"), &away_options, OPT_AWAY_DELAY_IN_USE, vbox);
|
|
1104
|
|
1105 if (away_options & OPT_AWAY_NO_AUTO_RESP)
|
|
1106 gtk_widget_set_sensitive(hbox, FALSE);
|
|
1107
|
|
1108 vbox = make_frame (ret, _("Idle"));
|
|
1109 dd = gaim_dropdown(vbox, _("Idle _time reporting:"), &report_idle, -1,
|
|
1110 _("None"), IDLE_NONE,
|
|
1111 _("Gaim usage"), IDLE_GAIM,
|
|
1112 #ifdef USE_SCREENSAVER
|
|
1113 #ifndef _WIN32
|
|
1114 _("X usage"), IDLE_SCREENSAVER,
|
|
1115 #else
|
|
1116 _("Windows usage"), IDLE_SCREENSAVER,
|
|
1117 #endif
|
|
1118 #endif
|
|
1119 NULL);
|
|
1120 gtk_size_group_add_widget(sg, dd);
|
|
1121 gtk_misc_set_alignment(GTK_MISC(dd), 0, 0);
|
|
1122
|
|
1123 vbox = make_frame (ret, _("Auto-away"));
|
|
1124 button = gaim_button(_("Set away _when idle"), &away_options, OPT_AWAY_AUTO, vbox);
|
|
1125 select = gaim_labeled_spin_button(vbox, _("_Minutes before setting away:"), &auto_away, 1, 24 * 60, sg);
|
|
1126 if (!(away_options & OPT_AWAY_AUTO))
|
|
1127 gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE);
|
|
1128 g_signal_connect(G_OBJECT(button), "clicked",
|
|
1129 G_CALLBACK(gaim_gtk_toggle_sensitive), select);
|
|
1130
|
|
1131 label = gtk_label_new_with_mnemonic(_("Away m_essage:"));
|
|
1132 gtk_size_group_add_widget(sg, label);
|
|
1133 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
1134 hbox = gtk_hbox_new(FALSE, 0);
|
|
1135 gtk_container_add(GTK_CONTAINER(vbox), hbox);
|
|
1136 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
|
1137 prefs_away_menu = gtk_option_menu_new();
|
|
1138 gtk_label_set_mnemonic_widget(GTK_LABEL(label), prefs_away_menu);
|
|
1139 if (!(away_options & OPT_AWAY_AUTO))
|
|
1140 gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE);
|
|
1141 g_signal_connect(G_OBJECT(button), "clicked",
|
|
1142 G_CALLBACK(gaim_gtk_toggle_sensitive), prefs_away_menu);
|
|
1143 default_away_menu_init(prefs_away_menu);
|
|
1144 gtk_widget_show(prefs_away_menu);
|
|
1145 gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0);
|
|
1146
|
|
1147 gtk_widget_show_all(ret);
|
|
1148 return ret;
|
|
1149 }
|
|
1150
|
|
1151 static GtkWidget *plugin_description=NULL, *plugin_details=NULL;
|
|
1152
|
|
1153 static void prefs_plugin_sel (GtkTreeSelection *sel, GtkTreeModel *model)
|
|
1154 {
|
|
1155 gchar *buf, *pname, *perr, *pdesc, *pauth, *pweb;
|
|
1156 GtkTreeIter iter;
|
|
1157 GValue val = { 0, };
|
|
1158 GaimPlugin *plug;
|
|
1159
|
|
1160 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
1161 return;
|
|
1162 gtk_tree_model_get_value (model, &iter, 2, &val);
|
|
1163 plug = g_value_get_pointer(&val);
|
|
1164
|
|
1165 pname = g_markup_escape_text(_(plug->info->name), -1);
|
|
1166 pdesc = g_markup_escape_text(_(plug->info->description), -1);
|
|
1167 pauth = g_markup_escape_text(_(plug->info->author), -1);
|
|
1168 pweb = g_markup_escape_text(_(plug->info->homepage), -1);
|
|
1169 if (plug->error != NULL) {
|
|
1170 perr = g_markup_escape_text(_(plug->error), -1);
|
|
1171 buf = g_strdup_printf(
|
|
1172 "<span size=\"larger\">%s %s</span>\n\n"
|
|
1173 "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
|
|
1174 "%s",
|
|
1175 pname, plug->info->version, perr, pdesc);
|
|
1176 g_free(perr);
|
|
1177 }
|
|
1178 else {
|
|
1179 buf = g_strdup_printf(
|
|
1180 "<span size=\"larger\">%s %s</span>\n\n%s",
|
|
1181 pname, plug->info->version, pdesc);
|
|
1182 }
|
|
1183 gtk_label_set_markup(GTK_LABEL(plugin_description), buf);
|
|
1184 g_free(buf);
|
|
1185
|
|
1186 buf = g_strdup_printf(
|
|
1187 #ifndef _WIN32
|
|
1188 _("<span size=\"larger\">%s %s</span>\n\n"
|
|
1189 "<span weight=\"bold\">Written by:</span>\t%s\n"
|
|
1190 "<span weight=\"bold\">Web site:</span>\t\t%s\n"
|
|
1191 "<span weight=\"bold\">File name:</span>\t%s"),
|
|
1192 #else
|
|
1193 _("<span size=\"larger\">%s %s</span>\n\n"
|
|
1194 "<span weight=\"bold\">Written by:</span> %s\n"
|
|
1195 "<span weight=\"bold\">URL:</span> %s\n"
|
|
1196 "<span weight=\"bold\">File name:</span> %s"),
|
|
1197 #endif
|
|
1198 pname, plug->info->version, pauth, pweb, plug->path);
|
|
1199
|
|
1200 gtk_label_set_markup(GTK_LABEL(plugin_details), buf);
|
|
1201 g_value_unset(&val);
|
|
1202 g_free(buf);
|
|
1203 g_free(pname);
|
|
1204 g_free(pdesc);
|
|
1205 g_free(pauth);
|
|
1206 g_free(pweb);
|
|
1207 }
|
|
1208
|
|
1209 static void plugin_load (GtkCellRendererToggle *cell, gchar *pth, gpointer data)
|
|
1210 {
|
|
1211 GtkTreeModel *model = (GtkTreeModel *)data;
|
|
1212 GtkTreeIter iter;
|
|
1213 GtkTreePath *path = gtk_tree_path_new_from_string(pth);
|
|
1214 GaimPlugin *plug;
|
|
1215 gchar buf[1024];
|
|
1216
|
|
1217 GdkCursor *wait = gdk_cursor_new (GDK_WATCH);
|
|
1218 gdk_window_set_cursor(prefs->window, wait);
|
|
1219 gdk_cursor_unref(wait);
|
|
1220
|
|
1221 gtk_tree_model_get_iter (model, &iter, path);
|
|
1222 gtk_tree_model_get (model, &iter, 2, &plug, -1);
|
|
1223
|
|
1224 if (!gaim_plugin_is_loaded(plug)) {
|
|
1225 gaim_plugin_load(plug);
|
|
1226
|
|
1227 /*
|
|
1228 * NOTE: This is basically the same check as before
|
|
1229 * (plug->type == plugin), but now there aren't plugin types.
|
|
1230 * Not yet, anyway. I want to do a V2 of the plugin API.
|
|
1231 * The thing is, we should have a flag specifying the UI type,
|
|
1232 * or just whether it's a general plugin or a UI-specific
|
|
1233 * plugin. We should only load this if it's UI-specific.
|
|
1234 *
|
|
1235 * -- ChipX86
|
|
1236 */
|
|
1237 if (GAIM_IS_GTK_PLUGIN(plug))
|
|
1238 {
|
|
1239 GtkWidget *config_frame;
|
|
1240 GaimGtkPluginUiInfo *ui_info;
|
|
1241
|
|
1242 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug);
|
|
1243 config_frame = gaim_gtk_plugin_get_config_frame(plug);
|
|
1244
|
|
1245 if (config_frame != NULL) {
|
|
1246 ui_info->iter = g_new0(GtkTreeIter, 1);
|
|
1247 prefs_notebook_add_page(_(plug->info->name), NULL,
|
|
1248 config_frame, ui_info->iter,
|
|
1249 &plugin_iter, notebook_page++);
|
|
1250
|
|
1251 if (gtk_tree_model_iter_n_children(GTK_TREE_MODEL(prefstree),
|
|
1252 &plugin_iter) == 1) {
|
|
1253
|
|
1254 /* Expand the tree for the first plugin added */
|
|
1255 GtkTreePath *path2;
|
|
1256
|
|
1257 path2 = gtk_tree_model_get_path(GTK_TREE_MODEL(prefstree),
|
|
1258 &plugin_iter);
|
|
1259 gtk_tree_view_expand_row(GTK_TREE_VIEW(tree_v),
|
|
1260 path2, TRUE);
|
|
1261 gtk_tree_path_free(path2);
|
|
1262 }
|
|
1263 }
|
|
1264 }
|
|
1265 }
|
|
1266 else {
|
|
1267 if (GAIM_IS_GTK_PLUGIN(plug)) {
|
|
1268 GaimGtkPluginUiInfo *ui_info;
|
|
1269
|
|
1270 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug);
|
|
1271
|
|
1272 if (ui_info != NULL && ui_info->iter != NULL) {
|
|
1273 gtk_tree_store_remove(GTK_TREE_STORE(prefstree), ui_info->iter);
|
|
1274 g_free(ui_info->iter);
|
|
1275 ui_info->iter = NULL;
|
|
1276 }
|
|
1277 }
|
|
1278
|
|
1279 gaim_plugin_unload(plug);
|
|
1280 }
|
|
1281
|
|
1282 gdk_window_set_cursor(prefs->window, NULL);
|
|
1283
|
|
1284 if (plug->error != NULL) {
|
|
1285 g_snprintf(buf, sizeof(buf),
|
|
1286 "<span size=\"larger\">%s %s</span>\n\n"
|
|
1287 "<span weight=\"bold\" color=\"red\">%s</span>\n\n"
|
|
1288 "%s",
|
|
1289 g_markup_escape_text(_(plug->info->name), -1),
|
|
1290 plug->info->version,
|
|
1291 g_markup_escape_text(plug->error, -1),
|
|
1292 g_markup_escape_text(_(plug->info->description), -1));
|
|
1293 }
|
|
1294 else {
|
|
1295 g_snprintf(buf, sizeof(buf),
|
|
1296 "<span size=\"larger\">%s %s</span>\n\n%s",
|
|
1297 g_markup_escape_text(_(plug->info->name), -1),
|
|
1298 plug->info->version,
|
|
1299 g_markup_escape_text(_(plug->info->description), -1));
|
|
1300 }
|
|
1301
|
|
1302 gtk_label_set_markup(GTK_LABEL(plugin_description), buf);
|
|
1303 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0,
|
|
1304 gaim_plugin_is_loaded(plug), -1);
|
|
1305
|
|
1306 gtk_label_set_markup(GTK_LABEL(plugin_description), buf);
|
|
1307 gtk_tree_path_free(path);
|
|
1308 }
|
|
1309
|
|
1310 static void
|
|
1311 update_plugin_list(void *data)
|
|
1312 {
|
|
1313 GtkListStore *ls = GTK_LIST_STORE(data);
|
|
1314 GtkTreeIter iter;
|
|
1315 GList *probes;
|
|
1316 GaimPlugin *plug;
|
|
1317
|
|
1318 gtk_list_store_clear(ls);
|
|
1319
|
|
1320 for (probes = gaim_plugins_get_all();
|
|
1321 probes != NULL;
|
|
1322 probes = probes->next) {
|
|
1323
|
|
1324 plug = probes->data;
|
|
1325
|
|
1326 if (plug->info->type != GAIM_PLUGIN_STANDARD)
|
|
1327 continue;
|
|
1328
|
|
1329 gtk_list_store_append (ls, &iter);
|
|
1330 gtk_list_store_set(ls, &iter,
|
|
1331 0, gaim_plugin_is_loaded(plug),
|
|
1332 1, plug->info->name ? _(plug->info->name) : plug->path,
|
|
1333 2, plug, -1);
|
|
1334 }
|
|
1335 }
|
|
1336
|
|
1337 static GtkWidget *plugin_page ()
|
|
1338 {
|
|
1339 GtkWidget *ret;
|
|
1340 GtkWidget *sw, *vp;
|
|
1341 GtkWidget *event_view;
|
|
1342 GtkListStore *ls;
|
|
1343 GtkCellRenderer *rend, *rendt;
|
|
1344 GtkTreeViewColumn *col;
|
|
1345 GtkTreeSelection *sel;
|
|
1346 GtkTreePath *path;
|
|
1347 GtkWidget *nb;
|
|
1348
|
|
1349 ret = gtk_vbox_new(FALSE, 18);
|
|
1350 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
1351
|
|
1352 sw = gtk_scrolled_window_new(NULL,NULL);
|
|
1353 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
|
1354 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
|
|
1355
|
|
1356 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0);
|
|
1357
|
|
1358 ls = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
|
|
1359
|
|
1360 update_plugin_list(ls);
|
|
1361
|
|
1362 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(ls));
|
|
1363
|
|
1364 rend = gtk_cell_renderer_toggle_new();
|
|
1365 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
|
|
1366
|
|
1367
|
|
1368 col = gtk_tree_view_column_new_with_attributes (_("Load"),
|
|
1369 rend,
|
|
1370 "active", 0,
|
|
1371 NULL);
|
|
1372 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
|
|
1373
|
|
1374 rendt = gtk_cell_renderer_text_new();
|
|
1375 col = gtk_tree_view_column_new_with_attributes (_("Name"),
|
|
1376 rendt,
|
|
1377 "text", 1,
|
|
1378 NULL);
|
|
1379 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
|
|
1380 g_object_unref(G_OBJECT(ls));
|
|
1381 gtk_container_add(GTK_CONTAINER(sw), event_view);
|
|
1382
|
|
1383
|
|
1384 nb = gtk_notebook_new();
|
|
1385 gtk_notebook_set_tab_pos (GTK_NOTEBOOK(nb), GTK_POS_BOTTOM);
|
|
1386 gtk_notebook_popup_disable(GTK_NOTEBOOK(nb));
|
|
1387
|
|
1388 /* Description */
|
|
1389 sw = gtk_scrolled_window_new(NULL, NULL);
|
|
1390 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
1391 plugin_description = gtk_label_new(NULL);
|
|
1392
|
|
1393 vp = gtk_viewport_new(NULL, NULL);
|
|
1394 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE);
|
|
1395 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE);
|
|
1396
|
|
1397 gtk_container_add(GTK_CONTAINER(vp), plugin_description);
|
|
1398 gtk_container_add(GTK_CONTAINER(sw), vp);
|
|
1399
|
|
1400 gtk_label_set_selectable(GTK_LABEL(plugin_description), TRUE);
|
|
1401 gtk_label_set_line_wrap(GTK_LABEL(plugin_description), TRUE);
|
|
1402 gtk_misc_set_alignment(GTK_MISC(plugin_description), 0, 0);
|
|
1403 gtk_misc_set_padding(GTK_MISC(plugin_description), 6, 6);
|
|
1404 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Description")));
|
|
1405
|
|
1406 /* Details */
|
|
1407 sw = gtk_scrolled_window_new(NULL, NULL);
|
|
1408 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW(sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
|
1409 plugin_details = gtk_label_new(NULL);
|
|
1410
|
|
1411 vp = gtk_viewport_new(NULL, NULL);
|
|
1412 gtk_viewport_set_shadow_type(GTK_VIEWPORT(vp), GTK_SHADOW_NONE);
|
|
1413 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_NONE);
|
|
1414
|
|
1415 gtk_container_add(GTK_CONTAINER(vp), plugin_details);
|
|
1416 gtk_container_add(GTK_CONTAINER(sw), vp);
|
|
1417
|
|
1418 gtk_label_set_selectable(GTK_LABEL(plugin_details), TRUE);
|
|
1419 gtk_label_set_line_wrap(GTK_LABEL(plugin_details), TRUE);
|
|
1420 gtk_misc_set_alignment(GTK_MISC(plugin_details), 0, 0);
|
|
1421 gtk_misc_set_padding(GTK_MISC(plugin_details), 6, 6);
|
|
1422 gtk_notebook_append_page(GTK_NOTEBOOK(nb), sw, gtk_label_new(_("Details")));
|
|
1423 gtk_box_pack_start(GTK_BOX(ret), nb, TRUE, TRUE, 0);
|
|
1424
|
|
1425 g_signal_connect (G_OBJECT (sel), "changed",
|
|
1426 G_CALLBACK (prefs_plugin_sel),
|
|
1427 NULL);
|
|
1428 g_signal_connect (G_OBJECT(rend), "toggled",
|
|
1429 G_CALLBACK(plugin_load), ls);
|
|
1430
|
|
1431 path = gtk_tree_path_new_first();
|
|
1432 gtk_tree_selection_select_path(sel, path);
|
|
1433 gtk_tree_path_free(path);
|
|
1434
|
|
1435 gaim_plugins_register_probe_notify_cb(update_plugin_list, ls);
|
|
1436
|
|
1437 gtk_widget_show_all(ret);
|
|
1438 return ret;
|
|
1439 }
|
|
1440
|
|
1441 static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data)
|
|
1442 {
|
|
1443 GtkTreeModel *model = (GtkTreeModel *)data;
|
|
1444 GtkTreeIter iter;
|
|
1445 GtkTreePath *path = gtk_tree_path_new_from_string(pth);
|
|
1446 gint soundnum;
|
|
1447
|
|
1448 gtk_tree_model_get_iter (model, &iter, path);
|
|
1449 gtk_tree_model_get (model, &iter, 2, &soundnum, -1);
|
|
1450
|
|
1451 sound_options ^= gaim_sound_get_event_option(soundnum);
|
|
1452 gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, sound_options & gaim_sound_get_event_option(soundnum), -1);
|
|
1453
|
|
1454 gtk_tree_path_free(path);
|
|
1455 }
|
|
1456
|
|
1457 static void test_sound(GtkWidget *button, gpointer i_am_NULL)
|
|
1458 {
|
|
1459 guint32 tmp_sound = sound_options;
|
|
1460 if (!(sound_options & OPT_SOUND_WHEN_AWAY))
|
|
1461 sound_options ^= OPT_SOUND_WHEN_AWAY;
|
|
1462 if (!(sound_options & gaim_sound_get_event_option(sound_row_sel)))
|
|
1463 sound_options ^= gaim_sound_get_event_option(sound_row_sel);
|
|
1464 gaim_sound_play_event(sound_row_sel);
|
|
1465
|
|
1466 sound_options = tmp_sound;
|
|
1467 }
|
|
1468
|
|
1469 static void reset_sound(GtkWidget *button, gpointer i_am_also_NULL)
|
|
1470 {
|
|
1471 /* This just resets a sound file back to default */
|
|
1472 gaim_sound_set_event_file(sound_row_sel, NULL);
|
|
1473
|
|
1474 gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)");
|
|
1475 }
|
|
1476
|
|
1477 void close_sounddialog(GtkWidget *w, GtkWidget *w2)
|
|
1478 {
|
|
1479
|
|
1480 GtkWidget *dest;
|
|
1481
|
|
1482 if (!GTK_IS_WIDGET(w2))
|
|
1483 dest = w;
|
|
1484 else
|
|
1485 dest = w2;
|
|
1486
|
|
1487 sounddialog = NULL;
|
|
1488
|
|
1489 gtk_widget_destroy(dest);
|
|
1490 }
|
|
1491
|
|
1492 void do_select_sound(GtkWidget *w, int snd)
|
|
1493 {
|
|
1494 const char *file;
|
|
1495
|
|
1496 file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(sounddialog));
|
|
1497
|
|
1498 /* If they type in a directory, change there */
|
|
1499 if (file_is_dir(file, sounddialog))
|
|
1500 return;
|
|
1501
|
|
1502 /* Set it -- and forget it */
|
|
1503 gaim_sound_set_event_file(snd, file);
|
|
1504
|
|
1505 /* Set our text entry */
|
|
1506 gtk_entry_set_text(GTK_ENTRY(sound_entry), file);
|
|
1507
|
|
1508 /* Close the window! It's getting cold in here! */
|
|
1509 close_sounddialog(NULL, sounddialog);
|
|
1510
|
|
1511 if (last_sound_dir)
|
|
1512 g_free(last_sound_dir);
|
|
1513 last_sound_dir = g_path_get_dirname(file);
|
|
1514 }
|
|
1515
|
|
1516 static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun)
|
|
1517 {
|
|
1518 char *buf = g_malloc(BUF_LEN);
|
|
1519
|
|
1520 if (!sounddialog) {
|
|
1521 sounddialog = gtk_file_selection_new(_("Sound Selection"));
|
|
1522
|
|
1523 gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(sounddialog));
|
|
1524
|
|
1525 g_snprintf(buf, BUF_LEN - 1, "%s" G_DIR_SEPARATOR_S, last_sound_dir ? last_sound_dir : gaim_home_dir());
|
|
1526
|
|
1527 gtk_file_selection_set_filename(GTK_FILE_SELECTION(sounddialog), buf);
|
|
1528
|
|
1529 g_signal_connect(G_OBJECT(sounddialog), "destroy",
|
|
1530 G_CALLBACK(close_sounddialog), sounddialog);
|
|
1531
|
|
1532 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button),
|
|
1533 "clicked",
|
|
1534 G_CALLBACK(do_select_sound), (int *)sound_row_sel);
|
|
1535
|
|
1536 g_signal_connect(G_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button),
|
|
1537 "clicked",
|
|
1538 G_CALLBACK(close_sounddialog), sounddialog);
|
|
1539 }
|
|
1540
|
|
1541 g_free(buf);
|
|
1542 gtk_widget_show(sounddialog);
|
|
1543 gdk_window_raise(sounddialog->window);
|
|
1544 }
|
|
1545
|
|
1546
|
|
1547 static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) {
|
|
1548 GtkTreeIter iter;
|
|
1549 GValue val = { 0, };
|
|
1550 char *file;
|
|
1551
|
|
1552 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
1553 return;
|
|
1554 gtk_tree_model_get_value (model, &iter, 2, &val);
|
|
1555 sound_row_sel = g_value_get_uint(&val);
|
|
1556 file = gaim_sound_get_event_file(sound_row_sel);
|
|
1557 if (sound_entry)
|
|
1558 gtk_entry_set_text(GTK_ENTRY(sound_entry), file ? file : "(default)");
|
|
1559 g_value_unset (&val);
|
|
1560 if (sounddialog)
|
|
1561 gtk_widget_destroy(sounddialog);
|
|
1562 }
|
|
1563
|
|
1564 GtkWidget *sound_events_page() {
|
|
1565
|
|
1566 GtkWidget *ret;
|
|
1567 GtkWidget *sw;
|
|
1568 GtkWidget *button, *hbox;
|
|
1569 GtkTreeIter iter;
|
|
1570 GtkWidget *event_view;
|
|
1571 GtkListStore *event_store;
|
|
1572 GtkCellRenderer *rend;
|
|
1573 GtkTreeViewColumn *col;
|
|
1574 GtkTreeSelection *sel;
|
|
1575 GtkTreePath *path;
|
|
1576 int j;
|
|
1577 char *file;
|
|
1578
|
|
1579 ret = gtk_vbox_new(FALSE, 18);
|
|
1580 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
1581
|
|
1582 sw = gtk_scrolled_window_new(NULL,NULL);
|
|
1583 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
|
|
1584 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
|
|
1585
|
|
1586 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0);
|
|
1587 event_store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT);
|
|
1588
|
|
1589 for (j=0; j < GAIM_NUM_SOUNDS; j++) {
|
|
1590 guint opt = gaim_sound_get_event_option(j);
|
|
1591 if (opt == 0)
|
|
1592 continue;
|
|
1593
|
|
1594 gtk_list_store_append (event_store, &iter);
|
|
1595 gtk_list_store_set(event_store, &iter,
|
|
1596 0, sound_options & opt,
|
|
1597 1, gettext(gaim_sound_get_event_label(j)),
|
|
1598 2, j, -1);
|
|
1599 }
|
|
1600
|
|
1601 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store));
|
|
1602
|
|
1603 rend = gtk_cell_renderer_toggle_new();
|
|
1604 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
|
|
1605 g_signal_connect (G_OBJECT (sel), "changed",
|
|
1606 G_CALLBACK (prefs_sound_sel),
|
|
1607 NULL);
|
|
1608 g_signal_connect (G_OBJECT(rend), "toggled",
|
|
1609 G_CALLBACK(event_toggled), event_store);
|
|
1610 path = gtk_tree_path_new_first();
|
|
1611 gtk_tree_selection_select_path(sel, path);
|
|
1612 gtk_tree_path_free(path);
|
|
1613
|
|
1614 col = gtk_tree_view_column_new_with_attributes (_("Play"),
|
|
1615 rend,
|
|
1616 "active", 0,
|
|
1617 NULL);
|
|
1618 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
|
|
1619
|
|
1620 rend = gtk_cell_renderer_text_new();
|
|
1621 col = gtk_tree_view_column_new_with_attributes (_("Event"),
|
|
1622 rend,
|
|
1623 "text", 1,
|
|
1624 NULL);
|
|
1625 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
|
|
1626 g_object_unref(G_OBJECT(event_store));
|
|
1627 gtk_container_add(GTK_CONTAINER(sw), event_view);
|
|
1628
|
|
1629 hbox = gtk_hbox_new(FALSE, 6);
|
|
1630 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0);
|
|
1631 sound_entry = gtk_entry_new();
|
|
1632 file = gaim_sound_get_event_file(0);
|
|
1633 gtk_entry_set_text(GTK_ENTRY(sound_entry), file ? file : "(default)");
|
|
1634 gtk_editable_set_editable(GTK_EDITABLE(sound_entry), FALSE);
|
|
1635 gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5);
|
|
1636
|
|
1637 button = gtk_button_new_with_label(_("Test"));
|
|
1638 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(test_sound), NULL);
|
|
1639 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
|
|
1640
|
|
1641 button = gtk_button_new_with_label(_("Reset"));
|
|
1642 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(reset_sound), NULL);
|
|
1643 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
|
|
1644
|
|
1645 button = gtk_button_new_with_label(_("Choose..."));
|
|
1646 g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(sel_sound), NULL);
|
|
1647 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1);
|
|
1648
|
|
1649 gtk_widget_show_all (ret);
|
|
1650
|
|
1651 return ret;
|
|
1652 }
|
|
1653
|
|
1654 void away_message_sel(GtkTreeSelection *sel, GtkTreeModel *model)
|
|
1655 {
|
|
1656 GtkTreeIter iter;
|
|
1657 GValue val = { 0, };
|
|
1658 gchar buffer[BUF_LONG];
|
|
1659 char *tmp;
|
|
1660 struct away_message *am;
|
|
1661
|
|
1662 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
1663 return;
|
|
1664 gtk_tree_model_get_value (model, &iter, 1, &val);
|
|
1665 am = g_value_get_pointer(&val);
|
|
1666 gtk_imhtml_clear(GTK_IMHTML(away_text));
|
|
1667 strncpy(buffer, am->message, BUF_LONG);
|
|
1668 tmp = stylize(buffer, BUF_LONG);
|
|
1669 gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE |
|
|
1670 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
|
|
1671 gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE |
|
|
1672 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
|
|
1673 g_free(tmp);
|
|
1674 g_value_unset (&val);
|
|
1675
|
|
1676 }
|
|
1677
|
|
1678 void remove_away_message(GtkWidget *widget, GtkTreeView *tv) {
|
|
1679 struct away_message *am;
|
|
1680 GtkTreeIter iter;
|
|
1681 GtkTreeSelection *sel = gtk_tree_view_get_selection(tv);
|
|
1682 GtkTreeModel *model = GTK_TREE_MODEL(prefs_away_store);
|
|
1683 GValue val = { 0, };
|
|
1684
|
|
1685 if (! gtk_tree_selection_get_selected (sel, &model, &iter))
|
|
1686 return;
|
|
1687 gtk_tree_model_get_value (GTK_TREE_MODEL(prefs_away_store), &iter, 1, &val);
|
|
1688 am = g_value_get_pointer (&val);
|
|
1689 gtk_imhtml_clear(GTK_IMHTML(away_text));
|
|
1690 rem_away_mess(NULL, am);
|
|
1691 }
|
|
1692
|
|
1693 GtkWidget *away_message_page() {
|
|
1694 GtkWidget *ret;
|
|
1695 GtkWidget *hbox;
|
|
1696 GtkWidget *button;
|
|
1697 GtkWidget *sw;
|
|
1698 GtkTreeIter iter;
|
|
1699 GtkWidget *event_view;
|
|
1700 GtkCellRenderer *rend;
|
|
1701 GtkTreeViewColumn *col;
|
|
1702 GtkTreeSelection *sel;
|
|
1703 GSList *awy = away_messages;
|
|
1704 struct away_message *a;
|
|
1705 GtkWidget *sw2;
|
|
1706 GtkSizeGroup *sg;
|
|
1707
|
|
1708 ret = gtk_vbox_new(FALSE, 18);
|
|
1709 gtk_container_set_border_width (GTK_CONTAINER (ret), 12);
|
|
1710
|
|
1711 sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
|
|
1712
|
|
1713 sw = gtk_scrolled_window_new(NULL,NULL);
|
|
1714 away_text = gtk_imhtml_new(NULL, NULL);
|
|
1715 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
|
|
1716 /*
|
|
1717 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
|
|
1718 */
|
|
1719 gtk_box_pack_start(GTK_BOX(ret), sw, TRUE, TRUE, 0);
|
|
1720
|
|
1721 prefs_away_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
|
|
1722 while (awy) {
|
|
1723 a = (struct away_message *)awy->data;
|
|
1724 gtk_list_store_append (prefs_away_store, &iter);
|
|
1725 gtk_list_store_set(prefs_away_store, &iter,
|
|
1726 0, a->name,
|
|
1727 1, a, -1);
|
|
1728 awy = awy->next;
|
|
1729 }
|
|
1730 event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store));
|
|
1731
|
|
1732
|
|
1733 rend = gtk_cell_renderer_text_new();
|
|
1734 col = gtk_tree_view_column_new_with_attributes ("NULL",
|
|
1735 rend,
|
|
1736 "text", 0,
|
|
1737 NULL);
|
|
1738 gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col);
|
|
1739 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE);
|
|
1740 gtk_widget_show(event_view);
|
|
1741 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), event_view);
|
|
1742
|
|
1743 sw2 = gtk_scrolled_window_new(NULL, NULL);
|
|
1744 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2),
|
|
1745 GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
|
1746 gtk_box_pack_start(GTK_BOX(ret), sw2, TRUE, TRUE, 0);
|
|
1747
|
|
1748 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw2), away_text);
|
|
1749 gaim_setup_imhtml(away_text);
|
|
1750 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view));
|
|
1751 g_signal_connect (G_OBJECT (sel), "changed",
|
|
1752 G_CALLBACK (away_message_sel),
|
|
1753 NULL);
|
|
1754 hbox = gtk_hbox_new(TRUE, 5);
|
|
1755 gtk_box_pack_start(GTK_BOX(ret), hbox, FALSE, FALSE, 0);
|
|
1756 button = gtk_button_new_from_stock (GTK_STOCK_ADD);
|
|
1757 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
|
1758 gtk_size_group_add_widget(sg, button);
|
|
1759 g_signal_connect(G_OBJECT(button), "clicked",
|
|
1760 G_CALLBACK(create_away_mess), NULL);
|
|
1761
|
|
1762 button = gtk_button_new_from_stock (GTK_STOCK_REMOVE);
|
|
1763 gtk_size_group_add_widget(sg, button);
|
|
1764 g_signal_connect(G_OBJECT(button), "clicked",
|
|
1765 G_CALLBACK(remove_away_message), event_view);
|
|
1766
|
|
1767 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
|
1768
|
|
1769 button = gaim_pixbuf_button_from_stock(_("_Edit"), GAIM_STOCK_EDIT, GAIM_BUTTON_HORIZONTAL);
|
|
1770 gtk_size_group_add_widget(sg, button);
|
|
1771 g_signal_connect(G_OBJECT(button), "clicked",
|
|
1772 G_CALLBACK(create_away_mess), event_view);
|
|
1773 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
|
1774
|
|
1775 gtk_widget_show_all(ret);
|
|
1776 return ret;
|
|
1777 }
|
|
1778
|
|
1779 GtkTreeIter *prefs_notebook_add_page(const char *text,
|
|
1780 GdkPixbuf *pixbuf,
|
|
1781 GtkWidget *page,
|
|
1782 GtkTreeIter *iter,
|
|
1783 GtkTreeIter *parent,
|
|
1784 int ind) {
|
|
1785 GdkPixbuf *icon = NULL;
|
|
1786
|
|
1787 if (pixbuf)
|
|
1788 icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR);
|
|
1789
|
|
1790 gtk_tree_store_append (prefstree, iter, parent);
|
|
1791 gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1);
|
|
1792
|
|
1793 if (pixbuf)
|
|
1794 g_object_unref(pixbuf);
|
|
1795 if (icon)
|
|
1796 g_object_unref(icon);
|
|
1797 gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text));
|
|
1798 return iter;
|
|
1799 }
|
|
1800
|
|
1801 void prefs_notebook_init() {
|
|
1802 GtkTreeIter p, p2, c;
|
|
1803 GList *l;
|
|
1804 GaimPlugin *plug;
|
|
1805 prefs_notebook_add_page(_("Interface"), NULL, interface_page(), &p, NULL, notebook_page++);
|
|
1806 prefs_notebook_add_page(_("Smiley Themes"), NULL, theme_page(), &c, &p, notebook_page++);
|
|
1807 prefs_notebook_add_page(_("Fonts"), NULL, font_page(), &c, &p, notebook_page++);
|
|
1808 prefs_notebook_add_page(_("Message Text"), NULL, messages_page(), &c, &p, notebook_page++);
|
|
1809 prefs_notebook_add_page(_("Shortcuts"), NULL, hotkeys_page(), &c, &p, notebook_page++);
|
|
1810 prefs_notebook_add_page(_("Buddy List"), NULL, list_page(), &c, &p, notebook_page++);
|
|
1811 prefs_notebook_add_page(_("Conversations"), NULL, conv_page(), &p2, NULL, notebook_page++);
|
|
1812 prefs_notebook_add_page(_("IMs"), NULL, im_page(), &c, &p2, notebook_page++);
|
|
1813 prefs_notebook_add_page(_("Chats"), NULL, chat_page(), &c, &p2, notebook_page++);
|
|
1814 prefs_notebook_add_page(_("Tabs"), NULL, tab_page(), &c, &p2, notebook_page++);
|
|
1815 prefs_notebook_add_page(_("Proxy"), NULL, proxy_page(), &p, NULL, notebook_page++);
|
|
1816 #ifndef _WIN32
|
|
1817 /* We use the registered default browser in windows */
|
|
1818 prefs_notebook_add_page(_("Browser"), NULL, browser_page(), &p, NULL, notebook_page++);
|
|
1819 #endif
|
|
1820 prefs_notebook_add_page(_("Logging"), NULL, logging_page(), &p, NULL, notebook_page++);
|
|
1821 prefs_notebook_add_page(_("Sounds"), NULL, sound_page(), &p, NULL, notebook_page++);
|
|
1822 prefs_notebook_add_page(_("Sound Events"), NULL, sound_events_page(), &c, &p, notebook_page++);
|
|
1823 prefs_notebook_add_page(_("Away / Idle"), NULL, away_page(), &p, NULL, notebook_page++);
|
|
1824 prefs_notebook_add_page(_("Away Messages"), NULL, away_message_page(), &c, &p, notebook_page++);
|
|
1825
|
|
1826 if (gaim_plugins_enabled()) {
|
|
1827 prefs_notebook_add_page(_("Plugins"), NULL, plugin_page(), &plugin_iter, NULL, notebook_page++);
|
|
1828
|
|
1829 for (l = gaim_plugins_get_loaded(); l != NULL; l = l->next) {
|
|
1830 plug = l->data;
|
|
1831
|
|
1832 if (GAIM_IS_GTK_PLUGIN(plug)) {
|
|
1833 GtkWidget *config_frame;
|
|
1834 GaimGtkPluginUiInfo *ui_info;
|
|
1835
|
|
1836 ui_info = GAIM_GTK_PLUGIN_UI_INFO(plug);
|
|
1837 config_frame = gaim_gtk_plugin_get_config_frame(plug);
|
|
1838
|
|
1839 if (config_frame != NULL) {
|
|
1840 ui_info->iter = g_new0(GtkTreeIter, 1);
|
|
1841 prefs_notebook_add_page(_(plug->info->name), NULL,
|
|
1842 config_frame, ui_info->iter,
|
|
1843 &plugin_iter, notebook_page++);
|
|
1844 }
|
|
1845 }
|
|
1846 }
|
|
1847 }
|
|
1848 }
|
|
1849
|
|
1850 void show_prefs()
|
|
1851 {
|
|
1852 GtkWidget *vbox, *vbox2;
|
|
1853 GtkWidget *hbox;
|
|
1854 GtkWidget *frame;
|
|
1855 GtkTreeViewColumn *column;
|
|
1856 GtkCellRenderer *cell;
|
|
1857 GtkTreeSelection *sel;
|
|
1858 GtkWidget *notebook;
|
|
1859 GtkWidget *sep;
|
|
1860 GtkWidget *button;
|
|
1861 GtkSizeGroup *sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH);
|
|
1862
|
|
1863 if (prefs) {
|
|
1864 gtk_window_present(GTK_WINDOW(prefs));
|
|
1865 return;
|
|
1866 }
|
|
1867
|
|
1868 /* copy the preferences to tmp values...
|
|
1869 * I liked "take affect immediately" Oh well :-( */
|
|
1870
|
|
1871 /* Back to instant-apply! I win! BU-HAHAHA! */
|
|
1872
|
|
1873 /* Create the window */
|
|
1874 prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
1875 gtk_window_set_role(GTK_WINDOW(prefs), "preferences");
|
|
1876 gtk_widget_realize(prefs);
|
|
1877 gtk_window_set_title(GTK_WINDOW(prefs), _("Preferences"));
|
|
1878 gtk_window_set_resizable (GTK_WINDOW(prefs), FALSE);
|
|
1879 g_signal_connect(G_OBJECT(prefs), "destroy",
|
|
1880 G_CALLBACK(delete_prefs), NULL);
|
|
1881
|
|
1882 vbox = gtk_vbox_new(FALSE, 5);
|
|
1883 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);
|
|
1884 gtk_container_add(GTK_CONTAINER(prefs), vbox);
|
|
1885 gtk_widget_show(vbox);
|
|
1886
|
|
1887 hbox = gtk_hbox_new (FALSE, 6);
|
|
1888 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
|
1889 gtk_container_add (GTK_CONTAINER(vbox), hbox);
|
|
1890 gtk_widget_show (hbox);
|
|
1891
|
|
1892 frame = gtk_frame_new (NULL);
|
|
1893 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
1894 gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
|
1895 gtk_widget_show (frame);
|
|
1896
|
|
1897 /* The tree -- much inspired by the Gimp */
|
|
1898 prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT);
|
|
1899 tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree));
|
|
1900 gtk_container_add (GTK_CONTAINER (frame), tree_v);
|
|
1901
|
|
1902 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE);
|
|
1903 gtk_widget_show(tree_v);
|
|
1904 /* icons */
|
|
1905 /* XXX: to be used at a later date
|
|
1906 cell = gtk_cell_renderer_pixbuf_new ();
|
|
1907 column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL);
|
|
1908 */
|
|
1909
|
|
1910 /* text */
|
|
1911 cell = gtk_cell_renderer_text_new ();
|
|
1912 column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL);
|
|
1913
|
|
1914 gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column);
|
|
1915
|
|
1916 /* The right side */
|
|
1917 frame = gtk_frame_new (NULL);
|
|
1918 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
|
1919 gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
|
1920 gtk_widget_show (frame);
|
|
1921
|
|
1922 vbox2 = gtk_vbox_new (FALSE, 4);
|
|
1923 gtk_container_add (GTK_CONTAINER (frame), vbox2);
|
|
1924 gtk_widget_show (vbox2);
|
|
1925
|
|
1926 frame = gtk_frame_new (NULL);
|
|
1927 gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
|
|
1928 gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0);
|
|
1929 gtk_widget_show (frame);
|
|
1930
|
|
1931 hbox = gtk_hbox_new (FALSE, 4);
|
|
1932 gtk_container_set_border_width (GTK_CONTAINER (hbox), 4);
|
|
1933 gtk_container_add (GTK_CONTAINER (frame), hbox);
|
|
1934 gtk_widget_show (hbox);
|
|
1935
|
|
1936 preflabel = gtk_label_new(NULL);
|
|
1937 gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0);
|
|
1938 gtk_widget_show (preflabel);
|
|
1939
|
|
1940 /* The notebook */
|
|
1941 prefsnotebook = notebook = gtk_notebook_new ();
|
|
1942 gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
|
|
1943 gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
|
|
1944 gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0);
|
|
1945
|
|
1946 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v));
|
|
1947 g_signal_connect (G_OBJECT (sel), "changed",
|
|
1948 G_CALLBACK (pref_nb_select),
|
|
1949 notebook);
|
|
1950 gtk_widget_show(notebook);
|
|
1951 sep = gtk_hseparator_new();
|
|
1952 gtk_widget_show(sep);
|
|
1953 gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);
|
|
1954
|
|
1955 /* The buttons^H to press! */
|
|
1956 hbox = gtk_hbox_new (FALSE, 6);
|
|
1957 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
|
|
1958 gtk_container_add (GTK_CONTAINER(vbox), hbox);
|
|
1959 gtk_widget_show (hbox);
|
|
1960
|
|
1961 button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
|
|
1962 gtk_size_group_add_widget(sg, button);
|
|
1963 g_signal_connect_swapped(G_OBJECT(button), "clicked",
|
|
1964 G_CALLBACK(gtk_widget_destroy), prefs);
|
|
1965 gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0);
|
|
1966 gtk_widget_show(button);
|
|
1967
|
|
1968 prefs_notebook_init();
|
|
1969
|
|
1970 gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v));
|
|
1971 gtk_widget_show(prefs);
|
|
1972 }
|
|
1973
|
|
1974 void set_option(GtkWidget *w, int *option)
|
|
1975 {
|
|
1976 *option = !(*option);
|
|
1977 }
|
|
1978
|
|
1979 static void set_misc_option(GtkWidget *w, int option)
|
|
1980 {
|
|
1981 misc_options ^= option;
|
|
1982
|
|
1983 if (option == OPT_MISC_DEBUG) {
|
|
1984 if ((misc_options & OPT_MISC_DEBUG))
|
|
1985 gaim_gtk_debug_window_show();
|
|
1986 else
|
|
1987 gaim_gtk_debug_window_hide();
|
|
1988 }
|
|
1989 else if(option == OPT_MISC_USE_SERVER_ALIAS) {
|
|
1990 /* XXX blist reset the aliases here */
|
|
1991 gaim_conversation_foreach(gaim_conversation_autoset_title);
|
|
1992 }
|
|
1993 }
|
|
1994
|
|
1995 static void set_logging_option(GtkWidget *w, int option)
|
|
1996 {
|
|
1997 logging_options ^= option;
|
|
1998
|
|
1999 if (option == OPT_LOG_CONVOS || option == OPT_LOG_CHATS)
|
|
2000 update_log_convs();
|
|
2001 }
|
|
2002
|
|
2003 static void set_blist_option(GtkWidget *w, int option)
|
|
2004 {
|
|
2005 struct gaim_gtk_buddy_list *gtkblist;
|
|
2006
|
|
2007 gtkblist = GAIM_GTK_BLIST(gaim_get_blist());
|
|
2008
|
|
2009 blist_options ^= option;
|
|
2010
|
|
2011 if (!gtkblist)
|
|
2012 return;
|
|
2013
|
|
2014 if (option == OPT_BLIST_SHOW_WARN)
|
|
2015 gaim_gtk_blist_update_columns();
|
|
2016 else if (option == OPT_BLIST_SHOW_IDLETIME) {
|
|
2017 gaim_gtk_blist_update_refresh_timeout();
|
|
2018 gaim_gtk_blist_update_columns();
|
|
2019 }
|
|
2020 else if (option == OPT_BLIST_SHOW_ICONS) {
|
|
2021 gaim_gtk_blist_update_refresh_timeout();
|
|
2022 gaim_gtk_blist_refresh(gaim_get_blist());
|
|
2023 gaim_gtk_blist_update_columns();
|
|
2024 } else
|
|
2025 gaim_gtk_blist_refresh(gaim_get_blist());
|
|
2026
|
|
2027 }
|
|
2028
|
|
2029 static void set_convo_option(GtkWidget *w, int option)
|
|
2030 {
|
|
2031 convo_options ^= option;
|
|
2032
|
|
2033 if (option == OPT_CONVO_SHOW_SMILEY)
|
|
2034 gaim_gtkconv_toggle_smileys();
|
|
2035
|
|
2036 if (option == OPT_CONVO_SHOW_TIME)
|
|
2037 gaim_gtkconv_toggle_timestamps();
|
|
2038
|
|
2039 if (option == OPT_CONVO_CHECK_SPELLING)
|
|
2040 gaim_gtkconv_toggle_spellchk();
|
|
2041
|
|
2042 if (option == OPT_CONVO_NO_X_ON_TAB)
|
|
2043 gaim_gtkconv_toggle_close_buttons();
|
|
2044 }
|
|
2045
|
|
2046 static void set_im_option(GtkWidget *w, int option)
|
|
2047 {
|
|
2048 im_options ^= option;
|
|
2049
|
|
2050 #if 0
|
|
2051 if (option == OPT_IM_ONE_WINDOW)
|
|
2052 im_tabize();
|
|
2053 #endif
|
|
2054
|
|
2055 if (option == OPT_IM_HIDE_ICONS)
|
|
2056 gaim_gtkconv_hide_buddy_icons();
|
|
2057
|
|
2058 if (option == OPT_IM_ALIAS_TAB)
|
|
2059 gaim_conversation_foreach(gaim_conversation_autoset_title);
|
|
2060
|
|
2061 if (option == OPT_IM_NO_ANIMATION)
|
|
2062 gaim_gtkconv_set_anim();
|
|
2063 }
|
|
2064
|
|
2065 static void set_chat_option(GtkWidget *w, int option)
|
|
2066 {
|
|
2067 chat_options ^= option;
|
|
2068
|
|
2069 #if 0
|
|
2070 if (option == OPT_CHAT_ONE_WINDOW)
|
|
2071 chat_tabize();
|
|
2072 #endif
|
|
2073 }
|
|
2074
|
|
2075 void set_sound_option(GtkWidget *w, int option)
|
|
2076 {
|
|
2077 sound_options ^= option;
|
|
2078 }
|
|
2079
|
|
2080 static void set_font_option(GtkWidget *w, int option)
|
|
2081 {
|
|
2082 font_options ^= option;
|
|
2083
|
|
2084 gaim_gtkconv_update_font_buttons();
|
|
2085 }
|
|
2086
|
|
2087 static void set_away_option(GtkWidget *w, int option)
|
|
2088 {
|
|
2089 away_options ^= option;
|
|
2090
|
|
2091 if (option == OPT_AWAY_QUEUE)
|
|
2092 toggle_away_queue();
|
|
2093 }
|
|
2094
|
|
2095 GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page)
|
|
2096 {
|
|
2097 GtkWidget *button;
|
|
2098 button = gtk_check_button_new_with_mnemonic(text);
|
|
2099 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (*options & option));
|
|
2100 gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0);
|
|
2101 g_object_set_data(G_OBJECT(button), "options", options);
|
|
2102
|
|
2103 if (options == &misc_options) {
|
|
2104 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2105 G_CALLBACK(set_misc_option), (int *)option);
|
|
2106 } else if (options == &logging_options) {
|
|
2107 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2108 G_CALLBACK(set_logging_option), (int *)option);
|
|
2109 } else if (options == &blist_options) {
|
|
2110 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2111 G_CALLBACK(set_blist_option), (int *)option);
|
|
2112 } else if (options == &convo_options) {
|
|
2113 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2114 G_CALLBACK(set_convo_option), (int *)option);
|
|
2115 } else if (options == &im_options) {
|
|
2116 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2117 G_CALLBACK(set_im_option), (int *)option);
|
|
2118 } else if (options == &chat_options) {
|
|
2119 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2120 G_CALLBACK(set_chat_option), (int *)option);
|
|
2121 } else if (options == &font_options) {
|
|
2122 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2123 G_CALLBACK(set_font_option), (int *)option);
|
|
2124 } else if (options == &sound_options) {
|
|
2125 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2126 G_CALLBACK(set_sound_option), (int *)option);
|
|
2127 } else if (options == &away_options) {
|
|
2128 g_signal_connect(G_OBJECT(button), "clicked",
|
|
2129 G_CALLBACK(set_away_option), (int *)option);
|
|
2130 } else {
|
|
2131 gaim_debug(GAIM_DEBUG_WARNING, "gaim_button",
|
|
2132 "\"%s\" has no signal handler attached to it!\n", text);
|
|
2133 }
|
|
2134 gtk_widget_show(button);
|
|
2135
|
|
2136 return button;
|
|
2137 }
|
|
2138
|
|
2139 void default_away_menu_init(GtkWidget *omenu)
|
|
2140 {
|
|
2141 GtkWidget *menu, *opt;
|
|
2142 int index = 0;
|
|
2143 GSList *awy = away_messages;
|
|
2144 struct away_message *a;
|
|
2145
|
|
2146 menu = gtk_menu_new();
|
|
2147
|
|
2148 while (awy) {
|
|
2149 a = (struct away_message *)awy->data;
|
|
2150 opt = gtk_menu_item_new_with_label(a->name);
|
|
2151 g_signal_connect(G_OBJECT(opt), "activate",
|
|
2152 G_CALLBACK(set_default_away), (gpointer)index);
|
|
2153 gtk_widget_show(opt);
|
|
2154 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
|
|
2155
|
|
2156 awy = awy->next;
|
|
2157 index++;
|
|
2158 }
|
|
2159
|
|
2160 gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu));
|
|
2161 gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu);
|
|
2162 gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), g_slist_index(away_messages, default_away));
|
|
2163 }
|
|
2164
|
|
2165 GtkWidget *pref_fg_picture = NULL;
|
|
2166 GtkWidget *pref_bg_picture = NULL;
|
|
2167
|
|
2168 void destroy_colorsel(GtkWidget *w, gpointer d)
|
|
2169 {
|
|
2170 if (d) {
|
|
2171 gtk_widget_destroy(fgcseld);
|
|
2172 fgcseld = NULL;
|
|
2173 } else {
|
|
2174 gtk_widget_destroy(bgcseld);
|
|
2175 bgcseld = NULL;
|
|
2176 }
|
|
2177 }
|
|
2178
|
|
2179 void apply_color_dlg(GtkWidget *w, gpointer d)
|
|
2180 {
|
|
2181 if ((int)d == 1) {
|
|
2182 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
|
|
2183 (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel),
|
|
2184 &fgcolor);
|
|
2185 destroy_colorsel(NULL, (void *)1);
|
|
2186 update_color(NULL, pref_fg_picture);
|
|
2187 } else {
|
|
2188 gtk_color_selection_get_current_color(GTK_COLOR_SELECTION
|
|
2189 (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel),
|
|
2190 &bgcolor);
|
|
2191 destroy_colorsel(NULL, (void *)0);
|
|
2192 update_color(NULL, pref_bg_picture);
|
|
2193 }
|
|
2194 gaim_conversation_foreach(gaim_gtkconv_update_font_colors);
|
|
2195 }
|
|
2196
|
|
2197 void update_color(GtkWidget *w, GtkWidget *pic)
|
|
2198 {
|
|
2199 GdkColor c;
|
|
2200 GtkStyle *style;
|
|
2201 c.pixel = 0;
|
|
2202
|
|
2203 if (pic == pref_fg_picture) {
|
|
2204 if (font_options & OPT_FONT_FGCOL) {
|
|
2205 c.red = fgcolor.red;
|
|
2206 c.blue = fgcolor.blue;
|
|
2207 c.green = fgcolor.green;
|
|
2208 } else {
|
|
2209 c.red = 0;
|
|
2210 c.blue = 0;
|
|
2211 c.green = 0;
|
|
2212 }
|
|
2213 } else {
|
|
2214 if (font_options & OPT_FONT_BGCOL) {
|
|
2215 c.red = bgcolor.red;
|
|
2216 c.blue = bgcolor.blue;
|
|
2217 c.green = bgcolor.green;
|
|
2218 } else {
|
|
2219 c.red = 0xffff;
|
|
2220 c.blue = 0xffff;
|
|
2221 c.green = 0xffff;
|
|
2222 }
|
|
2223 }
|
|
2224
|
|
2225 style = gtk_style_new();
|
|
2226 style->bg[0] = c;
|
|
2227 gtk_widget_set_style(pic, style);
|
|
2228 g_object_unref(style);
|
|
2229 }
|
|
2230
|
|
2231 void set_default_away(GtkWidget *w, gpointer i)
|
|
2232 {
|
|
2233
|
|
2234 int length = g_slist_length(away_messages);
|
|
2235
|
|
2236 if (away_messages == NULL)
|
|
2237 default_away = NULL;
|
|
2238 else if ((int)i >= length)
|
|
2239 default_away = g_slist_nth_data(away_messages, length - 1);
|
|
2240 else
|
|
2241 default_away = g_slist_nth_data(away_messages, (int)i);
|
|
2242 }
|
|
2243
|
|
2244 #ifndef _WIN32
|
|
2245 static gboolean program_is_valid(const char *program)
|
|
2246 {
|
|
2247 GError *error = NULL;
|
|
2248 char **argv;
|
|
2249 gchar *progname;
|
|
2250 gboolean is_valid = FALSE;
|
|
2251
|
|
2252 if (program == NULL || *program == '\0') {
|
|
2253 return FALSE;
|
|
2254 }
|
|
2255
|
|
2256 if (!g_shell_parse_argv(program, NULL, &argv, &error)) {
|
|
2257 gaim_debug(GAIM_DEBUG_ERROR, "program_is_valid",
|
|
2258 "Could not parse program '%s': %s\n",
|
|
2259 program, error->message);
|
|
2260 g_error_free(error);
|
|
2261 return FALSE;
|
|
2262 }
|
|
2263
|
|
2264 if (argv == NULL) {
|
|
2265 return FALSE;
|
|
2266 }
|
|
2267
|
|
2268 progname = g_find_program_in_path(argv[0]);
|
|
2269 is_valid = (progname != NULL);
|
|
2270
|
|
2271 g_strfreev(argv);
|
|
2272 g_free(progname);
|
|
2273
|
|
2274 return is_valid;
|
|
2275 }
|
|
2276 #endif
|
|
2277
|
|
2278 static void update_spin_value(GtkWidget *w, GtkWidget *spin)
|
|
2279 {
|
|
2280 int *value = g_object_get_data(G_OBJECT(spin), "val");
|
|
2281 *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin));
|
|
2282 }
|
|
2283
|
|
2284 GtkWidget *gaim_labeled_spin_button(GtkWidget *box, const gchar *title, int *val, int min, int max, GtkSizeGroup *sg)
|
|
2285 {
|
|
2286 GtkWidget *hbox;
|
|
2287 GtkWidget *label;
|
|
2288 GtkWidget *spin;
|
|
2289 GtkObject *adjust;
|
|
2290
|
|
2291 hbox = gtk_hbox_new(FALSE, 5);
|
|
2292 gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5);
|
|
2293 gtk_widget_show(hbox);
|
|
2294
|
|
2295 label = gtk_label_new_with_mnemonic(title);
|
|
2296 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
|
2297 gtk_widget_show(label);
|
|
2298
|
|
2299 adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1);
|
|
2300 spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0);
|
|
2301 g_object_set_data(G_OBJECT(spin), "val", val);
|
|
2302 gtk_widget_set_size_request(spin, 50, -1);
|
|
2303 gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0);
|
|
2304 g_signal_connect(G_OBJECT(adjust), "value-changed",
|
|
2305 G_CALLBACK(update_spin_value), GTK_WIDGET(spin));
|
|
2306 gtk_widget_show(spin);
|
|
2307
|
|
2308 gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin);
|
|
2309
|
|
2310 if (sg) {
|
|
2311 gtk_size_group_add_widget(sg, label);
|
|
2312 gtk_misc_set_alignment(GTK_MISC(label), 0, 0);
|
|
2313
|
|
2314 }
|
|
2315 return label;
|
|
2316 }
|
|
2317
|
|
2318 void dropdown_set(GObject *w, int *option)
|
|
2319 {
|
|
2320 int opt = GPOINTER_TO_INT(g_object_get_data(w, "value"));
|
|
2321 int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear"));
|
|
2322
|
|
2323 if (option == (int*)&sort_method) {
|
|
2324 /* Hack city -- Population: Sean Egan */
|
|
2325 char *name = (char*)opt;
|
|
2326 gaim_gtk_blist_sort_method_set(name);
|
|
2327 return;
|
|
2328 }
|
|
2329 if (clear != -1) {
|
|
2330 *option = *option & ~clear;
|
|
2331 *option = *option | opt;
|
|
2332 } else {
|
|
2333 gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt);
|
|
2334 *option = opt;
|
|
2335 }
|
|
2336
|
|
2337 if (option == (int*)&global_proxy_info.proxytype) {
|
|
2338 if (opt == PROXY_NONE)
|
|
2339 gtk_widget_set_sensitive(prefs_proxy_frame, FALSE);
|
|
2340 else
|
|
2341 gtk_widget_set_sensitive(prefs_proxy_frame, TRUE);
|
|
2342 } else if (option == &web_browser) {
|
|
2343 if (opt == BROWSER_MANUAL)
|
|
2344 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), TRUE);
|
|
2345 else
|
|
2346 gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), FALSE);
|
|
2347 } else if (option == (int*)&sound_options) {
|
|
2348 if (opt == OPT_SOUND_CMD)
|
|
2349 gtk_widget_set_sensitive(sndcmd, TRUE);
|
|
2350 else
|
|
2351 gtk_widget_set_sensitive(sndcmd, FALSE);
|
|
2352 gaim_sound_change_output_method();
|
|
2353 } else if (option == (int*)&blist_options) {
|
|
2354 gaim_gtk_blist_update_toolbar();
|
|
2355 } else if (option == (int*)&im_options) {
|
|
2356 if (clear == (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB))
|
|
2357 gaim_gtkconv_update_tabs();
|
|
2358 else if (clear == (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM))
|
|
2359 gaim_gtkconv_update_im_button_style();
|
|
2360 } else if (option == (int*)&chat_options) {
|
|
2361 if (clear == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB))
|
|
2362 gaim_gtkconv_update_tabs();
|
|
2363 else if (clear == (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM))
|
|
2364 gaim_gtkconv_update_chat_button_style();
|
|
2365 // } else if (option == (int*)&blist_options) {
|
|
2366 // set_blist_tab();
|
|
2367 } else if (option == (int *)&conv_placement_option) {
|
|
2368 gaim_conv_placement_set_active(conv_placement_option);
|
|
2369 }
|
|
2370 }
|
|
2371
|
|
2372 static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...)
|
|
2373 {
|
|
2374 va_list ap;
|
|
2375 GList *menuitems = NULL;
|
|
2376 GtkWidget *dropdown = NULL;
|
|
2377 char *name;
|
|
2378 int id;
|
|
2379
|
|
2380 va_start(ap, clear);
|
|
2381 while ((name = va_arg(ap, char *)) != NULL) {
|
|
2382 id = va_arg(ap, int);
|
|
2383
|
|
2384 menuitems = g_list_prepend(menuitems, name);
|
|
2385 menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(id));
|
|
2386 }
|
|
2387 va_end(ap);
|
|
2388
|
|
2389 g_return_val_if_fail(menuitems != NULL, NULL);
|
|
2390
|
|
2391 menuitems = g_list_reverse(menuitems);
|
|
2392
|
|
2393 dropdown = gaim_dropdown_from_list(box, title, option, clear, menuitems);
|
|
2394
|
|
2395 g_list_free(menuitems);
|
|
2396
|
|
2397 return dropdown;
|
|
2398 }
|
|
2399
|
|
2400 static GtkWidget *gaim_dropdown_from_list(GtkWidget *box, const gchar *title, int *option, int clear, GList *menuitems)
|
|
2401 {
|
|
2402 GtkWidget *dropdown, *opt, *menu;
|
|
2403 GtkWidget *label;
|
|
2404 gchar *text;
|
|
2405 int value;
|
|
2406 int o = 0;
|
|
2407 GtkWidget *hbox;
|
|
2408
|
|
2409 g_return_val_if_fail(menuitems != NULL, NULL);
|
|
2410
|
|
2411 hbox = gtk_hbox_new(FALSE, 5);
|
|
2412 gtk_container_add (GTK_CONTAINER (box), hbox);
|
|
2413 gtk_widget_show(hbox);
|
|
2414
|
|
2415 label = gtk_label_new_with_mnemonic(title);
|
|
2416 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
|
|
2417 gtk_widget_show(label);
|
|
2418
|
|
2419 dropdown = gtk_option_menu_new();
|
|
2420 menu = gtk_menu_new();
|
|
2421
|
|
2422 gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown);
|
|
2423
|
|
2424 while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) {
|
|
2425 menuitems = g_list_next(menuitems);
|
|
2426 g_return_val_if_fail(menuitems != NULL, NULL);
|
|
2427 value = GPOINTER_TO_INT(menuitems->data);
|
|
2428 menuitems = g_list_next(menuitems);
|
|
2429
|
|
2430 opt = gtk_menu_item_new_with_label(text);
|
|
2431 g_object_set_data(G_OBJECT(opt), "value", GINT_TO_POINTER(value));
|
|
2432 g_object_set_data(G_OBJECT(opt), "clear", GINT_TO_POINTER(clear));
|
|
2433 g_signal_connect(G_OBJECT(opt), "activate",
|
|
2434 G_CALLBACK(dropdown_set), (void *)option);
|
|
2435 gtk_widget_show(opt);
|
|
2436 gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt);
|
|
2437
|
|
2438 if (option == (int*)sort_method) {
|
|
2439 /* Now Entering Hacksville, Estd. May 17, 2003 */
|
|
2440 gtk_menu_set_active(GTK_MENU(menu), clear);
|
|
2441 } else if (((clear > -1) && ((*option & clear) == value)) || *option == value) {
|
|
2442 gtk_menu_set_active(GTK_MENU(menu), o);
|
|
2443 }
|
|
2444 o++;
|
|
2445
|
|
2446 }
|
|
2447
|
|
2448 gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu);
|
|
2449 gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0);
|
|
2450 gtk_widget_show(dropdown);
|
|
2451 return label;
|
|
2452 }
|
|
2453
|
|
2454 static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc)
|
|
2455 {
|
|
2456 /* more stuff stolen from X-Chat */
|
|
2457 GtkWidget *swid;
|
|
2458 GdkColor c;
|
|
2459 GtkStyle *style;
|
|
2460 c.pixel = 0;
|
|
2461 if (fgc) {
|
|
2462 if (font_options & OPT_FONT_FGCOL) {
|
|
2463 c.red = fgcolor.red;
|
|
2464 c.blue = fgcolor.blue;
|
|
2465 c.green = fgcolor.green;
|
|
2466 } else {
|
|
2467 c.red = 0;
|
|
2468 c.blue = 0;
|
|
2469 c.green = 0;
|
|
2470 }
|
|
2471 } else {
|
|
2472 if (font_options & OPT_FONT_BGCOL) {
|
|
2473 c.red = bgcolor.red;
|
|
2474 c.blue = bgcolor.blue;
|
|
2475 c.green = bgcolor.green;
|
|
2476 } else {
|
|
2477 c.red = 0xffff;
|
|
2478 c.blue = 0xffff;
|
|
2479 c.green = 0xffff;
|
|
2480 }
|
|
2481 }
|
|
2482
|
|
2483 style = gtk_style_new();
|
|
2484 style->bg[0] = c;
|
|
2485
|
|
2486 swid = gtk_event_box_new();
|
|
2487 gtk_widget_set_style(GTK_WIDGET(swid), style);
|
|
2488 g_object_unref(style);
|
|
2489 gtk_widget_set_size_request(GTK_WIDGET(swid), 40, -1);
|
|
2490 gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5);
|
|
2491 gtk_widget_show(swid);
|
|
2492 return swid;
|
|
2493 }
|
|
2494
|
|
2495 void apply_font_dlg(GtkWidget *w, GtkWidget *f)
|
|
2496 {
|
|
2497 int i = 0;
|
|
2498 char *fontname;
|
|
2499
|
|
2500 fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(f)));
|
|
2501 destroy_fontsel(0, 0);
|
|
2502
|
|
2503 while(fontname[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) {
|
|
2504 fontface[i] = fontname[i];
|
|
2505 i++;
|
|
2506 }
|
|
2507
|
|
2508 fontface[i] = 0;
|
|
2509 g_free(fontname);
|
|
2510
|
|
2511 gaim_conversation_foreach(gaim_gtkconv_update_font_face);
|
|
2512 }
|
|
2513
|