Mercurial > pidgin.yaz
changeset 3366:120e08ea5aee
[gaim-migrate @ 3385]
this actually isn't finished yet--don't complain about it. Reccomended for
use with gtk2.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 02 Aug 2002 04:49:23 +0000 |
parents | de3118740c87 |
children | 3b00d97d59aa |
files | src/prefs.c |
diffstat | 1 files changed, 1777 insertions(+), 2355 deletions(-) [+] |
line wrap: on
line diff
--- a/src/prefs.c Fri Aug 02 04:48:04 2002 +0000 +++ b/src/prefs.c Fri Aug 02 04:49:23 2002 +0000 @@ -1,7 +1,7 @@ /* * gaim * - * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> + * Copyright (C) 1998-2002, Mark Spencer <markster@marko.net> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,10 @@ #include "gtkimhtml.h" #include "gaim.h" #include "prpl.h" +#include "proxy.h" + +/* xpms for gtk1.2 */ +#if !GTK_CHECK_VERSION (1,3,0) #include "pixmaps/cancel.xpm" #include "pixmaps/fontface2.xpm" #include "pixmaps/gnome_add.xpm" @@ -44,297 +48,115 @@ #include "pixmaps/bgcolor.xpm" #include "pixmaps/fgcolor.xpm" #include "pixmaps/save.xpm" -#include "proxy.h" +#include "pixmaps/ok.xpm" +#include "pixmaps/join.xpm" +#endif -struct debug_window *dw = NULL; -static GtkWidget *prefs = NULL; -static GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); -static GtkWidget *blist_tab_radio(const char *, int, GtkWidget *, GtkWidget *); -static void prefs_build_general(); -static void prefs_build_buddy(); -static void prefs_build_convo(); -static void prefs_build_sound(); -static void prefs_build_away(); -static void prefs_build_deny(); -static gint handle_delete(GtkWidget *, GdkEvent *, void *); -static void delete_prefs(GtkWidget *, void *); -void set_default_away(GtkWidget *, gpointer); -static void set_font_option(GtkWidget *w, int option); +/* temporary preferences */ +static guint misc_options_new; +static guint logging_options_new; +static guint blist_options_new; +static guint convo_options_new; +static guint im_options_new; +static guint chat_options_new; +static guint font_options_new; +static guint sound_options_new; +static char *sound_file_new[NUM_SOUNDS]; +static guint away_options_new; +static guint away_resend_new; +static int auto_away_new; +static int report_idle_new; +static int proxytype_new; +static struct away_message* default_away_new; +static int web_browser_new; +static char sound_cmd_new[2048]; +static char web_command_new[2048]; +static int fontsize_new; +GdkColor fgcolor_new, bgcolor_new; +static struct window_size conv_size_new, buddy_chat_size_new; +char fontface_new[128]; +#if !GTK_CHECK_VERSION(1,3,0) +char fontxfld_new[256]; +char fontfacexfld[256]; +#endif +char fontface[128]; -static GtkWidget *sounddialog = NULL; -static GtkWidget *prefdialog = NULL; -static GtkWidget *tickerbutton = NULL; -GtkWidget *debugbutton = NULL; - -extern GtkWidget *tickerwindow; -extern void BuddyTickerShow(); GtkWidget *prefs_away_list = NULL; GtkWidget *prefs_away_menu = NULL; GtkWidget *preftree = NULL; +GtkWidget *fontseld = NULL; + +#if GTK_CHECK_VERSION(1,3,0) +GtkTreeStore *prefs_away_store = NULL; +#endif + +static int sound_row_sel = 0; +static char *last_sound_dir = NULL; + +static GtkWidget *sounddialog = NULL; +static GtkWidget *browser_entry = NULL; +static GtkWidget *sound_entry = NULL; +static GtkWidget *away_text = NULL; GtkCTreeNode *general_node = NULL; GtkCTreeNode *deny_node = NULL; GtkWidget *prefs_proxy_frame = NULL; - -static void destdeb(GtkWidget *m, gpointer n) -{ - gtk_widget_destroy(debugbutton); - debugbutton = NULL; -} - -static void desttkr(GtkWidget *m, gpointer n) -{ - gtk_widget_destroy(tickerbutton); - tickerbutton = NULL; -} - -static void set_idle(GtkWidget *w, int *data) -{ - report_idle = (int)data; - save_prefs(); -} +static GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); +GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int); +static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...); +static GtkWidget *show_color_pref(GtkWidget *, gboolean); +static void delete_prefs(GtkWidget *, void *); +void set_default_away(GtkWidget *, gpointer); +static void set_font_option(GtkWidget *w, int option); -static GtkWidget *idle_radio(char *label, int which, GtkWidget *box, GtkWidget *set) -{ - GtkWidget *opt; - - if (!set) - opt = gtk_radio_button_new_with_label(NULL, label); - else - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), - label); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(set_idle), (void *)which); - gtk_widget_show(opt); - if (report_idle == which) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - return opt; -} - -static GtkWidget *browser_entry = NULL; -static GtkWidget *new_window = NULL; +struct debug_window *dw = NULL; +static GtkWidget *prefs = NULL; +GtkWidget *debugbutton = NULL; -static void set_browser(GtkWidget *w, int *data) -{ - web_browser = (int)data; - if (web_browser != BROWSER_MANUAL) { - if (browser_entry) - gtk_widget_set_sensitive(browser_entry, FALSE); - } else { - if (browser_entry) - gtk_widget_set_sensitive(browser_entry, TRUE); - } - - if (web_browser != BROWSER_NETSCAPE) { - if (new_window) - gtk_widget_set_sensitive(new_window, FALSE); - } else { - if (new_window) - gtk_widget_set_sensitive(new_window, TRUE); - } - - - save_prefs(); -} - -static int manualentry_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy) -{ - g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(browser_entry))); - save_prefs(); - return TRUE; -} - -static GtkWidget *browser_radio(char *label, int which, GtkWidget *box, GtkWidget *set) -{ - GtkWidget *opt; - - if (!set) - opt = gtk_radio_button_new_with_label(NULL, label); - else - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), - label); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(set_browser), (void *)which); - gtk_widget_show(opt); - if (web_browser == which) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - return opt; -} - -static void brentdes(GtkWidget *m, gpointer n) -{ - browser_entry = NULL; - new_window = NULL; +void delete_prefs(GtkWidget *asdf, void *gdsa) { + int v; + + prefs = NULL; + for (v = 0; v < NUM_SOUNDS; v++) { + if (sound_file_new[v]) + g_free(sound_file_new[v]); + sound_file_new[v] = NULL; + } + sound_entry = NULL; + browser_entry = NULL; + debugbutton=NULL; + gtk_widget_destroy(sounddialog); +#if GTK_CHECK_VERSION(1,3,0) + g_object_unref(G_OBJECT(prefs_away_store)); +#endif } -static void general_page() -{ - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *frame; - GtkWidget *mbox; - GtkWidget *sep; - GtkWidget *idle; - GtkWidget *opt; - GtkWidget *typingbutton; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("General Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - frame = gtk_frame_new(_("Miscellaneous")); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); - gtk_widget_show(frame); - - mbox = gtk_vbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), mbox); - gtk_widget_show(mbox); - - gaim_button(_("Use borderless buttons"), &misc_options, OPT_MISC_COOL_LOOK, mbox); - - if (!tickerwindow && (misc_options & OPT_MISC_BUDDY_TICKER)) - misc_options ^= OPT_MISC_BUDDY_TICKER; - tickerbutton = gaim_button(_("Show Buddy Ticker"), &misc_options, OPT_MISC_BUDDY_TICKER, mbox); - gtk_signal_connect(GTK_OBJECT(tickerbutton), "destroy", GTK_SIGNAL_FUNC(desttkr), 0); - - if (!dw && (misc_options & OPT_MISC_DEBUG)) - misc_options ^= OPT_MISC_DEBUG; - debugbutton = gaim_button(_("Show Debug Window"), &misc_options, OPT_MISC_DEBUG, mbox); - gtk_signal_connect(GTK_OBJECT(debugbutton), "destroy", GTK_SIGNAL_FUNC(destdeb), 0); - - /* Preferences should be positive */ - typingbutton = gaim_button(_("Notify buddies that you are typing to them"), &misc_options, - OPT_MISC_STEALTH_TYPING, mbox); - - /* So we have to toggle it */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton))); - misc_options ^= OPT_MISC_STEALTH_TYPING; - - frame = gtk_frame_new(_("Report Idle Times")); - gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 5); - gtk_widget_show(frame); - - mbox = gtk_vbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), mbox); - gtk_widget_show(mbox); - - idle = idle_radio(_("None"), IDLE_NONE, mbox, NULL); - idle = idle_radio(_("Gaim Use"), IDLE_GAIM, mbox, idle); -#ifdef USE_SCREENSAVER - idle = idle_radio(_("X Use"), IDLE_SCREENSAVER, mbox, idle); +GtkWidget *preflabel; +GtkWidget *prefsnotebook; +#if GTK_CHECK_VERSION(1,3,0) +GtkTreeStore *prefstree; +#else +GtkWidget *prefstree; #endif - frame = gtk_frame_new(_("Logging")); - gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 5); - gtk_widget_show(frame); - - mbox = gtk_vbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), mbox); - gtk_widget_show(mbox); - - gaim_button(_("Log all conversations"), &logging_options, OPT_LOG_ALL, mbox); - gaim_button(_("Strip HTML from logs"), &logging_options, OPT_LOG_STRIP_HTML, mbox); - - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(mbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - - gaim_button(_("Log when buddies sign on/sign off"), &logging_options, OPT_LOG_BUDDY_SIGNON, - mbox); - gaim_button(_("Log when buddies become idle/un-idle"), &logging_options, OPT_LOG_BUDDY_IDLE, - mbox); - gaim_button(_("Log when buddies go away/come back"), &logging_options, OPT_LOG_BUDDY_AWAY, mbox); - gaim_button(_("Log your own signons/idleness/awayness"), &logging_options, OPT_LOG_MY_SIGNON, - mbox); - gaim_button(_("Individual log file for each buddy's signons"), &logging_options, - OPT_LOG_INDIVIDUAL, mbox); - - frame = gtk_frame_new(_("Browser")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); +static void set_misc_options(); +static void set_logging_options(); +static void set_blist_options(); +static void set_convo_options(); +static void set_im_options(); +static void set_chat_options(); +static void set_font_options(); +static void set_sound_options(); +static void set_away_options(); - opt = browser_radio(_("Konqueror"), BROWSER_KONQ, vbox, NULL); - opt = browser_radio(_("Opera"), BROWSER_OPERA, vbox, opt); - opt = browser_radio(_("Netscape"), BROWSER_NETSCAPE, vbox, opt); - opt = browser_radio(_("Mozilla"), BROWSER_MOZILLA, vbox, opt); - - new_window = - gaim_button(_("Pop up new window by default"), &misc_options, OPT_MISC_BROWSER_POPUP, vbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - -#ifdef USE_GNOME - opt = browser_radio(_("GNOME URL Handler"), BROWSER_GNOME, vbox, opt); -#endif /* USE_GNOME */ - opt = browser_radio(_("Galeon"), BROWSER_GALEON, vbox, opt); - opt = browser_radio(_("Manual (%s for URL)"), BROWSER_MANUAL, vbox, opt); - - browser_entry = gtk_entry_new(); - gtk_box_pack_start(GTK_BOX(vbox), browser_entry, FALSE, FALSE, 0); - gtk_entry_set_text(GTK_ENTRY(browser_entry), web_command); - gtk_signal_connect(GTK_OBJECT(browser_entry), "focus_out_event", - GTK_SIGNAL_FUNC(manualentry_key_pressed), NULL); - gtk_signal_connect(GTK_OBJECT(browser_entry), "destroy", GTK_SIGNAL_FUNC(brentdes), NULL); - gtk_widget_show(browser_entry); - - if (web_browser != BROWSER_MANUAL) { - gtk_widget_set_sensitive(browser_entry, FALSE); - } else { - gtk_widget_set_sensitive(browser_entry, TRUE); - } - - if (web_browser != BROWSER_NETSCAPE) { - gtk_widget_set_sensitive(new_window, FALSE); - } else { - gtk_widget_set_sensitive(new_window, TRUE); - } - - gtk_widget_show(prefdialog); -} +extern void BuddyTickerShow(); #define PROXYHOST 0 #define PROXYPORT 1 #define PROXYTYPE 2 #define PROXYUSER 3 #define PROXYPASS 4 - static void proxy_print_option(GtkEntry *entry, int entrynum) { if (entrynum == PROXYHOST) @@ -348,106 +170,588 @@ save_prefs(); } -static void proxy_print_optionrad(GtkRadioButton * entry, int entrynum) + +/* OK, Apply and Cancel */ + +static void apply_cb(GtkWidget *button, void *data) { - if (entrynum == PROXY_NONE) - gtk_widget_set_sensitive(prefs_proxy_frame, FALSE); - else - gtk_widget_set_sensitive(prefs_proxy_frame, TRUE); + int r; + if (misc_options != misc_options_new) + set_misc_options(); + if (logging_options != logging_options_new) + set_logging_options(); + if (blist_options != blist_options_new) + set_blist_options(); + if (convo_options != convo_options_new) + set_convo_options(); + if (im_options != im_options_new) + set_im_options(); + if (chat_options != chat_options_new) + set_chat_options(); + chat_options = chat_options_new; + if (font_options != font_options_new) + set_font_options(); + if (sound_options != sound_options_new) + set_sound_options(); + for (r = 0; r < NUM_SOUNDS; r++) { + if (sound_file[r]) + g_free(sound_file[r]); + sound_file[r] = sound_file_new[r]; + sound_file_new[r] = NULL; + } + if (away_options != away_options_new) + set_away_options(); + away_resend = away_resend_new; + auto_away = auto_away_new; + report_idle = report_idle_new; + web_browser = web_browser_new; + proxytype = proxytype_new; + default_away = default_away_new; + fontsize = fontsize_new; + g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", sound_cmd_new); + g_snprintf(web_command, sizeof(web_command), "%s", web_command_new); + memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); + memcpy(&conv_size, &conv_size_new, sizeof(struct window_size)); + memcpy(&fgcolor, &fgcolor_new, sizeof(GdkColor)); + memcpy(&bgcolor, &bgcolor_new, sizeof(GdkColor)); - proxytype = entrynum; + + g_snprintf(fontface, sizeof(fontface), fontface_new); +#if !GTK_CHECK_VERSION(1,3,0) + g_snprintf(fontxfld, sizeof(fontxfld), fontxfld_new); +#endif + update_convo_font(); + update_convo_color(); save_prefs(); } -static void proxy_page() + +static void ok_cb(GtkWidget *button, void *data) { - GtkWidget *parent; + apply_cb(button, data); + gtk_widget_destroy(prefs); +} +#if GTK_CHECK_VERSION(1,3,0) +static void pref_nb_select(GtkTreeSelection *sel, GtkNotebook *nb) { + GtkTreeIter iter; + GValue val = { 0, }; + GtkTreeModel *model = GTK_TREE_MODEL(prefstree); + + if (! gtk_tree_selection_get_selected (sel, &model, &iter)) + return; + gtk_tree_model_get_value (model, &iter, 1, &val); + gtk_label_set_text (GTK_LABEL(preflabel), g_value_get_string (&val)); + g_value_unset (&val); + gtk_tree_model_get_value (model, &iter, 2, &val); + gtk_notebook_set_current_page (GTK_NOTEBOOK (prefsnotebook), g_value_get_int (&val)); + +} +#else +static void pref_nb_select(GtkCTree *ctree, GtkCTreeNode *node, gint column, GtkNotebook *nb) { + char *text; + gtk_ctree_get_node_info(GTK_CTREE(ctree), node, &text, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + gtk_label_set_text (GTK_LABEL(preflabel), text); + gtk_notebook_set_page (GTK_NOTEBOOK (prefsnotebook), gtk_ctree_node_get_row_data(GTK_CTREE(ctree), node)); + +} +#endif /* GTK_CHECK_VERSION */ + +/* These are the pages in the preferences notebook */ +GtkWidget *interface_page() { + GtkWidget *ret; + GtkWidget *frame; GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *entry; - GtkWidget *first, *opt; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + /* All the pages are pretty similar--a vbox packed with frames... */ + frame = gtk_frame_new (_("Windows")); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + /* And a vbox in each frame */ + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + /* These shouldn't have to wait for user to click OK or APPLY or whatnot */ + /* They really shouldn't be in preferences at all */ + gaim_button(_("Show Buddy Ticker"), &misc_options, OPT_MISC_BUDDY_TICKER, vbox); + debugbutton = gaim_button(_("Show Debug Window"), &misc_options, OPT_MISC_DEBUG, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new (_("Style")); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Use borderless buttons"), &misc_options_new, OPT_MISC_COOL_LOOK, vbox); + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *font_page() { + GtkWidget *ret; GtkWidget *frame; - GtkWidget *table; + GtkWidget *button; + GtkWidget *vbox, *hbox; + GtkWidget *select = NULL; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new (_("Style")); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Bold"), &font_options_new, OPT_FONT_BOLD, vbox); + gaim_button(_("Italics"), &font_options_new, OPT_FONT_ITALIC, vbox); + gaim_button(_("Underline"), &font_options_new, OPT_FONT_UNDERLINE, vbox); + gaim_button(_("Strikethough"), &font_options_new, OPT_FONT_STRIKE, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new (_("Face")); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + button = gaim_button(_("Use custom face"), &font_options_new, OPT_FONT_FACE, hbox); +#if GTK_CHECK_VERSION(1,3,0) + select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); +#else + select = picture_button(prefs, _("Select"), fontface2_xpm); +#endif + if (!(font_options_new & OPT_FONT_FACE)) + gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); + gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_font_dialog), NULL); + gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(select), GTK_RELIEF_NONE); + gtk_widget_show(select); + gtk_widget_show(hbox); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + button = gaim_button(_("Use custom size"), &font_options_new, OPT_FONT_SIZE, hbox); + select = gaim_labeled_spin_button(hbox, NULL, &fontsize_new, 1, 7); + if (!(font_options_new & OPT_FONT_SIZE)) + gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); + gtk_widget_show(hbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Color"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + + pref_fg_picture = show_color_pref(hbox, TRUE); + button = gaim_button(_("Text color"), &font_options_new, OPT_FONT_FGCOL, hbox); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), + pref_fg_picture); + +#if GTK_CHECK_VERSION(1,3,0) + select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); +#else + select = picture_button(prefs, _("Select"), fgcolor_xpm); +#endif + if (!(font_options_new & OPT_FONT_FGCOL)) + gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); + gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_fgcolor_dialog), NULL); + gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(select), GTK_RELIEF_NONE); + gtk_widget_show(select); + gtk_widget_show(hbox); - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + pref_bg_picture = show_color_pref(hbox, FALSE); + button = gaim_button(_("Background color"), &font_options_new, OPT_FONT_BGCOL, hbox); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), + pref_bg_picture); +#if GTK_CHECK_VERSION(1,3,0) + select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); +#else + select = picture_button(prefs, _("Select"), bgcolor_xpm); +#endif + if (!(font_options_new & OPT_FONT_BGCOL)) + gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_bgcolor_dialog), NULL); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); + gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(select), GTK_RELIEF_NONE); + gtk_widget_show(select); + gtk_widget_show(hbox); + gtk_widget_show (vbox); + + + gtk_widget_show(ret); + return ret; +} + + +GtkWidget *messages_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Display"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Show graphical smileys"), &convo_options_new, OPT_CONVO_SHOW_SMILEY, vbox); + gaim_button(_("Show timestamp on messages"), &convo_options_new, OPT_CONVO_SHOW_TIME, vbox); + gaim_button(_("Show URLs as links"), &convo_options_new, OPT_CONVO_SEND_LINKS, vbox); + gaim_button(_("Highlight misspelled words"), &convo_options_new, OPT_CONVO_CHECK_SPELLING, vbox); + gtk_widget_show (vbox); + - prefdialog = gtk_frame_new(_("Proxy Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); + frame = gtk_frame_new ("Ignore"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Ignore colors"), &convo_options_new, OPT_CONVO_IGNORE_COLOUR, vbox); + gaim_button(_("Ignore font faces"), &convo_options_new, OPT_CONVO_IGNORE_FONTS, vbox); + gaim_button(_("Ignore font sizes"), &convo_options_new, OPT_CONVO_IGNORE_SIZES, vbox); + gaim_button(_("Ignore TiK Automated Messages"), &away_options_new, OPT_AWAY_TIK_HACK, vbox); + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *hotkeys_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Send Message"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Enter sends message"), &convo_options_new, OPT_CONVO_ENTER_SENDS, vbox); + gaim_button(_("Control-Enter sends message"), &convo_options_new, OPT_CONVO_CTL_ENTER, vbox); + gtk_widget_show (vbox); + + frame = gtk_frame_new ("Window Closing"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Escape closes window"), &convo_options_new, OPT_CONVO_ESC_CAN_CLOSE, vbox); + gaim_button(_("Control-W closes window"), &convo_options_new, OPT_CONVO_CTL_W_CLOSES, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Insertions"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); vbox = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), vbox); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Control-{B/I/U/S} inserts HTML tags"), &convo_options_new, OPT_CONVO_CTL_CHARS, vbox); + gaim_button(_("Control-(number) inserts smileys"), &convo_options_new, OPT_CONVO_CTL_SMILEYS, vbox); + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *list_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Buttons"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Hide IM/Info/Chat buttons"), &blist_options_new, OPT_BLIST_NO_BUTTONS, vbox); + gaim_button(_("Show pictures on buttons"), &blist_options_new, OPT_BLIST_SHOW_BUTTON_XPM, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Buddy List Window"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); +#ifdef USE_APPLET + gaim_button(_("Automatically show buddy list on sign on"), &blist_options_new, + OPT_BLIST_APP_BUDDY_SHOW, vbox); + gaim_button(_("Display Buddy List near applet"), &blist_options_new, OPT_BLIST_NEAR_APPLET, vbox); + +#endif + gaim_button(_("Save Window Size/Position"), &blist_options_new, OPT_BLIST_SAVED_WINDOWS, vbox); + gaim_button(_("Raise Window on Events"), &blist_options_new, OPT_BLIST_POPUP, vbox); + gtk_widget_show(vbox); + + + frame = gtk_frame_new ("Group Display"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Hide groups with no online buddies"), &blist_options_new, OPT_BLIST_NO_MT_GRP, vbox); + gaim_button(_("Show numbers in groups"), &blist_options_new, OPT_BLIST_SHOW_GRPNUM, vbox); + gtk_widget_show(vbox); + + + frame = gtk_frame_new ("Buddy Display"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Show buddy type icons"), &blist_options_new, OPT_BLIST_SHOW_PIXMAPS, vbox); + gaim_button(_("Show warning levels"), &blist_options_new, OPT_BLIST_SHOW_WARN, vbox); + gaim_button(_("Show idle times"), &blist_options_new, OPT_BLIST_SHOW_IDLETIME, vbox); + gaim_button(_("Grey idle buddies"), &blist_options_new, OPT_BLIST_GREY_IDLERS, vbox); + gtk_widget_show(vbox); + + + + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *im_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + GtkWidget *typingbutton; + + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Window"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_dropdown(vbox, "Show buttons as:", &im_options_new, OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM, + "Pictures", OPT_IM_BUTTON_XPM, + "Text", OPT_IM_BUTTON_TEXT, + "Pictures and text", OPT_IM_BUTTON_XPM | OPT_IM_BUTTON_TEXT, NULL); + gaim_labeled_spin_button(vbox, _("New window width:"), &conv_size_new.width, 25, 9999); + gaim_labeled_spin_button(vbox, _("New window height:"), &conv_size_new.height, 25, 9999); + gaim_labeled_spin_button(vbox, _("Entry widget height:"), &conv_size_new.entry_height, 25, 9999); + gaim_button(_("Raise windows on events"), &im_options_new, OPT_IM_POPUP, vbox); + gaim_button(_("Hide window on send"), &im_options_new, OPT_IM_POPDOWN, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Buddy Icons"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Hide Buddy Icons"), &im_options_new, OPT_IM_HIDE_ICONS, vbox); + gaim_button(_("Disable Buddy Icon Animation"), &im_options_new, OPT_IM_NO_ANIMATION, vbox); gtk_widget_show(vbox); - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); + + frame = gtk_frame_new ("Display"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Show logins in window"), &im_options_new, OPT_IM_LOGON, vbox); + gtk_widget_show(vbox); + + + frame = gtk_frame_new ("Typing Notification"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + typingbutton = gaim_button(_("Notify buddies that you are typing to them"), &misc_options_new, + OPT_MISC_STEALTH_TYPING, vbox); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(typingbutton), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(typingbutton))); + misc_options ^= OPT_MISC_STEALTH_TYPING; + gtk_widget_show(vbox); + + + + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *chat_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Window"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_dropdown(vbox, "Show buttons as:", &chat_options_new, OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM, + "Pictures", OPT_CHAT_BUTTON_XPM, + "Text", OPT_CHAT_BUTTON_TEXT, + "Pictures and Text", OPT_CHAT_BUTTON_XPM | OPT_CHAT_BUTTON_TEXT, NULL); + gaim_labeled_spin_button(vbox, _("New window width:"), &buddy_chat_size_new.width, 25, 9999); + gaim_labeled_spin_button(vbox, _("New window height:"), &buddy_chat_size_new.height, 25, 9999); + gaim_labeled_spin_button(vbox, _("Entry widget height:"), &buddy_chat_size_new.entry_height, 25, 9999); + gaim_button(_("Raise windows on events"), &chat_options, OPT_CHAT_POPUP, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Tab Completion"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Tab-Complete Nicks"), &chat_options_new, OPT_CHAT_TAB_COMPLETE, vbox); + gaim_button(_("Old-Style Tab Completion"), &chat_options_new, OPT_CHAT_OLD_STYLE_TAB, vbox); + gtk_widget_show(vbox); + + + frame = gtk_frame_new ("Display"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Show people joining/leaving in window"), &chat_options_new, OPT_CHAT_LOGON, vbox); + gaim_button(_("Colorize screennames"), &chat_options_new, OPT_CHAT_COLORIZE, vbox); + gtk_widget_show(vbox); + + gtk_widget_show(ret); + return ret; +} - label = gtk_label_new(_("Not all protocols can use these proxy options. Please see the " - "README file for details.")); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); +GtkWidget *tab_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("IM Tabs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + gaim_dropdown(vbox, "Tab Placement:", &im_options_new, OPT_IM_SIDE_TAB | OPT_IM_BR_TAB, + "Top", 0, + "Bottom", OPT_IM_BR_TAB, + "Left", OPT_IM_SIDE_TAB, + "Right", OPT_IM_BR_TAB | OPT_IM_SIDE_TAB, NULL); + gaim_button(_("Show all Instant Messages in one tabbed\nwindow"), &im_options_new, OPT_IM_ONE_WINDOW, vbox); + gaim_button(_("Show aliases in tabs/titles"), &im_options_new, OPT_IM_ALIAS_TAB, vbox); + gtk_widget_show (vbox); + + + frame = gtk_frame_new ("Chat Tabs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + gaim_dropdown(vbox, "Tab Placement:", &chat_options_new, OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, + "Top", 0, + "Bottom", OPT_CHAT_BR_TAB, + "Left", OPT_CHAT_SIDE_TAB, + "Right", OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, NULL); + gaim_button(_("Show all chats in one tabbed window"), &chat_options_new, OPT_CHAT_ONE_WINDOW, + vbox); + gtk_widget_show(vbox); - frame = gtk_frame_new(_("Proxy Type")); - gtk_container_set_border_width(GTK_CONTAINER(frame), 5); - gtk_widget_show(frame); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); + frame = gtk_frame_new ("Combined Tabs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gtk_widget_show(vbox); + gaim_button(_("Show IMs and chats in same tabbed\nwindow."), &convo_options_new, OPT_CONVO_COMBINE, vbox); + + frame = gtk_frame_new ("Buddy List Tabs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + gaim_dropdown(vbox, "Tab Placement:", &blist_options_new, OPT_BLIST_BOTTOM_TAB, + "Top", 0, + "Bottom", OPT_BLIST_BOTTOM_TAB, NULL); + gtk_widget_show(vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *proxy_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + GtkWidget *entry; + GtkWidget *label; + GtkWidget *hbox; + GtkWidget *table; + + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Proxy Type"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_dropdown(vbox, "Proxy Type:", &proxytype_new, -1, + "No Proxy", PROXY_NONE, + "SOCKS 4", PROXY_SOCKS4, + "SOCKS 5", PROXY_SOCKS5, + "HTTP", PROXY_HTTP, NULL); + gtk_widget_show (vbox); table = gtk_table_new(2, 2, FALSE); gtk_container_set_border_width(GTK_CONTAINER(table), 5); gtk_table_set_col_spacings(GTK_TABLE(table), 5); gtk_table_set_row_spacings(GTK_TABLE(table), 5); gtk_widget_show(table); - gtk_container_add(GTK_CONTAINER(frame), table); frame = gtk_frame_new(_("Proxy Server")); prefs_proxy_frame = frame; - first = gtk_radio_button_new_with_label(NULL, _("No Proxy")); - gtk_table_attach(GTK_TABLE(table), first, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - - gtk_signal_connect(GTK_OBJECT(first), "clicked", - GTK_SIGNAL_FUNC(proxy_print_optionrad), (void *)PROXY_NONE); - gtk_widget_show(first); - - if (proxytype == PROXY_NONE) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(first), TRUE); - - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), - _("SOCKS 4")); - gtk_table_attach(GTK_TABLE(table), opt, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", - GTK_SIGNAL_FUNC(proxy_print_optionrad), (void *)PROXY_SOCKS4); - gtk_widget_show(opt); - if (proxytype == PROXY_SOCKS4) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), - _("SOCKS 5")); - gtk_table_attach(GTK_TABLE(table), opt, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", - GTK_SIGNAL_FUNC(proxy_print_optionrad), (void *)PROXY_SOCKS5); - gtk_widget_show(opt); - if (proxytype == PROXY_SOCKS5) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(first)), _("HTTP")); - gtk_table_attach(GTK_TABLE(table), opt, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", - GTK_SIGNAL_FUNC(proxy_print_optionrad), (void *)PROXY_HTTP); - gtk_widget_show(opt); - if (proxytype == PROXY_HTTP) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - - gtk_container_set_border_width(GTK_CONTAINER(frame), 5); gtk_widget_show(frame); - gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5); + gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 5); if (proxytype == PROXY_NONE) gtk_widget_set_sensitive(GTK_WIDGET(frame), FALSE); @@ -466,7 +770,7 @@ gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1, GTK_FILL, 0, 0, 0); entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 0, 1, GTK_FILL, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYHOST); gtk_entry_set_text(GTK_ENTRY(entry), proxyhost); @@ -482,7 +786,7 @@ gtk_widget_show(label); entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYPORT); @@ -499,7 +803,7 @@ gtk_widget_show(label); entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYUSER); gtk_entry_set_text(GTK_ENTRY(entry), proxyuser); @@ -515,926 +819,326 @@ gtk_widget_show(label); entry = gtk_entry_new(); - gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL | GTK_EXPAND, 0, 0, 0); + gtk_table_attach(GTK_TABLE(table), entry, 1, 2, 3, 4, GTK_FILL , 0, 0, 0); gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); gtk_signal_connect(GTK_OBJECT(entry), "changed", GTK_SIGNAL_FUNC(proxy_print_option), (void *)PROXYPASS); gtk_entry_set_text(GTK_ENTRY(entry), proxypass); gtk_widget_show(entry); - - gtk_widget_show(prefdialog); -} - -static void buddy_page() -{ - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; - GtkWidget *frame; - GtkWidget *hbox; - GtkWidget *vbox; - GtkWidget *sep; - GtkWidget *opt; - GtkWidget *button; - GtkWidget *button2; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Buddy List Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new(_("Buddy List Window")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - /* "Place blist tabs */ - vbox = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 5); - gtk_widget_show(vbox); - - label = gtk_label_new(_("Tab Placement:")); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - opt = blist_tab_radio(_("Top"), ~(OPT_BLIST_BOTTOM_TAB), vbox, NULL); - opt = blist_tab_radio(_("Bottom"), OPT_BLIST_BOTTOM_TAB, vbox, opt); - - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 5); - gtk_widget_show(sep); - - /* End of blist tab options */ - - vbox = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - button = gaim_button(_("Hide IM/Info/Chat buttons"), &blist_options, OPT_BLIST_NO_BUTTONS, vbox); -#ifdef USE_APPLET - gaim_button(_("Automatically show buddy list on sign on"), &blist_options, - OPT_BLIST_APP_BUDDY_SHOW, vbox); - gaim_button(_("Display Buddy List near applet"), &blist_options, OPT_BLIST_NEAR_APPLET, vbox); - -#endif - gaim_button(_("Save Window Size/Position"), &blist_options, OPT_BLIST_SAVED_WINDOWS, vbox); - - button2 = - gaim_button(_("Show pictures on buttons"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM, vbox); - if (blist_options & OPT_BLIST_NO_BUTTONS) - gtk_widget_set_sensitive(button2, FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), button2); - gaim_button(_("Raise Buddy List on Signons and Signoffs"), &blist_options, OPT_BLIST_POPUP, vbox); - - frame = gtk_frame_new(_("Group Displays")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Hide groups with no online buddies"), &blist_options, OPT_BLIST_NO_MT_GRP, vbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Show numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox); - - frame = gtk_frame_new(_("Buddy Displays")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Show buddy type icons"), &blist_options, OPT_BLIST_SHOW_PIXMAPS, vbox); - gaim_button(_("Show warning levels"), &blist_options, OPT_BLIST_SHOW_WARN, vbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Show idle times"), &blist_options, OPT_BLIST_SHOW_IDLETIME, vbox); - gaim_button(_("Grey idle buddies"), &blist_options, OPT_BLIST_GREY_IDLERS, vbox); - - gtk_widget_show(prefdialog); -} - -static void convo_page() -{ - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; - GtkWidget *frame; - GtkWidget *hbox; - GtkWidget *vbox; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Conversation Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new(_("Keyboard Options")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Enter sends message"), &convo_options, OPT_CONVO_ENTER_SENDS, vbox); - gaim_button(_("Control-Enter sends message"), &convo_options, OPT_CONVO_CTL_ENTER, vbox); - gaim_button(_("Escape closes window"), &convo_options, OPT_CONVO_ESC_CAN_CLOSE, vbox); - gaim_button(_("Control-W closes window"), &convo_options, OPT_CONVO_CTL_W_CLOSES, vbox); - - vbox = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Control-{B/I/U/S} inserts HTML tags"), &convo_options, OPT_CONVO_CTL_CHARS, vbox); - gaim_button(_("Control-(number) inserts smileys"), &convo_options, OPT_CONVO_CTL_SMILEYS, vbox); - gaim_button(_("F2 toggles timestamp display"), &convo_options, OPT_CONVO_F2_TOGGLES, vbox); - - frame = gtk_frame_new(_("Display and General Options")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Show graphical smileys"), &convo_options, OPT_CONVO_SHOW_SMILEY, vbox); - gaim_button(_("Show timestamp on messages"), &convo_options, OPT_CONVO_SHOW_TIME, vbox); - gaim_button(_("Show URLs as links"), &convo_options, OPT_CONVO_SEND_LINKS, vbox); - gaim_button(_("Highlight misspelled words"), &convo_options, OPT_CONVO_CHECK_SPELLING, vbox); - gaim_button(_("Sending messages removes away status"), &away_options, OPT_AWAY_BACK_ON_IM, vbox); - gaim_button(_("Queue new messages when away"), &away_options, OPT_AWAY_QUEUE, vbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Ignore colors"), &convo_options, OPT_CONVO_IGNORE_COLOUR, vbox); - gaim_button(_("Ignore font faces"), &convo_options, OPT_CONVO_IGNORE_FONTS, vbox); - gaim_button(_("Ignore font sizes"), &convo_options, OPT_CONVO_IGNORE_SIZES, vbox); - gaim_button(_("Ignore TiK Automated Messages"), &away_options, OPT_AWAY_TIK_HACK, vbox); - gaim_button(_("Ignore new conversations when away"), &away_options, OPT_AWAY_DISCARD, vbox); - - gtk_widget_show(prefdialog); + gtk_widget_show(ret); + return ret; } -static void set_buttons_opt(GtkWidget *w, int data) -{ - int mask; - if (data & 0x1) { /* set the first bit if we're affecting chat buttons */ - mask = (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM); - chat_options &= ~(mask); - chat_options |= (data & mask); - update_chat_button_pix(); - } else { - mask = (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM); - im_options &= ~(mask); - im_options |= (data & mask); - update_im_button_pix(); - } +GtkWidget *browser_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox, *hbox; + GtkWidget *label; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); - save_prefs(); -} + frame = gtk_frame_new ("Browser Selection"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_dropdown(vbox, "Broswer", &web_browser_new, -1, + "Netscape", BROWSER_NETSCAPE, + "Konqueror", BROWSER_KONQ, + "Mozilla", BROWSER_MOZILLA, + "Manual", BROWSER_MANUAL, +#ifdef USE_GNOME + "GNOME URL Handler", BROWSER_GNOME, +#endif /* USE_GNOME */ + "Galeon", BROWSER_GALEON, + "Opera", BROWSER_OPERA, NULL); -/* i like everclear */ -static GtkWidget *am_radio(char *label, int which, GtkWidget *box, GtkWidget *set) -{ - GtkWidget *opt; + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + label = gtk_label_new("Manual: "); + gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + browser_entry = gtk_entry_new(); + if (web_browser_new != BROWSER_MANUAL) + gtk_widget_set_sensitive(browser_entry, FALSE); + gtk_box_pack_start (GTK_BOX (hbox), browser_entry, FALSE, FALSE, 0); + gtk_widget_show(browser_entry); + gtk_widget_show(hbox); + gtk_widget_show (vbox); + - if (!set) - opt = gtk_radio_button_new_with_label(NULL, label); - else - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), - label); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(set_buttons_opt), (void *)which); - gtk_widget_show(opt); - if (which & 1) { - if (which == (OPT_CHAT_BUTTON_TEXT | 1)) { - if ((chat_options & OPT_CHAT_BUTTON_TEXT) && - !(chat_options & OPT_CHAT_BUTTON_XPM)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } else if (which == (OPT_CHAT_BUTTON_XPM | 1)) { - if (!(chat_options & OPT_CHAT_BUTTON_TEXT) && - (chat_options & OPT_CHAT_BUTTON_XPM)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } else { - if (((chat_options & OPT_CHAT_BUTTON_TEXT) && - (chat_options & OPT_CHAT_BUTTON_XPM)) || - (!(chat_options & OPT_CHAT_BUTTON_TEXT) && - !(chat_options & OPT_CHAT_BUTTON_XPM))) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } - } else { - if (which == OPT_IM_BUTTON_TEXT) { - if ((im_options & OPT_IM_BUTTON_TEXT) && !(im_options & OPT_IM_BUTTON_XPM)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } else if (which == OPT_IM_BUTTON_XPM) { - if (!(im_options & OPT_IM_BUTTON_TEXT) && (im_options & OPT_IM_BUTTON_XPM)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } else { - if (((im_options & OPT_IM_BUTTON_TEXT) && - (im_options & OPT_IM_BUTTON_XPM)) || - (!(im_options & OPT_IM_BUTTON_TEXT) && !(im_options & OPT_IM_BUTTON_XPM))) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - } - } + frame = gtk_frame_new ("Browser Options"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Open new window by default"), &misc_options_new, OPT_MISC_BROWSER_POPUP, vbox); + gtk_widget_show(vbox); + + gtk_widget_show(ret); + return ret; +} + +GtkWidget *logging_page() { + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); - return opt; -} + frame = gtk_frame_new ("Message Logs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Log all conversations"), &logging_options_new, OPT_LOG_ALL, vbox); + gaim_button(_("Strip HTML from logs"), &logging_options_new, OPT_LOG_STRIP_HTML, vbox); + gtk_widget_show (vbox); -static void set_tab_opt(GtkWidget *w, int data) -{ - int mask; - if (convo_options & OPT_CONVO_COMBINE) { - /* through an amazing coincidence (this wasn't planned), we're able to do this, - * since the two sets of options end up having the same value. isn't that great. */ - mask = (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB); - chat_options &= ~(mask); - chat_options |= (data & mask); - - mask = (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB); - im_options &= ~(mask); - im_options |= (data & mask); - update_im_tabs(); - } else { - if (data & 0x1) { /* set the first bit if we're affecting chat buttons */ - mask = (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB); - chat_options &= ~(mask); - chat_options |= (data & mask); - update_chat_tabs(); - } else { - mask = (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB); - im_options &= ~(mask); - im_options |= (data & mask); - update_im_tabs(); - } - } + frame = gtk_frame_new ("System Logs"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Log when buddies sign on/sign off"), &logging_options_new, OPT_LOG_BUDDY_SIGNON, + vbox); + gaim_button(_("Log when buddies become idle/un-idle"), &logging_options_new, OPT_LOG_BUDDY_IDLE, + vbox); + gaim_button(_("Log when buddies go away/come back"), &logging_options_new, OPT_LOG_BUDDY_AWAY, vbox); + gaim_button(_("Log your own signons/idleness/awayness"), &logging_options_new, OPT_LOG_MY_SIGNON, + vbox); + gaim_button(_("Individual log file for each buddy's signons"), &logging_options_new, + OPT_LOG_INDIVIDUAL, vbox); + gtk_widget_show(vbox); - save_prefs(); + gtk_widget_show(ret); + return ret; } -static GtkWidget *tab_radio(char *label, int which, GtkWidget *box, GtkWidget *set) +static GtkWidget *sndcmd = NULL; +/* static void set_sound_driver(GtkWidget *w, int option) { - GtkWidget *opt; - - if (!set) - opt = gtk_radio_button_new_with_label(NULL, label); + if (option == OPT_SOUND_CMD) + gtk_widget_set_sensitive(sndcmd, TRUE); else - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), - label); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(opt), "clicked", GTK_SIGNAL_FUNC(set_tab_opt), (void *)which); - gtk_widget_show(opt); - if (which & 1) { - if ((chat_options & (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB)) == (which ^ 1)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - if (!(chat_options & OPT_CHAT_ONE_WINDOW)) - gtk_widget_set_sensitive(opt, FALSE); - } else { - if ((im_options & (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB)) == which) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - if (!(im_options & OPT_IM_ONE_WINDOW)) - gtk_widget_set_sensitive(opt, FALSE); - } + gtk_widget_set_sensitive(sndcmd, FALSE); - return opt; -} + sound_options &= ~(OPT_SOUND_NORMAL | OPT_SOUND_BEEP | + OPT_SOUND_NAS | OPT_SOUND_ARTSC | + OPT_SOUND_ESD | OPT_SOUND_CMD); + sound_options |= option; + save_prefs(); + } */ -static void update_spin_value(GtkWidget *w, GtkWidget *spin) +static gint sound_cmd_yeah(GtkEntry *entry, GdkEvent *event, gpointer d) { - int *value = gtk_object_get_user_data(GTK_OBJECT(spin)); - *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); + g_snprintf(sound_cmd_new, sizeof(sound_cmd_new), "%s", gtk_entry_get_text(GTK_ENTRY(sndcmd))); + return TRUE; } -static void gaim_labeled_spin_button(GtkWidget *box, const gchar *title, int *val, int min, int max) -{ - GtkWidget *hbox; - GtkWidget *label; - GtkWidget *spin; - GtkObject *adjust; - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - label = gtk_label_new(title); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); - spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); - gtk_object_set_user_data(GTK_OBJECT(spin), val); - gtk_widget_set_usize(spin, 50, -1); - gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", - GTK_SIGNAL_FUNC(update_spin_value), GTK_WIDGET(spin)); - gtk_widget_show(spin); -} - -static gboolean current_is_im = FALSE; - -static void not_im() -{ - current_is_im = FALSE; -} - -static void im_page() -{ - GtkWidget *parent; - GtkWidget *box; +GtkWidget *sound_page() { + GtkWidget *ret; + GtkWidget *frame; GtkWidget *label; - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *vbox2; - GtkWidget *opt; - GtkWidget *sep; - GtkWidget *button; - GtkWidget *hbox2; - GtkWidget *vbox3; + GtkWidget *vbox, *hbox; + + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); + frame = gtk_frame_new ("Sound Options"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox); + gaim_button(_("Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox); + gtk_widget_show (vbox); - current_is_im = TRUE; - prefdialog = gtk_frame_new(_("IM Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - gtk_signal_connect(GTK_OBJECT(prefdialog), "destroy", GTK_SIGNAL_FUNC(not_im), NULL); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); + frame = gtk_frame_new ("Sound Method"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); + gaim_dropdown(vbox, "Method", &sound_options_new, OPT_SOUND_BEEP | + OPT_SOUND_ESD | OPT_SOUND_ARTSC | OPT_SOUND_NAS | OPT_SOUND_NORMAL | + OPT_SOUND_CMD, + "Console Beep", OPT_SOUND_BEEP, +#ifdef ESD_SOUND + "ESD", OPT_SOUND_ESD, +#endif /* ESD_SOUND */ +#ifdef ARTSC_SOUND + "ArtsC", OPT_SOUND_ARTSC, +#endif /* ARTSC_SOUND */ +#ifdef NAS_SOUND + "NAS", OPT_SOUND_NAS, +#endif /* NAS_SOUND */ + "Internal", OPT_SOUND_NORMAL, + "Command", OPT_SOUND_CMD, NULL); - frame = gtk_frame_new(_("IM Window")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - + hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); gtk_widget_show(hbox); - - vbox2 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 5); - gtk_widget_show(vbox2); - - label = gtk_label_new(_("Show buttons as: ")); - gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 5); + label = gtk_label_new("Sound Method"); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + gtk_widget_show(hbox); + label = gtk_label_new(_("Sound command\n(%s for filename)")); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); gtk_widget_show(label); - opt = am_radio(_("Pictures And Text"), OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM, vbox2, NULL); - opt = am_radio(_("Pictures"), OPT_IM_BUTTON_XPM, vbox2, opt); - opt = am_radio(_("Text"), OPT_IM_BUTTON_TEXT, vbox2, opt); - - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 5); - gtk_widget_show(sep); - - vbox2 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); + sndcmd = gtk_entry_new(); - button = - gaim_button(_("Show all conversations in one tabbed window"), &im_options, OPT_IM_ONE_WINDOW, - vbox2); - opt = gaim_button(_("Show chats in the same tabbed window"), &convo_options, OPT_CONVO_COMBINE, vbox2); - if (chat_options & OPT_CHAT_ONE_WINDOW) { - if (!(im_options & OPT_IM_ONE_WINDOW)) - gtk_widget_set_sensitive(opt, FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - } else - gtk_widget_set_sensitive(opt, FALSE); - gaim_button(_("Raise windows on events"), &im_options, OPT_IM_POPUP, vbox2); - gaim_button(_("Show logins in window"), &im_options, OPT_IM_LOGON, vbox2); - gaim_button(_("Show aliases in tabs/titles/ticker"), &im_options, OPT_IM_ALIAS_TAB, vbox2); - gaim_button(_("Hide window on send"), &im_options, OPT_IM_POPDOWN, vbox2); + gtk_entry_set_editable(GTK_ENTRY(sndcmd), TRUE); + gtk_entry_set_text(GTK_ENTRY(sndcmd), sound_cmd); +#if GTK_CHECK_VERSION(1,3,0) + gtk_widget_set_size_request(sndcmd, 75, -1); +#else + gtk_widget_set_usize(sndcmd, 75, -1); +#endif + gtk_widget_set_sensitive(sndcmd, (sound_options_new & OPT_SOUND_CMD)); + gtk_box_pack_start(GTK_BOX(hbox), sndcmd, TRUE, TRUE, 5); + gtk_signal_connect(GTK_OBJECT(sndcmd), "focus_out_event", GTK_SIGNAL_FUNC(sound_cmd_yeah), NULL); + gtk_widget_show(sndcmd); - frame = gtk_frame_new(_("Window Sizes")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); gtk_widget_show(vbox); - gaim_labeled_spin_button(vbox, _("New window width:"), &conv_size.width, 25, 9999); - gaim_labeled_spin_button(vbox, _("New window height:"), &conv_size.height, 25, 9999); - gaim_labeled_spin_button(vbox, _("Entry widget height:"), &conv_size.entry_height, 25, 9999); - - frame = gtk_frame_new(_("Tab Placement")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - hbox2 = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox2, TRUE, TRUE, 5); - gtk_widget_show(hbox2); - - vbox3 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox2), vbox3, TRUE, TRUE, 5); - gtk_widget_show(vbox3); - - opt = tab_radio(_("Top"), 0, vbox3, NULL); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - opt = tab_radio(_("Bottom"), OPT_IM_BR_TAB, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - - vbox3 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox2), vbox3, TRUE, TRUE, 5); - gtk_widget_show(vbox3); - - opt = tab_radio(_("Left"), OPT_IM_SIDE_TAB, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - opt = tab_radio(_("Right"), OPT_IM_SIDE_TAB | OPT_IM_BR_TAB, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - -#if USE_PIXBUF - frame = gtk_frame_new(_("Buddy Icons")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Hide Buddy Icons"), &im_options, OPT_IM_HIDE_ICONS, vbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - gaim_button(_("Disable Buddy Icon Animation"), &im_options, OPT_IM_NO_ANIMATION, vbox); -#endif - - gtk_widget_show(prefdialog); + gtk_widget_show(ret); + return ret; } -static void chat_page() -{ - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; +GtkWidget *away_page() { + GtkWidget *ret; GtkWidget *frame; GtkWidget *vbox; GtkWidget *hbox; - GtkWidget *vbox2; - GtkWidget *opt; - GtkWidget *sep; + GtkWidget *label; GtkWidget *button; - GtkWidget *hbox2; - GtkWidget *vbox3; - GtkWidget *tab; - GtkWidget *old; + GtkWidget *select; - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Chat Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new(_("Group Chat Window")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - + frame = gtk_frame_new ("Away"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_button(_("Sending messages removes away status"), &away_options_new, OPT_AWAY_BACK_ON_IM, vbox); + gaim_button(_("Queue new messages when away"), &away_options_new, OPT_AWAY_QUEUE, vbox); + gaim_button(_("Ignore new conversations when away"), &away_options_new, OPT_AWAY_DISCARD, vbox); + gaim_button(_("Sounds while away"), &sound_options_new, OPT_SOUND_WHEN_AWAY, vbox); + gtk_widget_show (vbox); - vbox2 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 5); - gtk_widget_show(vbox2); - label = gtk_label_new(_("Show buttons as: ")); - gtk_box_pack_start(GTK_BOX(vbox2), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - opt = - am_radio(_("Pictures And Text"), OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM | 1, vbox2, - NULL); - opt = am_radio(_("Pictures"), OPT_CHAT_BUTTON_XPM | 1, vbox2, opt); - opt = am_radio(_("Text"), OPT_CHAT_BUTTON_TEXT | 1, vbox2, opt); - - sep = gtk_vseparator_new(); - gtk_box_pack_start(GTK_BOX(hbox), sep, FALSE, FALSE, 5); - gtk_widget_show(sep); + frame = gtk_frame_new ("Auto-response"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); - vbox2 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + gaim_labeled_spin_button(hbox, _("Seconds before resending:"), + &away_resend_new, 1, 24 * 60 * 60); + gtk_widget_show(hbox); + gaim_button(_("Don't send auto-response"), &away_options, OPT_AWAY_NO_AUTO_RESP, vbox); + gaim_button(_("Only send auto-response when idle"), &away_options_new, OPT_AWAY_IDLE_RESP, vbox); - button = - gaim_button(_("Show all chats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW, - vbox2); - opt = gaim_button(_("Show conversations in the same tabbed window"), &convo_options, OPT_CONVO_COMBINE, vbox2); - if (im_options & OPT_IM_ONE_WINDOW) { - if (!(chat_options & OPT_CHAT_ONE_WINDOW)) - gtk_widget_set_sensitive(opt, FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - } else - gtk_widget_set_sensitive(opt, FALSE); - gaim_button(_("Raise windows on events"), &chat_options, OPT_CHAT_POPUP, vbox2); - gaim_button(_("Show people joining/leaving in window"), &chat_options, OPT_CHAT_LOGON, vbox2); - - frame = gtk_frame_new(_("Window Sizes")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); + if (away_options_new & OPT_AWAY_NO_AUTO_RESP) + gtk_widget_set_sensitive(hbox, FALSE); gtk_widget_show(vbox); - gaim_labeled_spin_button(vbox, _("New window width:"), &buddy_chat_size.width, 25, 9999); - gaim_labeled_spin_button(vbox, _("New window height:"), &buddy_chat_size.height, 25, 9999); - gaim_labeled_spin_button(vbox, _("Entry widget height:"), &buddy_chat_size.entry_height, 25, 9999); - frame = gtk_frame_new(_("Tab Placement")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - + frame = gtk_frame_new ("Idle"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + gaim_dropdown(vbox, "Idle Time Reporting:", &away_resend_new, -1, + "None", IDLE_NONE, + "Gaim Usage", IDLE_GAIM, +#ifdef USE_SCREENSAVER + "X Usage", IDLE_SCREENSAVER, +#endif + NULL); gtk_widget_show(vbox); - - hbox2 = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox2, TRUE, TRUE, 5); - gtk_widget_show(hbox2); - - vbox3 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox2), vbox3, TRUE, TRUE, 5); - gtk_widget_show(vbox3); - - opt = tab_radio(_("Top"), 1, vbox3, NULL); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - opt = tab_radio(_("Bottom"), OPT_CHAT_BR_TAB | 1, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - - vbox3 = gtk_vbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(hbox2), vbox3, TRUE, TRUE, 5); - gtk_widget_show(vbox3); - - opt = tab_radio(_("Left"), OPT_CHAT_SIDE_TAB | 1, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - opt = tab_radio(_("Right"), OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB | 1, vbox3, opt); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), opt); - - frame = gtk_frame_new(_("Tab Completion")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), hbox); - gtk_widget_show(hbox); - + + frame = gtk_frame_new ("Auto-away"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - tab = gaim_button(_("Tab-Complete Nicks"), &chat_options, OPT_CHAT_TAB_COMPLETE, vbox); + gtk_container_add (GTK_CONTAINER (frame), vbox); - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - old = gaim_button(_("Old-Style Tab Completion"), &chat_options, OPT_CHAT_OLD_STYLE_TAB, vbox); - if (!(chat_options & OPT_CHAT_TAB_COMPLETE)) - gtk_widget_set_sensitive(GTK_WIDGET(old), FALSE); - gtk_signal_connect(GTK_OBJECT(tab), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), old); - - gtk_widget_show(prefdialog); -} + button = gaim_button(_("Set away when idle"), &away_options_new, OPT_AWAY_AUTO, vbox); + select = gaim_labeled_spin_button(vbox, "Minutes before setting away:", &auto_away_new, 1, 24 * 60); + if (!(away_options_new & OPT_AWAY_AUTO)) + gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); -static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) -{ - /* more stuff stolen from X-Chat */ - GtkWidget *swid; - GdkColor c; - GtkStyle *style; - c.pixel = 0; - if (fgc) { - if (font_options & OPT_FONT_FGCOL) { - c.red = fgcolor.red << 8; - c.blue = fgcolor.blue << 8; - c.green = fgcolor.green << 8; - } else { - c.red = 0; - c.blue = 0; - c.green = 0; - } - } else { - if (font_options & OPT_FONT_BGCOL) { - c.red = bgcolor.red << 8; - c.blue = bgcolor.blue << 8; - c.green = bgcolor.green << 8; - } else { - c.red = 0xffff; - c.blue = 0xffff; - c.green = 0xffff; - } - } - - style = gtk_style_new(); - style->bg[0] = c; - - swid = gtk_event_box_new(); - gtk_widget_set_style(GTK_WIDGET(swid), style); - gtk_style_unref(style); - gtk_widget_set_usize(GTK_WIDGET(swid), 40, -1); - gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5); - gtk_widget_show(swid); - return swid; + label = gtk_label_new("Away message:"); + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox), hbox); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + prefs_away_menu = gtk_option_menu_new(); + if (!(away_options_new & OPT_AWAY_AUTO)) + gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), prefs_away_menu); + default_away_menu_init(prefs_away_menu); + gtk_widget_show(prefs_away_menu); + gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + gtk_widget_show(ret); + return ret; } -GtkWidget *pref_fg_picture = NULL; -GtkWidget *pref_bg_picture = NULL; - -void update_color(GtkWidget *w, GtkWidget *pic) +#if GTK_CHECK_VERSION (1,3,0) +static void event_toggled (GtkCellRendererToggle *cell, gchar *pth, gpointer data) { - GdkColor c; - GtkStyle *style; - c.pixel = 0; - if (pic == pref_fg_picture) { - if (font_options & OPT_FONT_FGCOL) { - c.red = fgcolor.red << 8; - c.blue = fgcolor.blue << 8; - c.green = fgcolor.green << 8; - } else { - c.red = 0; - c.blue = 0; - c.green = 0; - } - } else { - if (font_options & OPT_FONT_BGCOL) { - c.red = bgcolor.red << 8; - c.blue = bgcolor.blue << 8; - c.green = bgcolor.green << 8; - } else { - c.red = 0xffff; - c.blue = 0xffff; - c.green = 0xffff; - } - } + GtkTreeModel *model = (GtkTreeModel *)data; + GtkTreeIter iter; + GtkTreePath *path = gtk_tree_path_new_from_string(pth); + gint soundnum; + + gtk_tree_model_get_iter (model, &iter, path); + gtk_tree_model_get (model, &iter, 2, &soundnum, -1); - style = gtk_style_new(); - style->bg[0] = c; - gtk_widget_set_style(pic, style); - gtk_style_unref(style); + sound_options_new ^= sounds[soundnum].opt; + gtk_list_store_set (GTK_LIST_STORE (model), &iter, 0, sound_options_new & sounds[soundnum].opt, -1); +} +#endif + +static void test_sound(GtkWidget *button, gpointer i_am_NULL) +{ + guint32 tmp_sound = sound_options; + if (!(sound_options & OPT_SOUND_WHEN_AWAY)) + sound_options ^= OPT_SOUND_WHEN_AWAY; + if (!(sound_options & sounds[sound_row_sel].opt)) + sound_options ^= sounds[sound_row_sel].opt; + play_sound(sound_row_sel); + sound_options = tmp_sound; } -static void font_page() +static void reset_sound(GtkWidget *button, gpointer i_am_also_NULL) { - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; - GtkWidget *hbox; - GtkWidget *button; - GtkWidget *select; - GtkWidget *spin; - GtkObject *adjust; - GtkWidget *frame; - GtkWidget *fbox; - GtkWidget *table; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Font Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new("Font Style"); - - table = gtk_table_new(2, 2, FALSE); - gtk_container_set_border_width(GTK_CONTAINER(table), 5); - gtk_table_set_col_spacings(GTK_TABLE(table), 5); - gtk_table_set_row_spacings(GTK_TABLE(table), 5); - gtk_container_add(GTK_CONTAINER(frame), table); - - button = gtk_check_button_new_with_label(_("Bold Text")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (font_options & OPT_FONT_BOLD)); - gtk_table_attach(GTK_TABLE(table), button, 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(set_font_option), (int *)OPT_FONT_BOLD); - - button = gtk_check_button_new_with_label(_("Italic Text")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (font_options & OPT_FONT_ITALIC)); - gtk_table_attach(GTK_TABLE(table), button, 0, 1, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(set_font_option), (int *)OPT_FONT_ITALIC); - - button = gtk_check_button_new_with_label(_("Underline Text")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (font_options & OPT_FONT_UNDERLINE)); - gtk_table_attach(GTK_TABLE(table), button, 1, 2, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(set_font_option), (int *)OPT_FONT_UNDERLINE); - - button = gtk_check_button_new_with_label(_("Strike through Text")); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (font_options & OPT_FONT_STRIKE)); - gtk_table_attach(GTK_TABLE(table), button, 1, 2, 1, 2, GTK_FILL | GTK_EXPAND, 0, 0, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", - GTK_SIGNAL_FUNC(set_font_option), (int *)OPT_FONT_STRIKE); - - - gtk_widget_show_all(table); - gtk_widget_show(frame); - - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - - /* ----------- */ - - frame = gtk_frame_new("Font Color"); - fbox = gtk_vbox_new(FALSE, 5); - - gtk_container_add(GTK_CONTAINER(frame), fbox); - gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); - - gtk_widget_show(fbox); - gtk_widget_show(frame); - - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - pref_fg_picture = show_color_pref(hbox, TRUE); - button = gaim_button(_("Text Color"), &font_options, OPT_FONT_FGCOL, hbox); - - select = picture_button(prefs, _("Select"), fgcolor_xpm); - gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 5); - if (!(font_options & OPT_FONT_FGCOL)) - gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); - gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_fgcolor_dialog), NULL); - gtk_widget_show(select); - - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), - pref_fg_picture); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - pref_bg_picture = show_color_pref(hbox, FALSE); - button = gaim_button(_("Background Color"), &font_options, OPT_FONT_BGCOL, hbox); - - select = picture_button(prefs, _("Select"), bgcolor_xpm); - gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 5); - if (!(font_options & OPT_FONT_BGCOL)) - gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); - gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_bgcolor_dialog), NULL); - gtk_widget_show(select); - - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(update_color), - pref_bg_picture); - - /* ----------- */ - - frame = gtk_frame_new("Font Face"); - fbox = gtk_vbox_new(FALSE, 5); + /* This just resets a sound file back to default */ + sound_file_new[sound_row_sel] = NULL; - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - button = gaim_button(_("Font Face for Text"), &font_options, OPT_FONT_FACE, hbox); - - select = picture_button(prefs, _("Select"), fontface2_xpm); - gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); - if (!(font_options & OPT_FONT_FACE)) - gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); - gtk_signal_connect(GTK_OBJECT(select), "clicked", GTK_SIGNAL_FUNC(show_font_dialog), NULL); - gtk_widget_show(select); - - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), select); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(fbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - button = gaim_button(_("Font Size for Text"), &font_options, OPT_FONT_SIZE, hbox); - - adjust = gtk_adjustment_new(fontsize, 1, 7, 1, 1, 1); - spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); - gtk_widget_set_usize(spin, 50, -1); - gtk_object_set_user_data(GTK_OBJECT(spin), &fontsize); - if (!(font_options & OPT_FONT_SIZE)) - gtk_widget_set_sensitive(GTK_WIDGET(spin), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), spin); - +gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", GTK_SIGNAL_FUNC(update_spin_value), - GTK_WIDGET(spin)); - gtk_widget_show(spin); - - gtk_container_add(GTK_CONTAINER(frame), fbox); - gtk_container_set_border_width(GTK_CONTAINER(fbox), 5); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(fbox); - gtk_widget_show(frame); - - gtk_widget_show(prefdialog); + gtk_entry_set_text(GTK_ENTRY(sound_entry), "(default)"); } -static GtkWidget *sndent[NUM_SOUNDS]; -static GtkWidget *sndcmd = NULL; -static char *last_sound_dir = NULL; - void close_sounddialog(GtkWidget *w, GtkWidget *w2) { @@ -1461,16 +1165,14 @@ return; /* Let's just be safe */ - if (sound_file[snd]) - free(sound_file[snd]); + if (sound_file_new[snd]) + free(sound_file_new[snd]); /* Set it -- and forget it */ - sound_file[snd] = g_strdup(file); - - save_prefs(); - + sound_file_new[snd] = g_strdup(file); + /* Set our text entry */ - gtk_entry_set_text(GTK_ENTRY(sndent[snd]), sound_file[snd]); + gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[snd]); /* Close the window! It's getting cold in here! */ close_sounddialog(NULL, sounddialog); @@ -1480,27 +1182,7 @@ last_sound_dir = g_dirname(sound_file[snd]); } -static void test_sound(GtkWidget *button, int snd) -{ - guint32 tmp_sound = sound_options; - if (!(sound_options & OPT_SOUND_WHEN_AWAY)) - sound_options ^= OPT_SOUND_WHEN_AWAY; - if (!(sound_options & sounds[snd].opt)) - sound_options ^= sounds[snd].opt; - play_sound(snd); - sound_options = tmp_sound; -} - -static void reset_sound(GtkWidget *button, int snd) -{ - - /* This just resets a sound file back to default */ - sound_file[snd] = NULL; - - gtk_entry_set_text(GTK_ENTRY(sndent[snd]), "(default)"); -} - -static void sel_sound(GtkWidget *button, int snd) +static void sel_sound(GtkWidget *button, gpointer being_NULL_is_fun) { char *buf = g_malloc(BUF_LEN); @@ -1517,7 +1199,7 @@ GTK_SIGNAL_FUNC(close_sounddialog), sounddialog); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->ok_button), - "clicked", GTK_SIGNAL_FUNC(do_select_sound), (int *)snd); + "clicked", GTK_SIGNAL_FUNC(do_select_sound), (int *)sound_row_sel); gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(sounddialog)->cancel_button), "clicked", GTK_SIGNAL_FUNC(close_sounddialog), sounddialog); @@ -1528,970 +1210,476 @@ gdk_window_raise(sounddialog->window); } -static void sound_entry(GtkWidget *box, int snd) -{ - GtkWidget *hbox; - GtkWidget *entry; - GtkWidget *button; + +#if GTK_CHECK_VERSION (1,3,0) +static void prefs_sound_sel (GtkTreeSelection *sel, GtkTreeModel *model) { + GtkTreeIter iter; + GValue val = { 0, }; + + if (! gtk_tree_selection_get_selected (sel, &model, &iter)) + return; + gtk_tree_model_get_value (model, &iter, 2, &val); + sound_row_sel = g_value_get_uint(&val); + if (sound_entry) + gtk_entry_set_text(sound_entry, sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)"); + g_value_unset (&val); + if (sounddialog) + gtk_widget_destroy(sounddialog); +} +#endif + +GtkWidget *sound_events_page() { + + GtkWidget *ret; + GtkWidget *frame; + GtkWidget *vbox; + GtkWidget *sw; + GtkWidget *button, *hbox; + +#if GTK_CHECK_VERSION(1,3,0) + GtkTreeIter iter; + GtkWidget *event_view; + GtkListStore *event_store; + GtkCellRenderer *rend; + GtkTreeViewColumn *col; + GtkTreeSelection *sel; + GtkTreePath *path; +#else + GtkWidget *list; +#endif + int j; + + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); + + frame = gtk_frame_new ("Sound Events"); + gtk_box_pack_start (GTK_BOX (ret), frame, TRUE, TRUE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + sw = gtk_scrolled_window_new(NULL,NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + +#if GTK_CHECK_VERSION(1,3,0) + event_store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_UINT); + + for (j=0; j < NUM_SOUNDS; j++) { + if (sounds[j].opt == 0) + continue; + + gtk_list_store_append (event_store, &iter); + gtk_list_store_set(event_store, &iter, + 0, sound_options & sounds[j].opt, + 1, sounds[j].label, + 2, j, -1); + } + + event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(event_store)); + + rend = gtk_cell_renderer_toggle_new(); + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); + g_signal_connect (G_OBJECT (sel), "changed", + G_CALLBACK (prefs_sound_sel), + NULL); + g_signal_connect (G_OBJECT(rend), "toggled", + G_CALLBACK(event_toggled), event_store); + path = gtk_tree_path_new_first(); + gtk_tree_selection_select_path(sel, path); + + col = gtk_tree_view_column_new_with_attributes ("Play", + rend, + "active", 0, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); + + rend = gtk_cell_renderer_text_new(); + col = gtk_tree_view_column_new_with_attributes ("Event", + rend, + "text", 1, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); + gtk_widget_show(event_view); + g_object_unref(G_OBJECT(event_store)); + gtk_container_add(GTK_CONTAINER(sw), event_view); +#else + list = gtk_clist_new(1); + for (j=0; sound_order[j] != 0; j++) { + if (sounds[sound_order[j]].opt == 0) + continue; + gtk_clist_append(GTK_CLIST(list), &(sounds[sound_order[j]].label)); + } + gtk_widget_show(list); + gtk_container_add(GTK_CONTAINER(sw), list); +#endif + + gtk_widget_show (vbox); + gtk_widget_show_all (ret); + + frame = gtk_frame_new ("Event Options"); + gtk_box_pack_start (GTK_BOX (ret), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + gtk_widget_show(hbox); + sound_entry = gtk_entry_new(); + gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[0] ? sound_file_new[0] : "(default)"); + gtk_entry_set_editable(GTK_ENTRY(sound_entry), FALSE); + gtk_box_pack_start(GTK_BOX(hbox), sound_entry, FALSE, FALSE, 5); + gtk_widget_show(sound_entry); + hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); gtk_widget_show(hbox); - - gaim_button(sounds[snd].label, &sound_options, sounds[snd].opt, hbox); - button = gtk_button_new_with_label(_("Test")); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 3); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(test_sound), (void *)snd); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(test_sound), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_button_new_with_label(_("Reset")); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 3); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(reset_sound), (void *)snd); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(reset_sound), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); button = gtk_button_new_with_label(_("Choose...")); - gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 3); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(sel_sound), (void *)snd); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(sel_sound), NULL); + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 1); gtk_widget_show(button); - - entry = gtk_entry_new(); - gtk_entry_set_editable(GTK_ENTRY(entry), FALSE); - - if (sound_file[snd]) - gtk_entry_set_text(GTK_ENTRY(entry), sound_file[snd]); - else - gtk_entry_set_text(GTK_ENTRY(entry), "(default)"); - - gtk_box_pack_end(GTK_BOX(hbox), entry, FALSE, FALSE, 5); - sndent[snd] = entry; - gtk_widget_show(entry); -} + + gtk_widget_show (vbox); -static gint sound_cmd_yeah(GtkEntry *entry, GdkEvent *event, gpointer d) -{ - g_snprintf(sound_cmd, sizeof(sound_cmd), "%s", gtk_entry_get_text(GTK_ENTRY(sndcmd))); - save_prefs(); - return TRUE; -} - -static void set_sound_driver(GtkWidget *w, int option) -{ - if (option == OPT_SOUND_CMD) - gtk_widget_set_sensitive(sndcmd, TRUE); - else - gtk_widget_set_sensitive(sndcmd, FALSE); - - sound_options &= ~(OPT_SOUND_NORMAL | OPT_SOUND_BEEP | - OPT_SOUND_NAS | OPT_SOUND_ARTSC | - OPT_SOUND_ESD | OPT_SOUND_CMD); - sound_options |= option; - save_prefs(); + return ret; } -static void sound_page() +#if GTK_CHECK_VERSION (1,3,0) +void away_message_sel(GtkTreeSelection *sel, GtkTreeModel *model) { - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; - GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *vbox2; - GtkWidget *sep; - GtkWidget *omenu; - GtkWidget *menu; - GtkWidget *opt; - int i=1, driver=0, j; - /* order that sound options are presented in, SND_SEPARATOR for * - * a seperator. better to do it this way than try and re-order * - * the sound defines 'cause that would mux up the sound prefs in * - * gaimrc. this list is terminated with SND_END. -Robot101 */ - int sound_order[] = { - SND_BUDDY_ARRIVE, SND_BUDDY_LEAVE, SND_SEPARATOR, - SND_FIRST_RECEIVE, SND_RECEIVE, SND_SEND, SND_SEPARATOR, - SND_CHAT_JOIN, SND_CHAT_LEAVE, - SND_CHAT_YOU_SAY, SND_CHAT_SAY, SND_CHAT_NICK, - SND_END - }; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Sound Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new(_("Options")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - vbox2 = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); - - gaim_button(_("No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox2); - - vbox2 = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); - - gaim_button(_("Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox2); - - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Sound method")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - omenu = gtk_option_menu_new(); - menu = gtk_menu_new(); - - opt = gtk_menu_item_new_with_label("Console Beep"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_BEEP); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_BEEP) && !driver) driver = i; - i++; - -#ifdef ESD_SOUND - opt = gtk_menu_item_new_with_label("ESD"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_ESD); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_ESD) && !driver) driver = i; - i++; -#endif -#ifdef ARTSC_SOUND - opt = gtk_menu_item_new_with_label("ArtsC"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_ARTSC); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_ARTSC) && !driver) driver = i; - i++; -#endif -#ifdef NAS_SOUND - opt = gtk_menu_item_new_with_label("NAS"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_NAS); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_NAS) && !driver) driver = i; - i++; -#endif - - opt = gtk_menu_item_new_with_label("Internal"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_NORMAL); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_NORMAL) && !driver) driver = i; - i++; - - opt = gtk_menu_item_new_with_label("Command"); - gtk_signal_connect(GTK_OBJECT(opt), "activate", - GTK_SIGNAL_FUNC(set_sound_driver), - (gpointer)OPT_SOUND_CMD); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if ((sound_options & OPT_SOUND_CMD) && !driver) driver = i; - i++; - - gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), driver - 1); - gtk_box_pack_start(GTK_BOX(hbox), omenu, FALSE, FALSE, 5); - gtk_widget_show_all(omenu); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Sound command\n(%s for filename)")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - sndcmd = gtk_entry_new(); - gtk_entry_set_editable(GTK_ENTRY(sndcmd), TRUE); - gtk_entry_set_text(GTK_ENTRY(sndcmd), sound_cmd); - gtk_box_pack_end(GTK_BOX(hbox), sndcmd, FALSE, FALSE, 5); - gtk_signal_connect(GTK_OBJECT(sndcmd), "focus_out_event", GTK_SIGNAL_FUNC(sound_cmd_yeah), NULL); - gtk_widget_set_sensitive(sndcmd, (OPT_SOUND_CMD & sound_options)); - gtk_widget_show(sndcmd); - - frame = gtk_frame_new(_("Sound played when:")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - - for (j=0; sound_order[j] != SND_END; j++) { - if (sound_order[j] == SND_SEPARATOR) { - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 5); - gtk_widget_show(sep); - } else { - /* no entry for sounds without an option */ - if (sounds[sound_order[j]].opt == 0) - continue; - sound_entry(vbox, sound_order[j]); - } - } - - gtk_widget_show(prefdialog); -} - -static struct away_message *cur_message; -static GtkWidget *away_text; -static GtkWidget *make_away_button = NULL; - -void away_list_clicked(GtkWidget *widget, struct away_message *a) -{ + GtkTreeIter iter; + GValue val = { 0, }; + gchar *message; gchar buffer[BUF_LONG]; char *tmp; - cur_message = a; - - /* Clear the Box */ + if (! gtk_tree_selection_get_selected (sel, &model, &iter)) + return; + gtk_tree_model_get_value (model, &iter, 1, &val); + message = g_value_get_string(&val); gtk_imhtml_clear(GTK_IMHTML(away_text)); - - /* Fill the text box with new message */ - strcpy(buffer, a->message); + strcpy(buffer, message); tmp = stylize(buffer, BUF_LONG); gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); g_free(tmp); -} - -void remove_away_message(GtkWidget *widget, void *dummy) -{ - GList *i; - struct away_message *a; - - i = GTK_LIST(prefs_away_list)->selection; - - if (!i) - return; - if (!i->next) { - gtk_imhtml_clear(GTK_IMHTML(away_text)); - } - a = gtk_object_get_user_data(GTK_OBJECT(i->data)); - rem_away_mess(NULL, a); + g_value_unset (&val); + } -static void paldest(GtkWidget *m, gpointer n) -{ - gtk_widget_destroy(prefs_away_list); - prefs_away_list = NULL; - prefs_away_menu = NULL; - make_away_button = NULL; -} - -static void do_away_mess(GtkWidget *m, gpointer n) -{ - GList *i = GTK_LIST(prefs_away_list)->selection; - if (i) - do_away_message(NULL, gtk_object_get_user_data(GTK_OBJECT(i->data))); -} - -void set_default_away(GtkWidget *w, gpointer i) -{ - int length = g_slist_length(away_messages); - - if (away_messages == NULL) - default_away = NULL; - else if ((int)i >= length) - default_away = g_slist_nth_data(away_messages, length - 1); - else - default_away = g_slist_nth_data(away_messages, (int)i); +void remove_away_message(GtkWidget *widget, GtkTreeView *tv) { + struct away_message *am; + GtkTreeIter iter; + GtkTreePath *path; + GtkTreeStore *ts = GTK_TREE_STORE(gtk_tree_view_get_model(tv)); + GtkTreeSelection *sel = gtk_tree_view_get_selection(tv); + GValue val = { 0, }; + + if (! gtk_tree_selection_get_selected (sel, &prefs_away_store, &iter)) + return; + gtk_tree_model_get_value (prefs_away_store, &iter, 2, &val); + am = g_value_get_pointer (&val); + gtk_imhtml_clear(GTK_IMHTML(away_text)); + rem_away_mess(NULL, am); + gtk_list_store_remove(ts, &iter); + path = gtk_tree_path_new_first(); + gtk_tree_selection_select_path(sel, path); } -void default_away_menu_init(GtkWidget *omenu) -{ - GtkWidget *menu, *opt; - int index = 0; - GSList *awy = away_messages; - struct away_message *a; - - menu = gtk_menu_new(); - - while (awy) { - a = (struct away_message *)awy->data; - opt = gtk_menu_item_new_with_label(a->name); - gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_default_away), - (gpointer)index); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - - awy = awy->next; - index++; - } +#else +void away_message_sel(GtkWidget *w, GtkWidget *list) {} +void remove_away_message(GtkWidget *widget, GtkWidget *list) {} +#endif - gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); - gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), g_slist_index(away_messages, default_away)); -} - -static void away_page() -{ - GtkWidget *parent; - GtkWidget *box; - GtkWidget *label; +GtkWidget *away_message_page() { + GtkWidget *ret; GtkWidget *frame; - GtkWidget *vbox; - GtkWidget *hbox; - GtkWidget *vbox2; - GtkWidget *button; - GtkWidget *button2; - GtkWidget *top; - GtkWidget *bot; + GtkWidget *vbox, *hbox, *bbox; + GtkWidget *button, *image, *label; GtkWidget *sw; - GtkWidget *sw2; - GtkWidget *list_item; - GtkWidget *sep; - GtkObject *adjust; - GtkWidget *spin; + +#if GTK_CHECK_VERSION(1,3,0) + GtkTreeIter iter; + GtkWidget *event_view; + GtkCellRenderer *rend; + GtkTreeViewColumn *col; + GtkTreeSelection *sel; + GtkTreePath *path; +#else + GtkWidget *list; +#endif GSList *awy = away_messages; struct away_message *a; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - prefdialog = gtk_frame_new(_("Away Messages")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - frame = gtk_frame_new(_("Options")); - gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - vbox2 = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); + GtkWidget *sw2; + + ret = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (ret), 6); - gaim_button(_("Ignore new conversations when away"), &away_options, OPT_AWAY_DISCARD, vbox2); - gaim_button(_("Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox2); - gaim_button(_("Sending messages removes away status"), &away_options, OPT_AWAY_BACK_ON_IM, - vbox2); - - vbox2 = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox2, TRUE, TRUE, 5); - gtk_widget_show(vbox2); - - button = gaim_button(_("Don't send auto-response"), &away_options, OPT_AWAY_NO_AUTO_RESP, vbox2); - button2 = gaim_button(_("Only send auto-response when idle"), &away_options, OPT_AWAY_IDLE_RESP, - vbox2); - if (away_options & OPT_AWAY_NO_AUTO_RESP) - gtk_widget_set_sensitive(button2, FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), button2); - gaim_button(_("Queue new messages when away"), &away_options, OPT_AWAY_QUEUE, vbox2); + frame = gtk_frame_new ("Title"); + gtk_box_pack_start (GTK_BOX (ret), frame, TRUE, TRUE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + sw = gtk_scrolled_window_new(NULL,NULL); + away_text = gtk_imhtml_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); + +#if GTK_CHECK_VERSION(1,3,0) + prefs_away_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); + while (awy) { + a = (struct away_message *)awy->data; + gtk_list_store_append (prefs_away_store, &iter); + gtk_list_store_set(prefs_away_store, &iter, + 0, a->name, + 1, a->message, + 2, a, -1); + awy = awy->next; + } + event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store)); - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - gaim_labeled_spin_button(hbox, _("Time between sending auto-responses (in seconds):"), - &away_resend, 1, 24 * 60 * 60); - - if (away_options & OPT_AWAY_NO_AUTO_RESP) - gtk_widget_set_sensitive(hbox, FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), hbox); - - sep = gtk_hseparator_new(); - gtk_box_pack_start(GTK_BOX(vbox), sep, FALSE, FALSE, 0); - gtk_widget_show(sep); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - button = gaim_button(_("Auto Away after"), &away_options, OPT_AWAY_AUTO, hbox); - - adjust = gtk_adjustment_new(auto_away, 1, 1440, 1, 10, 10); - spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); - gtk_widget_set_usize(spin, 50, -1); - gtk_object_set_user_data(GTK_OBJECT(spin), &auto_away); - if (!(away_options & OPT_AWAY_AUTO)) - gtk_widget_set_sensitive(GTK_WIDGET(spin), FALSE); - gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), spin); - gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", GTK_SIGNAL_FUNC(update_spin_value), - GTK_WIDGET(spin)); - gtk_widget_show(spin); - - label = gtk_label_new(_("minutes using")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - prefs_away_menu = gtk_option_menu_new(); - gtk_box_pack_start(GTK_BOX(hbox), prefs_away_menu, FALSE, FALSE, 0); - default_away_menu_init(prefs_away_menu); - if (!(away_options & OPT_AWAY_AUTO)) - gtk_widget_set_sensitive(GTK_WIDGET(prefs_away_menu), FALSE); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_sensitive), - prefs_away_menu); - gtk_widget_show(prefs_away_menu); + rend = gtk_cell_renderer_text_new(); + col = gtk_tree_view_column_new_with_attributes ("NULL", + rend, + "text", 0, + NULL); + gtk_tree_view_append_column (GTK_TREE_VIEW(event_view), col); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(event_view), FALSE); + gtk_widget_show(event_view); + gtk_container_add(GTK_CONTAINER(sw), event_view); +#else + list = gtk_clist_new(1); + while (awy) { + char *msg; + a = (struct away_message *)awy->data; + msg = a->name; + gtk_clist_append(GTK_CLIST(list), &msg); + awy = awy->next; + } + gtk_widget_show(list); + gtk_container_add(GTK_CONTAINER(sw), list); +#endif - frame = gtk_frame_new(_("Messages")); - gtk_box_pack_start(GTK_BOX(box), frame, TRUE, TRUE, 5); - gtk_widget_show(frame); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(frame), vbox); - gtk_widget_show(vbox); - - hbox = gtk_hbox_new(TRUE, 0); - gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 5); - gtk_widget_show(hbox); - - label = gtk_label_new(_("Title")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); + gtk_widget_show (vbox); + gtk_widget_show (sw); + - label = gtk_label_new(_("Message")); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - top = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), top, TRUE, TRUE, 0); - gtk_widget_show(top); - - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(top), sw, TRUE, TRUE, 0); - gtk_widget_set_usize(sw, -1, 225); - gtk_widget_show(sw); - - prefs_away_list = gtk_list_new(); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), prefs_away_list); - gtk_signal_connect(GTK_OBJECT(prefs_away_list), "destroy", GTK_SIGNAL_FUNC(paldest), 0); - gtk_widget_show(prefs_away_list); - + frame = gtk_frame_new ("Message"); + gtk_box_pack_start (GTK_BOX (ret), frame, TRUE, TRUE, 0); + gtk_widget_show (frame); + vbox = gtk_vbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (frame), vbox); + sw2 = gtk_scrolled_window_new(NULL, NULL); gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw2), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); - gtk_box_pack_start(GTK_BOX(top), sw2, TRUE, TRUE, 0); + gtk_box_pack_start(GTK_BOX(vbox), sw2, TRUE, TRUE, 0); gtk_widget_show(sw2); - - away_text = gtk_imhtml_new(NULL, NULL); + gtk_container_add(GTK_CONTAINER(sw2), away_text); GTK_LAYOUT(away_text)->hadjustment->step_increment = 10.0; GTK_LAYOUT(away_text)->vadjustment->step_increment = 10.0; gaim_setup_imhtml(away_text); gtk_widget_show(away_text); - - bot = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(vbox), bot, FALSE, FALSE, 5); - gtk_widget_show(bot); - + gtk_widget_show (vbox); + gtk_widget_show (ret); + gtk_imhtml_set_defaults(GTK_IMHTML(away_text), NULL, NULL, NULL); +#if GTK_CHECK_VERSION(1,3,0) + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (event_view)); + path = gtk_tree_path_new_first(); + g_signal_connect (G_OBJECT (sel), "changed", + G_CALLBACK (away_message_sel), + NULL); +#else + gtk_signal_connect(GTK_OBJECT(list), "changed", GTK_SIGNAL_FUNC(away_message_sel), NULL); +#endif + hbox = gtk_hbox_new(TRUE, 5); + gtk_widget_show(hbox); + gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); +#if GTK_CHECK_VERSION (1,3,0) + button = gtk_button_new_from_stock (GTK_STOCK_ADD); +#else button = picture_button(prefs, _("Add"), gnome_add_xpm); +#endif + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), NULL); - gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); - + +#if GTK_CHECK_VERSION (1,3,0) + button = gtk_button_new_from_stock (GTK_STOCK_REMOVE); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), event_view); +#else + button = picture_button(prefs, _("Remove"), gnome_remove_xpm); + //gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view); +#endif + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); + +#if GTK_CHECK_VERSION (1,3,0) + button = pixbuf_button(_("_Edit"), "edit.png"); +#else button = picture_button(prefs, _("Edit"), save_xpm); gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), button); - gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); - - make_away_button = picture_button(prefs, _("Make Away"), gnome_preferences_xpm); - gtk_signal_connect(GTK_OBJECT(make_away_button), "clicked", GTK_SIGNAL_FUNC(do_away_mess), NULL); - gtk_box_pack_start(GTK_BOX(bot), make_away_button, TRUE, FALSE, 5); - if (!connections) - gtk_widget_set_sensitive(make_away_button, FALSE); - - button = picture_button(prefs, _("Remove"), gnome_remove_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), NULL); - gtk_box_pack_start(GTK_BOX(bot), button, TRUE, FALSE, 5); - - if (awy != NULL) { - char buffer[BUF_LONG]; - char *tmp; - a = (struct away_message *)awy->data; - g_snprintf(buffer, sizeof(buffer), "%s", a->message); - tmp = stylize(buffer, BUF_LONG); - gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE | - GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); - gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE | - GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL); - g_free(tmp); - } - - while (awy) { - a = (struct away_message *)awy->data; - list_item = gtk_list_item_new(); - gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item); - gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_list_clicked), - a); - gtk_object_set_user_data(GTK_OBJECT(list_item), a); - gtk_widget_show(list_item); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(list_item), hbox); - gtk_widget_show(hbox); - - label = gtk_label_new(a->name); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); +#endif + gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); + + return ret; +} +#if GTK_CHECK_VERSION (1,3,0) +GtkTreeIter *prefs_notebook_add_page(char *text, + GdkPixbuf *pixbuf, + GtkWidget *page, + GtkTreeIter *iter, + GtkTreeIter *parent, + int ind) { + GdkPixbuf *icon = NULL; + + if (pixbuf) + icon = gdk_pixbuf_scale_simple (pixbuf, 18, 18, GDK_INTERP_BILINEAR); - awy = awy->next; - } - if (away_messages != NULL) - gtk_list_select_item(GTK_LIST(prefs_away_list), 0); - - gtk_widget_show(prefdialog); + gtk_tree_store_append (prefstree, iter, parent); + gtk_tree_store_set (prefstree, iter, 0, icon, 1, text, 2, ind, -1); + + if (pixbuf) + g_object_unref(pixbuf); + if (icon) + g_object_unref(icon); + gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); + return iter; } - -static GtkWidget *deny_type = NULL; -static GtkWidget *deny_conn_hbox = NULL; -static GtkWidget *deny_opt_menu = NULL; -static struct gaim_connection *current_deny_gc = NULL; -static gboolean current_is_deny = FALSE; -static GtkWidget *allow_list = NULL; -static GtkWidget *block_list = NULL; - -static void set_deny_mode(GtkWidget *w, int data) -{ - if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) - return; - debug_printf("setting deny mode %d\n", data); - current_deny_gc->permdeny = data; - serv_set_permit_deny(current_deny_gc); - do_export(current_deny_gc); -} - -static GtkWidget *deny_opt(char *label, int which, GtkWidget *box, GtkWidget *set) -{ - GtkWidget *opt; - - if (!set) - opt = gtk_radio_button_new_with_label(NULL, label); - else - opt = - gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), - label); - gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(opt), "toggled", GTK_SIGNAL_FUNC(set_deny_mode), (void *)which); - gtk_widget_show(opt); - if (current_deny_gc->permdeny == which) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); - - return opt; -} +#else +GtkCTreeNode *prefs_notebook_add_page(char *text, + GdkPixmap *pixmap, + GtkWidget *page, + GtkCTreeNode **iter, + GtkCTreeNode **parent, + int ind) { -static void des_deny_opt(GtkWidget *d, gpointer e) -{ - gtk_widget_destroy(d); - current_deny_gc = NULL; - deny_conn_hbox = NULL; - deny_type = NULL; - deny_opt_menu = NULL; - current_is_deny = FALSE; - allow_list = NULL; - block_list = NULL; -} + GtkCTreeNode *itern; + char *texts[1]; -static void set_deny_type() -{ - GSList *bg = gtk_radio_button_group(GTK_RADIO_BUTTON(deny_type)); + texts[0] = text; - switch (current_deny_gc->permdeny) { - case 4: - break; - case 3: - bg = bg->next->next; - break; - case 2: - bg = bg->next; - break; - case 1: - bg = bg->next->next->next; - break; - } + *iter = gtk_ctree_insert_node (GTK_CTREE(prefstree), parent ? *parent : NULL, NULL, &text, + 0, NULL, NULL, NULL, NULL, 0, 1); + gtk_ctree_node_set_row_data(GTK_CTREE(prefstree), GTK_CTREE_NODE(*iter), (void *)ind); + if (pixmap) + gdk_pixmap_unref(pixmap); + + debug_printf("%s\n", texts[0]); - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(bg->data), TRUE); + gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); + return iter; } - -void build_allow_list() -{ - GtkWidget *label; - GtkWidget *list_item; - GSList *p; - - if (!current_is_deny) - return; - - p = current_deny_gc->permit; +#endif - gtk_list_remove_items(GTK_LIST(allow_list), GTK_LIST(allow_list)->children); - - while (p) { - label = gtk_label_new(p->data); - list_item = gtk_list_item_new(); - gtk_container_add(GTK_CONTAINER(list_item), label); - gtk_object_set_user_data(GTK_OBJECT(list_item), p->data); - gtk_widget_show(label); - gtk_container_add(GTK_CONTAINER(allow_list), list_item); - gtk_widget_show(list_item); - p = p->next; - } -} - -void build_block_list() -{ - GtkWidget *label; - GtkWidget *list_item; - GSList *d; - - if (!current_is_deny) - return; +void prefs_notebook_init() { + int a = 0; +#if GTK_CHECK_VERSION(1,3,0) + GtkTreeIter p, c; +#else + GtkCTreeNode *p = NULL; + GtkCTreeNode *c = NULL; +#endif + prefs_notebook_add_page("Interface", NULL, interface_page(), &p, NULL, a++); + prefs_notebook_add_page("Fonts", NULL, font_page(), &c, &p, a++); + prefs_notebook_add_page("Messages", NULL, messages_page(), &c, &p, a++); + prefs_notebook_add_page("Shortcuts", NULL, hotkeys_page(), &c, &p, a++); + prefs_notebook_add_page("Buddy List", NULL, list_page(), &c, &p, a++); + prefs_notebook_add_page("IM", NULL, im_page(), &c, &p, a++); + prefs_notebook_add_page("Chat", NULL, chat_page(), &c, &p, a++); + prefs_notebook_add_page("Tabs", NULL, tab_page(), &c, &p, a++); + prefs_notebook_add_page("Proxy", NULL, proxy_page(), &p, NULL, a++); + prefs_notebook_add_page("Browser", NULL, browser_page(), &p, NULL, a++); - d = current_deny_gc->deny; - - gtk_list_remove_items(GTK_LIST(block_list), GTK_LIST(block_list)->children); - - while (d) { - label = gtk_label_new(d->data); - list_item = gtk_list_item_new(); - gtk_container_add(GTK_CONTAINER(list_item), label); - gtk_object_set_user_data(GTK_OBJECT(list_item), d->data); - gtk_widget_show(label); - gtk_container_add(GTK_CONTAINER(block_list), list_item); - gtk_widget_show(list_item); - d = d->next; - } -} - -static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc) -{ - current_deny_gc = gc; - set_deny_type(); - build_allow_list(); - build_block_list(); + prefs_notebook_add_page("Logging", NULL, logging_page(), &p, NULL, a++); + prefs_notebook_add_page("Sounds", NULL, sound_page(), &p, NULL, a++); + prefs_notebook_add_page("Sound Events", NULL, sound_events_page(), &c, &p, a++); + prefs_notebook_add_page("Away / Idle", NULL, away_page(), &p, NULL, a++); + prefs_notebook_add_page("Away Messages", NULL, away_message_page(), &c, &p, a++); } -static void build_deny_menu() +void show_prefs() { - GtkWidget *menu; - GtkWidget *opt; - GSList *c = connections; - struct gaim_connection *gc; - int count = 0; - gboolean found = FALSE; - char buf[2048]; - - if (g_slist_length(connections) == 1) { - gtk_widget_hide(deny_conn_hbox); - return; - } else - gtk_widget_show(deny_conn_hbox); - - menu = gtk_menu_new(); - - while (c) { - gc = (struct gaim_connection *)c->data; - c = c->next; - if (!gc->prpl->set_permit_deny) - continue; - g_snprintf(buf, sizeof buf, "%s (%s)", gc->username, gc->prpl->name()); - opt = gtk_menu_item_new_with_label(buf); - gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(deny_gc_opt), gc); - gtk_widget_show(opt); - gtk_menu_append(GTK_MENU(menu), opt); - if (gc == current_deny_gc) - found = TRUE; - else if (!found) - count++; - } - - if (!found) { - current_deny_gc = connections->data; - count = 0; - } - - gtk_option_menu_remove_menu(GTK_OPTION_MENU(deny_opt_menu)); - gtk_option_menu_set_menu(GTK_OPTION_MENU(deny_opt_menu), menu); - gtk_option_menu_set_history(GTK_OPTION_MENU(deny_opt_menu), count); - - gtk_widget_show(menu); - gtk_widget_show(deny_opt_menu); -} - -static void pref_deny_add(GtkWidget *button, gboolean permit) -{ - show_add_perm(current_deny_gc, NULL, permit); -} - -static void pref_deny_rem(GtkWidget *button, gboolean permit) -{ - GList *i; - char *who; - - if (permit && !allow_list) - return; - if (!permit && !block_list) - return; - - if (permit) - i = GTK_LIST(allow_list)->selection; - else - i = GTK_LIST(block_list)->selection; - - if (!i) - return; - who = gtk_object_get_user_data(GTK_OBJECT(i->data)); - if (permit) { - current_deny_gc->permit = g_slist_remove(current_deny_gc->permit, who); - serv_rem_permit(current_deny_gc, who); - build_allow_list(); - } else { - current_deny_gc->deny = g_slist_remove(current_deny_gc->deny, who); - serv_rem_deny(current_deny_gc, who); - build_block_list(); - } - - do_export(current_deny_gc); -} - -static void deny_page() -{ - GtkWidget *parent; - GtkWidget *box; + GtkWidget *vbox, *vbox2; GtkWidget *hbox; - GtkWidget *label; - GtkWidget *vbox; - GtkWidget *sw; - GtkWidget *bbox; + GtkWidget *frame; +#if GTK_CHECK_VERSION (1,3,0) + GtkWidget *tree_v; + GtkTreeViewColumn *column; + GtkCellRenderer *cell; + GtkTreeSelection *sel; +#endif + GtkWidget *notebook; + GtkWidget *sep; GtkWidget *button; - - parent = prefdialog->parent; - gtk_widget_destroy(prefdialog); - - current_deny_gc = connections->data; /* this is safe because this screen will only be - available when there are connections */ - current_is_deny = TRUE; - - prefdialog = gtk_frame_new(_("Privacy Options")); - gtk_container_add(GTK_CONTAINER(parent), prefdialog); - - box = gtk_vbox_new(FALSE, 5); - gtk_container_set_border_width(GTK_CONTAINER(box), 5); - gtk_container_add(GTK_CONTAINER(prefdialog), box); - gtk_widget_show(box); - - label = gtk_label_new(_("All options take effect immediately unless otherwise noted.")); - gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - deny_conn_hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), deny_conn_hbox, FALSE, FALSE, 0); - gtk_widget_show(deny_conn_hbox); - - label = gtk_label_new(_("Set privacy for:")); - gtk_box_pack_start(GTK_BOX(deny_conn_hbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - deny_opt_menu = gtk_option_menu_new(); - gtk_box_pack_start(GTK_BOX(deny_conn_hbox), deny_opt_menu, FALSE, FALSE, 5); - gtk_signal_connect(GTK_OBJECT(deny_opt_menu), "destroy", GTK_SIGNAL_FUNC(des_deny_opt), NULL); - gtk_widget_show(deny_opt_menu); - - build_deny_menu(); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 5); - gtk_widget_show(hbox); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - deny_type = deny_opt(_("Allow all users to contact me"), 1, vbox, NULL); - deny_type = deny_opt(_("Allow only the users below"), 3, vbox, deny_type); - - label = gtk_label_new(_("Allow List")); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); - gtk_widget_show(sw); - - allow_list = gtk_list_new(); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), allow_list); - gtk_widget_show(allow_list); - - build_allow_list(); - - bbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); - gtk_widget_show(bbox); - - button = picture_button(prefs, _("Add"), gnome_add_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_add), (void *)TRUE); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); - - button = picture_button(prefs, _("Remove"), gnome_remove_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_rem), (void *)TRUE); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); - - vbox = gtk_vbox_new(FALSE, 5); - gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); - gtk_widget_show(vbox); - - deny_type = deny_opt(_("Deny all users"), 2, vbox, deny_type); - deny_type = deny_opt(_("Block the users below"), 4, vbox, deny_type); - - label = gtk_label_new(_("Block List")); - gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); - gtk_widget_show(label); - - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); - gtk_widget_show(sw); - - block_list = gtk_list_new(); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), block_list); - gtk_widget_show(block_list); - - build_block_list(); - - bbox = gtk_hbox_new(TRUE, 5); - gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); - gtk_widget_show(bbox); - - button = picture_button(prefs, _("Add"), gnome_add_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_add), FALSE); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); - - button = picture_button(prefs, _("Remove"), gnome_remove_xpm); - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_rem), FALSE); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); - - gtk_widget_show(prefdialog); -} - -void update_connection_dependent_prefs() -{ /* what a crappy name */ - gboolean needdeny = FALSE; - GSList *c = connections; - struct gaim_connection *gc = NULL; - - if (!prefs) - return; - - while (c) { - gc = c->data; - if (gc->prpl->set_permit_deny) - break; - gc = NULL; - c = c->next; - } - needdeny = (gc != NULL); - - if (!needdeny && deny_node) { - if (current_is_deny) - gtk_ctree_select(GTK_CTREE(preftree), general_node); - gtk_ctree_remove_node(GTK_CTREE(preftree), deny_node); - deny_node = NULL; - } else if (deny_node && current_is_deny) { - build_deny_menu(); - build_allow_list(); - build_block_list(); - } else if (needdeny && !deny_node) { - prefs_build_deny(); - } - - if (make_away_button) { - if (connections) - gtk_widget_set_sensitive(make_away_button, TRUE); - else - gtk_widget_set_sensitive(make_away_button, FALSE); - } -} - -static void try_me(GtkCTree *ctree, GtkCTreeNode *node) -{ - /* this is a hack */ - void (*func)(); - func = gtk_ctree_node_get_row_data(ctree, node); - func(); -} - -void show_prefs() -{ - GtkWidget *vbox; - GtkWidget *hpaned; - /* GtkWidget *scroll; */ - GtkWidget *container; - GtkWidget *hbox; - GtkWidget *close; + + int r; if (prefs) { gtk_widget_show(prefs); return; } + /* copy the preferences to tmp values... + * I liked "take affect immediately" Oh well :-( */ + misc_options_new = misc_options; + logging_options_new = logging_options; + blist_options_new = blist_options; + convo_options_new = convo_options; + im_options_new = im_options; + chat_options_new = chat_options; + font_options_new = font_options; + sound_options_new = sound_options; + for (r = 0; r < NUM_SOUNDS; r++) + sound_file_new[r] = g_strdup(sound_file[r]); + away_options_new = away_options; + away_resend_new = away_resend; + report_idle_new = report_idle; + auto_away_new = auto_away; + default_away_new = default_away; + fontsize_new = fontsize; + web_browser_new = web_browser; + proxytype_new = proxytype; + g_snprintf(sound_cmd_new, sizeof(sound_cmd_new), "%s", sound_cmd); + g_snprintf(web_command_new, sizeof(web_command_new), "%s", web_command); + g_snprintf(fontface_new, sizeof(fontface_new), fontface); +#if !GTK_CHECK_VERSION(1,3,0) + g_snprintf(fontxfld_new, sizeof(fontxfld_new), fontxfld); +#endif + memcpy(&conv_size_new, &conv_size, sizeof(struct window_size)); + memcpy(&buddy_chat_size_new, &buddy_chat_size, sizeof(struct window_size)); + memcpy(&fgcolor_new, &fgcolor, sizeof(GdkColor)); + memcpy(&bgcolor_new, &bgcolor, sizeof(GdkColor)); + + /* Create the window */ prefs = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_wmclass(GTK_WINDOW(prefs), "preferences", "Gaim"); gtk_widget_realize(prefs); aol_icon(prefs->window); gtk_window_set_title(GTK_WINDOW(prefs), _("Gaim - Preferences")); - gtk_widget_set_usize(prefs, 725, 620); + gtk_window_set_policy (GTK_WINDOW(prefs), FALSE, FALSE, TRUE); gtk_signal_connect(GTK_OBJECT(prefs), "destroy", GTK_SIGNAL_FUNC(delete_prefs), NULL); vbox = gtk_vbox_new(FALSE, 5); @@ -2499,56 +1687,129 @@ gtk_container_add(GTK_CONTAINER(prefs), vbox); gtk_widget_show(vbox); - hpaned = gtk_hpaned_new(); - gtk_box_pack_start(GTK_BOX(vbox), hpaned, TRUE, TRUE, 0); - gtk_widget_show(hpaned); + hbox = gtk_hbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); + gtk_container_add (GTK_CONTAINER(vbox), hbox); + gtk_widget_show (hbox); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0); + gtk_widget_show (frame); + + /* The tree -- much inspired by the Gimp */ +#if GTK_CHECK_VERSION(1,3,0) + prefstree = gtk_tree_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); + tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (prefstree)); + gtk_container_add (GTK_CONTAINER (frame), tree_v); + + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (tree_v), FALSE); + gtk_widget_show(tree_v); + /* icons */ + cell = gtk_cell_renderer_pixbuf_new (); + column = gtk_tree_view_column_new_with_attributes ("icons", cell, "pixbuf", 0, NULL); + + /* text */ + cell = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("text", cell, "text", 1, NULL); + + gtk_tree_view_append_column (GTK_TREE_VIEW (tree_v), column); - /* - scroll = gtk_scrolled_window_new(NULL, NULL); - gtk_paned_pack1(GTK_PANED(hpaned), scroll, FALSE, FALSE); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER, GTK_POLICY_NEVER); - gtk_widget_set_usize(scroll, 125, -1); - gtk_widget_show(scroll); - */ +#else + prefstree = gtk_ctree_new(1,0); + gtk_ctree_set_line_style(prefstree, GTK_CTREE_LINES_NONE); + gtk_ctree_set_expander_style(GTK_CTREE(prefstree), GTK_CTREE_EXPANDER_TRIANGLE); + gtk_container_add(GTK_CONTAINER (frame), prefstree); + gtk_widget_set_usize(prefstree, 150, -1); + gtk_widget_show(prefstree); +#endif /* GTK_CHECK_VERSION */ - preftree = gtk_ctree_new(1, 0); - gtk_ctree_set_line_style(GTK_CTREE(preftree), GTK_CTREE_LINES_SOLID); - gtk_ctree_set_expander_style(GTK_CTREE(preftree), GTK_CTREE_EXPANDER_TRIANGLE); - gtk_clist_set_reorderable(GTK_CLIST(preftree), FALSE); - /* gtk_container_add(GTK_CONTAINER(scroll), preftree); */ - gtk_paned_pack1(GTK_PANED(hpaned), preftree, FALSE, FALSE); - gtk_signal_connect(GTK_OBJECT(preftree), "tree_select_row", GTK_SIGNAL_FUNC(try_me), NULL); - gtk_widget_set_usize(preftree, 125, -1); - gtk_widget_show(preftree); + /* The right side */ + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0); + gtk_widget_show (frame); + + vbox2 = gtk_vbox_new (FALSE, 4); + gtk_container_add (GTK_CONTAINER (frame), vbox2); + gtk_widget_show (vbox2); + + frame = gtk_frame_new (NULL); + gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT); + gtk_box_pack_start (GTK_BOX (vbox2), frame, FALSE, TRUE, 0); + gtk_widget_show (frame); + + hbox = gtk_hbox_new (FALSE, 4); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 4); + gtk_container_add (GTK_CONTAINER (frame), hbox); + gtk_widget_show (hbox); + + preflabel = gtk_label_new(NULL); + gtk_box_pack_end (GTK_BOX (hbox), preflabel, FALSE, FALSE, 0); + gtk_widget_show (preflabel); - container = gtk_frame_new(NULL); - gtk_container_set_border_width(GTK_CONTAINER(container), 0); - gtk_frame_set_shadow_type(GTK_FRAME(container), GTK_SHADOW_NONE); - gtk_paned_pack2(GTK_PANED(hpaned), container, TRUE, TRUE); - gtk_widget_show(container); - - prefdialog = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(container), prefdialog); - gtk_widget_show(prefdialog); + + /* The notebook */ + prefsnotebook = notebook = gtk_notebook_new (); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE); + gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE); + gtk_box_pack_start (GTK_BOX (vbox2), notebook, FALSE, FALSE, 0); - prefs_build_general(); - prefs_build_buddy(); - prefs_build_convo(); - prefs_build_sound(); - prefs_build_away(); - prefs_build_deny(); - - /* general_page(); */ +#if GTK_CHECK_VERSION(1,3,0) + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_v)); + g_signal_connect (G_OBJECT (sel), "changed", + G_CALLBACK (pref_nb_select), + notebook); +#else + gtk_signal_connect(GTK_OBJECT(prefstree), "tree-select-row", GTK_SIGNAL_FUNC(pref_nb_select), notebook); +#endif + gtk_widget_show(notebook); + sep = gtk_hseparator_new(); + gtk_widget_show(sep); + gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0); + + /* The buttons to press! */ + hbox = gtk_hbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 6); + gtk_container_add (GTK_CONTAINER(vbox), hbox); + gtk_widget_show (hbox); +#if GTK_CHECK_VERSION(1,3,0) + button = gtk_button_new_from_stock (GTK_STOCK_CANCEL); +#else + button = picture_button(prefs, _("Close"), cancel_xpm); +#endif + gtk_signal_connect_object(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), prefs); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); +#if GTK_CHECK_VERSION(1,3,0) + button = gtk_button_new_from_stock (GTK_STOCK_APPLY); +#else + button = picture_button(prefs, _("Apply"), ok_xpm); +#endif + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(apply_cb), prefs); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); + +#if GTK_CHECK_VERSION(1,3,0) + button = gtk_button_new_from_stock (GTK_STOCK_OK); +#else + button = picture_button(prefs, _("OK"), join_xpm); +#endif + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(ok_cb), prefs); + gtk_box_pack_end(GTK_BOX(hbox), button, FALSE, FALSE, 0); + if (misc_options & OPT_MISC_COOL_LOOK) + gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE); + gtk_widget_show(button); - hbox = gtk_hbox_new(FALSE, 5); - gtk_box_pack_end(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); - gtk_widget_show(hbox); - - close = picture_button(prefs, _("Close"), cancel_xpm); - gtk_box_pack_end(GTK_BOX(hbox), close, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL); - - gtk_widget_show(prefs); + prefs_notebook_init(); +#if GTK_CHECK_VERSION(1,3,0) + gtk_tree_view_expand_all (GTK_TREE_VIEW(tree_v)); +#endif + gtk_widget_show(prefs); } static gint debug_delete(GtkWidget *w, GdkEvent *event, void *dummy) @@ -2635,34 +1896,12 @@ g_print("%s", s); g_free(s); } - -static gint handle_delete(GtkWidget *w, GdkEvent *event, void *dummy) -{ - save_prefs(); - - if (event == NULL) - gtk_widget_destroy(prefs); - prefs = NULL; - prefdialog = NULL; - debugbutton = NULL; - prefs_away_menu = NULL; + - return FALSE; -} - -static void delete_prefs(GtkWidget *w, void *data) -{ - if (prefs) { - save_prefs(); - gtk_widget_destroy(prefs); - } - prefs = NULL; - prefs_away_menu = NULL; - deny_node = NULL; - current_deny_gc = NULL; -} + + void set_option(GtkWidget *w, int *option) { *option = !(*option); @@ -2681,130 +1920,142 @@ save_prefs(); } -static void set_logging_option(GtkWidget *w, int option) + +/* Functions for each _options variable that sees what's changed, and makes + * effective those changes that take place immediately (UI stuff) */ +static void set_misc_options() { - logging_options ^= option; + +/* int option = misc_options ^ misc_options_new; */ + misc_options = misc_options_new; + +} - if (option == OPT_LOG_ALL) +static void set_logging_options() +{ + int option = logging_options ^ logging_options_new; + logging_options = logging_options_new; + + if (option & OPT_LOG_ALL) update_log_convs(); - save_prefs(); } -static void set_blist_option(GtkWidget *w, int option) +static void set_blist_options() { - blist_options ^= option; - - save_prefs(); + int option = blist_options ^ blist_options_new; + blist_options = blist_options_new; if (!blist) return; + + if (option & OPT_BLIST_BOTTOM_TAB) + set_blist_tab(); - if (option == OPT_BLIST_NO_BUTTONS) + if (option & OPT_BLIST_NO_BUTTONS) build_imchat_box(!(blist_options & OPT_BLIST_NO_BUTTONS)); - if (option == OPT_BLIST_SHOW_GRPNUM) + if (option & OPT_BLIST_SHOW_GRPNUM) update_num_groups(); - if (option == OPT_BLIST_NO_MT_GRP) + if (option & OPT_BLIST_NO_MT_GRP) toggle_show_empty_groups(); - if ((option == OPT_BLIST_SHOW_BUTTON_XPM) || (option == OPT_BLIST_NO_BUTTONS)) + if ((option & OPT_BLIST_SHOW_BUTTON_XPM) || (option & OPT_BLIST_NO_BUTTONS)) update_button_pix(); - if (option == OPT_BLIST_SHOW_PIXMAPS) + if (option & OPT_BLIST_SHOW_PIXMAPS) toggle_buddy_pixmaps(); - if ((option == OPT_BLIST_GREY_IDLERS) || (option == OPT_BLIST_SHOW_IDLETIME)) + if ((option & OPT_BLIST_GREY_IDLERS) || (option & OPT_BLIST_SHOW_IDLETIME)) update_idle_times(); } -static void set_convo_option(GtkWidget *w, int option) +static void set_convo_options() { - convo_options ^= option; - - if (option == OPT_CONVO_SHOW_SMILEY) + int option = convo_options ^ convo_options_new; + convo_options = convo_options_new; + + if (option & OPT_CONVO_SHOW_SMILEY) toggle_smileys(); - if (option == OPT_CONVO_SHOW_TIME) + if (option & OPT_CONVO_SHOW_TIME) toggle_timestamps(); - if (option == OPT_CONVO_CHECK_SPELLING) + if (option & OPT_CONVO_CHECK_SPELLING) toggle_spellchk(); - if (option == OPT_CONVO_COMBINE) { + if (option & OPT_CONVO_COMBINE) { /* (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB) == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB) */ - if (current_is_im) { - int set = im_options & (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB); - chat_options &= ~(OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB); - chat_options |= set; - } else { - int set = chat_options & (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB); - im_options &= ~(OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB); - im_options |= set; - } - convo_tabize(); + } - save_prefs(); } -static void set_im_option(GtkWidget *w, int option) +static void set_im_options() { - im_options ^= option; - - if (option == OPT_IM_ONE_WINDOW) + int option = im_options ^ im_options_new; + im_options = im_options_new; + + if (option & OPT_IM_ONE_WINDOW) im_tabize(); - if (option == OPT_IM_HIDE_ICONS) + if (option & OPT_IM_SIDE_TAB || option & OPT_IM_BR_TAB) + update_im_tabs(); + + if (option & OPT_IM_HIDE_ICONS) set_hide_icons(); - if (option == OPT_IM_ALIAS_TAB) { + if (option & OPT_IM_ALIAS_TAB) set_convo_titles(); - BuddyTickerSetNames(); - } - if (option == OPT_IM_NO_ANIMATION) + if (option & OPT_IM_NO_ANIMATION) set_anim(); - - save_prefs(); + + if (option & OPT_IM_BUTTON_TEXT || option & OPT_IM_BUTTON_XPM) + update_im_button_pix(); } -static void set_chat_option(GtkWidget *w, int option) +static void set_chat_options() { - chat_options ^= option; + int option = chat_options ^ chat_options_new; + chat_options = chat_options_new; - if (option == OPT_CHAT_ONE_WINDOW) + if (option & OPT_CHAT_ONE_WINDOW) chat_tabize(); - - save_prefs(); + + if (option & OPT_CHAT_BUTTON_TEXT || option & OPT_CHAT_BUTTON_XPM) + update_chat_button_pix(); } -void set_sound_option(GtkWidget *w, int option) +void set_sound_options() { - sound_options ^= option; - - save_prefs(); + /* int option = sound_options ^ sound_options_new; */ + sound_options = sound_options_new; + } -static void set_font_option(GtkWidget *w, int option) +static void set_font_options() { - font_options ^= option; - + /* int option = font_options ^ font_options_new; */ + font_options = font_options_new; + update_font_buttons(); - - save_prefs(); } -static void set_away_option(GtkWidget *w, int option) +static void set_away_options() { - away_options ^= option; + int option = away_options ^ away_options_new; + away_options = away_options_new; - if (option == OPT_AWAY_QUEUE) + if (option & OPT_AWAY_QUEUE) toggle_away_queue(); +} - save_prefs(); +static void toggle_option(GtkWidget *w, int option) { + int *o = gtk_object_get_user_data(GTK_OBJECT(w)); + *o ^= option; } GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) @@ -2813,157 +2064,328 @@ button = gtk_check_button_new_with_label(text); gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (*options & option)); gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); + gtk_object_set_user_data(GTK_OBJECT(button), options); - if (options == &misc_options) + /* So that the ticker and debug window happen immediately + * I don't think they should be "preferences," anyway. */ + if (options == &misc_options && (option == OPT_MISC_DEBUG || option == OPT_MISC_BUDDY_TICKER)) gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_misc_option), (int *)option); - if (options == &logging_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_logging_option), - (int *)option); - if (options == &blist_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_blist_option), - (int *)option); - if (options == &convo_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_convo_option), - (int *)option); - if (options == &im_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_im_option), + else + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(toggle_option), (int *)option); - if (options == &chat_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_chat_option), - (int *)option); - if (options == &font_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_font_option), - (int *)option); - if (options == &sound_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_sound_option), - (int *)option); - if (options == &away_options) - gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(set_away_option), - (int *)option); - + gtk_widget_show(button); return button; } -static void blist_tab_opt(GtkWidget *widget, int option) +void away_list_clicked(GtkWidget *widget, struct away_message *a) +{} +void default_away_menu_init(GtkWidget *omenu) { - /* Following general method of set_tab_opt() */ - int mask; - mask = (OPT_BLIST_BOTTOM_TAB); - - blist_options &= ~(mask); - blist_options |= (mask & option); - - set_blist_tab(); + GtkWidget *menu, *opt; + int index = 0; + GSList *awy = away_messages; + struct away_message *a; + + menu = gtk_menu_new(); + + while (awy) { + a = (struct away_message *)awy->data; + opt = gtk_menu_item_new_with_label(a->name); + gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(set_default_away), + (gpointer)index); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + + awy = awy->next; + index++; + } + + gtk_option_menu_remove_menu(GTK_OPTION_MENU(omenu)); + gtk_option_menu_set_menu(GTK_OPTION_MENU(omenu), menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(omenu), g_slist_index(away_messages, default_away)); +} + +GtkWidget *pref_fg_picture = NULL; +GtkWidget *pref_bg_picture = NULL; + +void destroy_colorsel(GtkWidget *w, gpointer d) +{ + if (d) { + gtk_widget_destroy(fgcseld); + fgcseld = NULL; + } else { + gtk_widget_destroy(bgcseld); + bgcseld = NULL; + } } -static GtkWidget *blist_tab_radio(const char *label, int which, GtkWidget *box,GtkWidget *set) +void apply_color_dlg(GtkWidget *w, gpointer d) { - GtkWidget *new_opt; + gdouble color[3]; + if ((int)d == 1) { +#if GTK_CHECK_VERSION(1,3,0) + gtk_color_selection_get_current_color(GTK_COLOR_SELECTION + (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), + &fgcolor_new); +#else + gtk_color_selection_get_color(GTK_COLOR_SELECTION + (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), color); - if(!set) - new_opt = gtk_radio_button_new_with_label (NULL, label); - else - new_opt = gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), label); - - gtk_box_pack_start(GTK_BOX(box), new_opt, FALSE, FALSE, 0); - gtk_signal_connect(GTK_OBJECT(new_opt), "clicked", - GTK_SIGNAL_FUNC(blist_tab_opt), (void *)which); - gtk_widget_show(new_opt); - - if ((blist_options & OPT_BLIST_BOTTOM_TAB) == (which & OPT_BLIST_BOTTOM_TAB)) - gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(new_opt), TRUE); - - return new_opt; + fgcolor_new.red = ((guint16)(color[0] * 65535)) >> 8; + fgcolor_new.green = ((guint16)(color[1] * 65535)) >> 8; + fgcolor_new.blue = ((guint16)(color[2] * 65535)) >> 8; +#endif + destroy_colorsel(NULL, (void *)1); + update_color(NULL, pref_fg_picture); + } else { +#if GTK_CHECK_VERSION(1,3,0) + gtk_color_selection_get_current_color(GTK_COLOR_SELECTION + (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), + &bgcolor_new); +#else + gtk_color_selection_get_color(GTK_COLOR_SELECTION + (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), color); + + bgcolor_new.red = ((guint16)(color[0] * 65535)) >> 8; + bgcolor_new.green = ((guint16)(color[1] * 65535)) >> 8; + bgcolor_new.blue = ((guint16)(color[2] * 65535)) >> 8; +#endif + destroy_colorsel(NULL, (void *)0); + update_color(NULL, pref_bg_picture); + } } -void prefs_build_general() +void update_color(GtkWidget *w, GtkWidget *pic) { - GtkCTreeNode *node; - char *text[1]; + GdkColor c; + GtkStyle *style; + c.pixel = 0; + + if (pic == pref_fg_picture) { + if (font_options_new & OPT_FONT_FGCOL) { + c.red = fgcolor_new.red; + c.blue = fgcolor_new.blue; + c.green = fgcolor_new.green; + } else { + c.red = 0; + c.blue = 0; + c.green = 0; + } + } else { + if (font_options_new & OPT_FONT_BGCOL) { + c.red = bgcolor_new.red; + c.blue = bgcolor_new.blue; + c.green = bgcolor_new.green; + } else { + c.red = 0xffff; + c.blue = 0xffff; + c.green = 0xffff; + } + } + + style = gtk_style_new(); + style->bg[0] = c; + gtk_widget_set_style(pic, style); + gtk_style_unref(style); +} +void set_default_away(GtkWidget *w, gpointer i) +{ + + int length = g_slist_length(away_messages); - text[0] = _("General"); - general_node = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), general_node, general_page); + if (away_messages == NULL) + default_away_new = NULL; + else if ((int)i >= length) + default_away_new = g_slist_nth_data(away_messages, length - 1); + else + default_away_new = g_slist_nth_data(away_messages, (int)i); +} + +static void update_spin_value(GtkWidget *w, GtkWidget *spin) +{ + int *value = gtk_object_get_user_data(GTK_OBJECT(spin)); + *value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); +} +GtkWidget *gaim_labeled_spin_button(GtkWidget *box, const gchar *title, int *val, int min, int max) +{ + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *spin; + GtkObject *adjust; - text[0] = _("Proxy"); - node = gtk_ctree_insert_node(GTK_CTREE(preftree), general_node, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, proxy_page); + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); + gtk_widget_show(hbox); + + label = gtk_label_new(title); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); - gtk_ctree_select(GTK_CTREE(preftree), general_node); + adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); + spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); + gtk_object_set_user_data(GTK_OBJECT(spin), val); + gtk_widget_set_usize(spin, 50, -1); + gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(adjust), "value-changed", + GTK_SIGNAL_FUNC(update_spin_value), GTK_WIDGET(spin)); + gtk_widget_show(spin); + return spin; } -void prefs_build_buddy() +void dropdown_set(GtkObject *w, int *option) { - GtkCTreeNode *parent; - char *text[1]; - - text[0] = _("Buddy List"); - parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, buddy_page); + int opt = (int)gtk_object_get_user_data(w); + int clear = (int)gtk_object_get_data(w, "clear"); + + if (clear != -1) { + *option = *option & ~clear; + *option = *option | opt; + } else { + debug_printf("HELLO %d\n", opt); + *option = opt; + } + + if (option == &proxytype_new) { + if (opt == PROXY_NONE) + gtk_widget_set_sensitive(prefs_proxy_frame, FALSE); + else + gtk_widget_set_sensitive(prefs_proxy_frame, TRUE); + } else if (option == &web_browser_new) { + if (opt == BROWSER_MANUAL) + gtk_widget_set_sensitive(browser_entry, TRUE); + else + gtk_widget_set_sensitive(browser_entry, FALSE); + } else if (option == &sound_options_new) { + if (opt == OPT_SOUND_CMD) + gtk_widget_set_sensitive(sndcmd, TRUE); + else + gtk_widget_set_sensitive(sndcmd, FALSE); + } + } -void prefs_build_convo() +static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) { - GtkCTreeNode *parent, *node; - char *text[1]; + va_list menuitems; + GtkWidget *dropdown, *opt, *menu; + GtkWidget *label; + gchar *text; + int value; + int o = 0; + GtkWidget *hbox; - text[0] = _("Conversations"); - parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, convo_page); + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_widget_show(hbox); + + label = gtk_label_new(title); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + va_start(menuitems, clear); + text = va_arg(menuitems, gchar *); + + if (!text) + return NULL; + + dropdown = gtk_option_menu_new(); + menu = gtk_menu_new(); - text[0] = _("IM Window"); - node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, im_page); + while (text) { + value = va_arg(menuitems, int); + opt = gtk_menu_item_new_with_label(text); + gtk_object_set_user_data(GTK_OBJECT(opt), (void *)value); + gtk_object_set_data(GTK_OBJECT(opt), "clear", (void *)clear); + gtk_signal_connect(GTK_OBJECT(opt), "activate", + GTK_SIGNAL_FUNC(dropdown_set), (void *)option); + gtk_widget_show(opt); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); - text[0] = _("Chat"); - node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, chat_page); + if (((clear > -1) && ((*option & value) == value)) || *option == value) { + gtk_menu_set_active(GTK_MENU(menu), o); + } + text = va_arg(menuitems, gchar *); + o++; + } - text[0] = _("Font Options"); - node = gtk_ctree_insert_node(GTK_CTREE(preftree), parent, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), node, font_page); -} + va_end(menuitems); -void prefs_build_sound() + gtk_option_menu_set_menu(GTK_OPTION_MENU(dropdown), menu); + gtk_box_pack_start(GTK_BOX(hbox), dropdown, FALSE, FALSE, 0); + gtk_widget_show(dropdown); + return dropdown; +} + +static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) { - GtkCTreeNode *parent; - char *text[1]; + /* more stuff stolen from X-Chat */ + GtkWidget *swid; + GdkColor c; + GtkStyle *style; + c.pixel = 0; + if (fgc) { + if (font_options_new & OPT_FONT_FGCOL) { + c.red = fgcolor_new.red; + c.blue = fgcolor_new.blue; + c.green = fgcolor_new.green; + } else { + c.red = 0; + c.blue = 0; + c.green = 0; + } + } else { + if (font_options_new & OPT_FONT_BGCOL) { + c.red = bgcolor_new.red; + c.blue = bgcolor_new.blue; + c.green = bgcolor_new.green; + } else { + c.red = 0xffff; + c.blue = 0xffff; + c.green = 0xffff; + } + } - text[0] = _("Sounds"); - parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, sound_page); -} - -void prefs_build_away() -{ - GtkCTreeNode *parent; - char *text[1]; + style = gtk_style_new(); + style->bg[0] = c; - text[0] = _("Away Messages"); - parent = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), parent, away_page); + swid = gtk_event_box_new(); + gtk_widget_set_style(GTK_WIDGET(swid), style); + gtk_style_unref(style); + gtk_widget_set_usize(GTK_WIDGET(swid), 40, -1); + gtk_box_pack_start(GTK_BOX(box), swid, FALSE, FALSE, 5); + gtk_widget_show(swid); + return swid; } - -void prefs_build_deny() +void apply_font_dlg(GtkWidget *w, GtkWidget *f) { - char *text[1]; + int i = 0; +#if !GTK_CHECK_VERSION(1,3,0) + int j = 0, k = 0; +#endif + char *fontname; + + fontname = g_strdup(gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontseld))); + destroy_fontsel(0, 0); - if (connections && !deny_node) { - text[0] = _("Privacy"); - deny_node = gtk_ctree_insert_node(GTK_CTREE(preftree), NULL, NULL, - text, 5, NULL, NULL, NULL, NULL, 0, 1); - gtk_ctree_node_set_row_data(GTK_CTREE(preftree), deny_node, deny_page); +#if !GTK_CHECK_VERSION(1,3,0) + for (i = 0; i < strlen(fontname); i++) { + if (fontname[i] == '-') { + if (++j > 2) + break; + } else if (j == 2) + fontface_new[k++] = fontname[i]; } + fontface_new[k] = '\0'; + g_snprintf(fontxfld_new, sizeof(fontxfld_new), "%s", fontname); +#else + while(fontname[i] && !isdigit(fontname[i]) && i < sizeof(fontface_new)) { + fontface_new[i] = fontname[i]; + i++; + } + +#endif + g_free(fontname); }