Mercurial > pidgin.yaz
changeset 5545:7a64114641c3
[gaim-migrate @ 5946]
I've been rewriting the prefs to move from gaimrc to prefs.xml. This will
NOT compile! I don't want to see complaints about this, as it's CVS, and
you should only be using it if you can put up with things like this. Also,
don't ask how long it'll take until it compiles again. It may be several
days. This is a big migration. Even when it works, it may not run right.
However, it's made a lot of progress, and I plan to actively work on it
today and tomorrow.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 29 May 2003 19:10:24 +0000 |
parents | 0028381fa874 |
children | 22cf337e8b8f |
files | src/away.c src/blist.c src/browser.c src/conversation.c src/core.h src/dialogs.c src/gaim.h src/gaimrc.c src/gtkconv.c src/gtkprefs.c src/main.c src/prefs.c src/prefs.h src/server.c src/sound.c src/sound.h src/ui.h src/util.c |
diffstat | 18 files changed, 1045 insertions(+), 758 deletions(-) [+] |
line wrap: on
line diff
--- a/src/away.c Thu May 29 17:35:28 2003 +0000 +++ b/src/away.c Thu May 29 19:10:24 2003 +0000 @@ -33,6 +33,7 @@ #include "gtkimhtml.h" #include "gtkblist.h" #include "plugin.h" +#include "prefs.h" GtkWidget *imaway = NULL; @@ -160,7 +161,7 @@ if (!awayqueue || !awayqueuesw) return; - if (away_options & OPT_AWAY_QUEUE) { + if (gaim_prefs_get_bool("/core/away/queue_messages")) { gtk_widget_show(awayqueue); gtk_widget_show(awayqueuesw); } else { @@ -273,7 +274,7 @@ g_signal_connect(G_OBJECT(awayqueue), "button_press_event", G_CALLBACK(dequeue_cb), NULL); - if (away_options & OPT_AWAY_QUEUE) { + if (gaim_prefs_get_bool("/core/away/queue_messages")) { gtk_widget_show(awayqueuesw); gtk_widget_show(awayqueue); }
--- a/src/blist.c Thu May 29 17:35:28 2003 +0000 +++ b/src/blist.c Thu May 29 19:10:24 2003 +0000 @@ -37,6 +37,7 @@ #include "prpl.h" #include "blist.h" #include "notify.h" +#include "prefs.h" #ifdef _WIN32 #include "win32dep.h" @@ -698,13 +699,19 @@ } char *gaim_get_buddy_alias_only(struct buddy *b) { - if(!b) - return NULL; - if(b->alias && b->alias[0]) - return b->alias; - else if((misc_options & OPT_MISC_USE_SERVER_ALIAS) && b->server_alias) - return b->server_alias; - return NULL; + if(!b) + return NULL; + + if(b->alias && b->alias[0]) { + return b->alias; + } + else if (b->server_alias != NULL && + gaim_prefs_get_bool("/core/buddies/use_server_alias")) { + + return b->server_alias; + } + + return NULL; } char * gaim_get_buddy_alias (struct buddy *buddy)
--- a/src/browser.c Thu May 29 17:35:28 2003 +0000 +++ b/src/browser.c Thu May 29 19:10:24 2003 +0000 @@ -50,6 +50,7 @@ #include <gdk/gdkprivate.h> #include "gaim.h" #include "notify.h" +#include "prefs.h" #ifndef _WIN32 @@ -544,7 +545,7 @@ case BROWSER_NETSCAPE: { char *args = NULL; - if (misc_options & OPT_MISC_BROWSER_POPUP) + if (gaim_prefs_get_bool("/gaim/gtk/browsers/new_window")) args = g_strdup_printf("OpenURL(%s, new-window)", url); else args = g_strdup_printf("OpenURL(%s)", url); @@ -562,7 +563,7 @@ } break; case BROWSER_OPERA: - if (misc_options & OPT_MISC_BROWSER_POPUP) + if (gaim_prefs_get_bool("/gaim/gtk/browsers/new_window")) command = g_strdup_printf("opera -newwindow \"%s\"", url); else command = g_strdup_printf("opera \"%s\"", url); @@ -573,7 +574,7 @@ break; case BROWSER_GALEON: - if (misc_options & OPT_MISC_BROWSER_POPUP) + if (gaim_prefs_get_bool("/gaim/gtk/browsers/new_window")) command = g_strdup_printf("galeon -w \"%s\"", url); else command = g_strdup_printf("galeon \"%s\"", url);
--- a/src/conversation.c Thu May 29 17:35:28 2003 +0000 +++ b/src/conversation.c Thu May 29 19:10:24 2003 +0000 @@ -372,9 +372,6 @@ else gaim_im_write(im, NULL, buffy, -1, WFLAG_SEND, time(NULL)); - - if (im_options & OPT_IM_POPDOWN) - gaim_window_hide(gaim_conversation_get_window(conv)); } if (binary) @@ -384,12 +381,8 @@ err = serv_send_im(gc, (char *)gaim_conversation_get_name(conv), buffy, -1, imflags); - if (err > 0) { + if (err > 0) gaim_im_write(im, NULL, buf, -1, WFLAG_SEND, time(NULL)); - - if (im_options & OPT_IM_POPDOWN) - gaim_window_hide(gaim_conversation_get_window(conv)); - } } g_free(buffy); @@ -417,7 +410,9 @@ } } else { - if (err > 0 && (away_options & OPT_AWAY_BACK_ON_IM)) { + if (err > 0 && + gaim_prefs_get_bool("/core/conversations/away_back_on_send")) { + if (awaymessage != NULL) { do_im_back(); } @@ -893,7 +888,7 @@ ims = g_list_append(ims, conv); gaim_conversation_set_logging(conv, - (logging_options & OPT_LOG_CONVOS)); + gaim_prefs_get_bool("/gaim/gtk/logging/log_conversations")); } else if (type == GAIM_CONV_CHAT) { @@ -902,7 +897,8 @@ chats = g_list_append(chats, conv); - gaim_conversation_set_logging(conv, (logging_options & OPT_LOG_CHATS)); + gaim_conversation_set_logging(conv, + gaim_prefs_get_bool("/gaim/gtk/logging/log_chats")); } conversations = g_list_append(conversations, conv); @@ -915,8 +911,8 @@ * created window. */ if (windows == NULL || - (type == GAIM_CONV_IM && !(im_options & OPT_IM_ONE_WINDOW)) || - (type == GAIM_CONV_CHAT && !(chat_options & OPT_CHAT_ONE_WINDOW))) { + !gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) { + struct gaim_window *win; win = gaim_window_new(); @@ -960,7 +956,7 @@ prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) { - if (!(misc_options & OPT_MISC_STEALTH_TYPING)) + if (gaim_prefs_get_bool("/core/conversations/im/send_typing")) serv_send_typing(gc, (char *)name, NOT_TYPING); if (gc && prpl_info->convo_closed != NULL) @@ -1179,7 +1175,7 @@ account = gaim_conversation_get_account(conv); name = gaim_conversation_get_name(conv); - if (((im_options & OPT_IM_ALIAS_TAB) == OPT_IM_ALIAS_TAB) && + if (gaim_prefs_get_bool("/core/conversations/use_alias_for_title") && account != NULL && ((b = gaim_find_buddy(account, name)) != NULL)) { text = gaim_get_buddy_alias(b); @@ -1490,15 +1486,6 @@ win = gaim_conversation_get_window(conv); - if (!(flags & WFLAG_NOLOG) && - ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && - (chat_options & OPT_CHAT_POPUP)) || - (gaim_conversation_get_type(conv) == GAIM_CONV_IM && - ((im_options & OPT_IM_POPUP) || (im_options & OPT_IM_POPDOWN))))) { - - gaim_window_show(win); - } - /* Tab highlighting */ if (!(flags & WFLAG_RECV) && !(flags & WFLAG_SYSTEM)) return; @@ -1701,9 +1688,6 @@ c = gaim_im_get_conversation(im); /* Raise the window, if specified in prefs. */ - if (!(flags & WFLAG_NOLOG) & (im_options & OPT_IM_POPUP)) - gaim_window_raise(gaim_conversation_get_window(c)); - if (c->ui_ops != NULL && c->ui_ops->write_im != NULL) c->ui_ops->write_im(c, who, message, len, flags, mtime); else @@ -1907,10 +1891,6 @@ if (gaim_chat_is_user_ignored(chat, who)) return; - /* Raise the window, if specified in prefs. */ - if (!(flags & WFLAG_NOLOG) & (chat_options & OPT_CHAT_POPUP)) - gaim_window_raise(gaim_conversation_get_window(conv)); - if (!(flags & WFLAG_WHISPER)) { char *str; @@ -1972,7 +1952,7 @@ if (ops != NULL && ops->chat_add_user != NULL) ops->chat_add_user(conv, user); - if (chat_options & OPT_CHAT_LOGON) { + if (gaim_prefs_get_bool("/core/conversations/chat/show_join")) { if (extra_msg == NULL) g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), user); else @@ -2024,7 +2004,7 @@ else if (gaim_chat_is_user_ignored(chat, new_user)) gaim_chat_unignore(chat, new_user); - if (chat_options & OPT_CHAT_LOGON) { + if (gaim_prefs_get_bool("/core/conversations/chat/show_nick_change")) { g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old_user, new_user); @@ -2066,7 +2046,7 @@ /* NOTE: Don't remove them from ignored in case they re-enter. */ - if (chat_options & OPT_CHAT_LOGON) { + if (gaim_prefs_get_bool("/core/conversations/chat/show_leave")) { if (reason != NULL && *reason != '\0') g_snprintf(tmp, sizeof(tmp), _("%s left the room (%s)."), user, reason); @@ -2103,7 +2083,7 @@ { struct gaim_window *win; - if (convo_options & OPT_CONVO_COMBINE) + if (gaim_prefs_get_bool("/core/conversations/combine_chat_im")) win = g_list_last(gaim_get_windows())->data; else win = gaim_get_last_window_with_type(gaim_conversation_get_type(conv)); @@ -2223,15 +2203,17 @@ conv2 = (struct gaim_conversation *)convs->data; - if (((convo_options & OPT_CONVO_COMBINE) || - type == gaim_conversation_get_type(conv2)) && - account == gaim_conversation_get_account(conv2)) { + if ((gaim_prefs_get_bool("/core/conversations/combine_chat_im") || + type == gaim_conversation_get_type(conv2)) && + account == gaim_conversation_get_account(conv2)) { + gaim_window_add_conversation(win2, conv); return; } } } + /* Make a new window. */ conv_placement_new_window(conv); }
--- a/src/core.h Thu May 29 17:35:28 2003 +0000 +++ b/src/core.h Thu May 29 19:10:24 2003 +0000 @@ -57,6 +57,12 @@ #include "notify.h" #include "request.h" +/* XXX Temporary! */ +#define OPT_LOG_BUDDY_SIGNON 0x00000004 +#define OPT_LOG_BUDDY_IDLE 0x00000008 +#define OPT_LOG_BUDDY_AWAY 0x00000010 +#define OPT_LOG_MY_SIGNON 0x00000020 + /* Really user states are controlled by the PRPLs now. We just use this for event_away */ #define UC_UNAVAILABLE 1
--- a/src/dialogs.c Thu May 29 17:35:28 2003 +0000 +++ b/src/dialogs.c Thu May 29 19:10:24 2003 +0000 @@ -50,6 +50,7 @@ #include "prpl.h" #include "gtkblist.h" #include "notify.h" +#include "prefs.h" #ifdef _WIN32 #include "win32dep.h" @@ -57,9 +58,6 @@ #define PATHSIZE 1024 -GdkColor bgcolor; -GdkColor fgcolor; - static GtkWidget *imdialog = NULL; /*I only want ONE of these :) */ static GList *dialogwindows = NULL; static GtkWidget *importdialog; @@ -2343,12 +2341,15 @@ gtk_widget_show_all(b->window); } - if (convo_options & OPT_CONVO_IGNORE_COLOUR) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) options ^= GTK_IMHTML_NO_COLOURS; - if (convo_options & OPT_CONVO_IGNORE_FONTS) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) options ^= GTK_IMHTML_NO_FONTS; - if (convo_options & OPT_CONVO_IGNORE_SIZES) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) options ^= GTK_IMHTML_NO_SIZES; + options ^= GTK_IMHTML_NO_COMMENTS; options ^= GTK_IMHTML_NO_TITLE; options ^= GTK_IMHTML_NO_NEWLINE; @@ -3022,9 +3023,13 @@ { struct gaim_gtk_conversation *gtkconv; GtkWidget *colorsel; + GdkColor fgcolor; gtkconv = GAIM_GTK_CONVERSATION(c); + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), + &fgcolor); + if (color == NULL) { /* we came from the prefs */ if (fgcseld) return; @@ -3070,9 +3075,13 @@ { struct gaim_gtk_conversation *gtkconv; GtkWidget *colorsel; + GdkColor bgcolor; gtkconv = GAIM_GTK_CONVERSATION(c); + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), + &bgcolor); + if (color == NULL) { /* we came from the prefs */ if (bgcseld) return; @@ -3143,22 +3152,32 @@ struct gaim_conversation *c = g_object_get_data(G_OBJECT(fontsel), "gaim_conversation"); + fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); + if (c) { - fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); while(fontname[i] && !isdigit(fontname[i])) { i++; } fontname[i] = 0; gaim_gtk_set_font_face(GAIM_GTK_CONVERSATION(c), fontname); } else { + char *c; + fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontsel)); - while(fontface[i] && !isdigit(fontname[i]) && i < sizeof(fontface)) { - fontface[i] = fontname[i]; - i++; + + for (c = fontname; *c != '\0'; c++) { + if (isdigit(*c)) { + *(--c) = '\0'; + break; + } } - fontface[i] = 0; + + /* Try this. */ + gaim_prefs_set_string("/gaim/gtk/conversations/font_face", fontname); } + g_free(fontname); + cancel_font(NULL, c); } @@ -3172,14 +3191,19 @@ { struct gaim_gtk_conversation *gtkconv; char fonttif[128]; + const char *fontface; gtkconv = GAIM_GTK_CONVERSATION(c); if (!font) { /* we came from the prefs dialog */ if (fontseld) return; + fontseld = gtk_font_selection_dialog_new(_("Select Font")); - if (fontface[0]) { + + fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face"); + + if (fontface != NULL && *fontface != '\0') { g_snprintf(fonttif, sizeof(fonttif), "%s 12", fontface); gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(fontseld), fonttif); @@ -4063,11 +4087,14 @@ long offset = 0; options = GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL; - if (convo_options & OPT_CONVO_IGNORE_COLOUR) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) options ^= GTK_IMHTML_NO_COLOURS; - if (convo_options & OPT_CONVO_IGNORE_FONTS) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) options ^= GTK_IMHTML_NO_FONTS; - if (convo_options & OPT_CONVO_IGNORE_SIZES) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) options ^= GTK_IMHTML_NO_SIZES; window = gtk_window_new(GTK_WINDOW_TOPLEVEL); @@ -4415,7 +4442,7 @@ GtkWidget * gaim_pixbuf_button_from_stock(const char *text, const char *icon, - GaimButtonStyle style) + GaimButtonOrientation style) { GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; button = gtk_button_new(); @@ -4451,7 +4478,7 @@ return button; } -GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonStyle style) +GtkWidget *gaim_pixbuf_button(char *text, char *iconfile, GaimButtonOrientation style) { GtkWidget *button, *image, *label, *bbox, *ibox, *lbox; button = gtk_button_new();
--- a/src/gaim.h Thu May 29 17:35:28 2003 +0000 +++ b/src/gaim.h Thu May 29 19:10:24 2003 +0000 @@ -198,126 +198,6 @@ extern char *opt_rcfile_arg; extern int opt_debug; -extern guint misc_options; -#define OPT_MISC_DEBUG 0x00000001 -#define OPT_MISC_BROWSER_POPUP 0x00000002 -#define OPT_MISC_BUDDY_TICKER 0x00000004 -#define OPT_MISC_STEALTH_TYPING 0x00000010 -#define OPT_MISC_USE_SERVER_ALIAS 0x00000020 - -extern guint logging_options; -#define OPT_LOG_CONVOS 0x00000001 -#define OPT_LOG_STRIP_HTML 0x00000002 -#define OPT_LOG_BUDDY_SIGNON 0x00000004 -#define OPT_LOG_BUDDY_IDLE 0x00000008 -#define OPT_LOG_BUDDY_AWAY 0x00000010 -#define OPT_LOG_MY_SIGNON 0x00000020 -#define OPT_LOG_INDIVIDUAL 0x00000040 -#define OPT_LOG_CHATS 0x00000100 - -extern guint blist_options; -#define OPT_BLIST_APP_BUDDY_SHOW 0x00000001 -#define OPT_BLIST_SAVED_WINDOWS 0x00000002 -#define OPT_BLIST_NEAR_APPLET 0x00000004 -#define OPT_BLIST_SHOW_GRPNUM 0x00000008 -#define OPT_BLIST_SHOW_PIXMAPS 0x00000010 -#define OPT_BLIST_SHOW_IDLETIME 0x00000020 -#define OPT_BLIST_SHOW_BUTTON_XPM 0x00000040 -#define OPT_BLIST_NO_BUTTON_TEXT 0x00000080 -#define OPT_BLIST_NO_MT_GRP 0x00000100 -#define OPT_BLIST_SHOW_WARN 0x00000200 -#define OPT_BLIST_GREY_IDLERS 0x00000400 -/* define OPT_BLIST_TOMBSTONE 0x00000800 */ -#define OPT_BLIST_POPUP 0x00001000 -#define OPT_BLIST_SHOW_ICONS 0x00002000 -#define OPT_BLIST_SHOW_OFFLINE 0x00004000 - -extern guint convo_options; -#define OPT_CONVO_ENTER_SENDS 0x00000001 -#define OPT_CONVO_SEND_LINKS 0x00000002 -#define OPT_CONVO_CHECK_SPELLING 0x00000004 -#define OPT_CONVO_CTL_CHARS 0x00000008 -#define OPT_CONVO_CTL_SMILEYS 0x00000010 -#define OPT_CONVO_ESC_CAN_CLOSE 0x00000020 -#define OPT_CONVO_CTL_ENTER 0x00000040 -#define OPT_CONVO_F2_TOGGLES 0x00000080 -#define OPT_CONVO_SHOW_TIME 0x00000100 -#define OPT_CONVO_IGNORE_COLOUR 0x00000200 -#define OPT_CONVO_SHOW_SMILEY 0x00000400 -#define OPT_CONVO_IGNORE_FONTS 0x00000800 -#define OPT_CONVO_IGNORE_SIZES 0x00001000 -#define OPT_CONVO_COMBINE 0x00002000 -#define OPT_CONVO_CTL_W_CLOSES 0x00004000 -#define OPT_CONVO_NO_X_ON_TAB 0x00008000 - -extern guint im_options; -#define OPT_IM_POPUP 0x00000001 -#define OPT_IM_LOGON 0x00000002 -#define OPT_IM_BUTTON_TEXT 0x00000004 -#define OPT_IM_BUTTON_XPM 0x00000008 -#define OPT_IM_ONE_WINDOW 0x00000010 -#define OPT_IM_SIDE_TAB 0x00000020 -#define OPT_IM_BR_TAB 0x00000040 -#define OPT_IM_HIDE_ICONS 0x00000080 -#define OPT_IM_NO_ANIMATION 0x00000100 -#define OPT_IM_ALIAS_TAB 0x00002000 -#define OPT_IM_POPDOWN 0x00004000 - -extern guint chat_options; -#define OPT_CHAT_ONE_WINDOW 0x00000001 -#define OPT_CHAT_BUTTON_TEXT 0x00000002 -#define OPT_CHAT_BUTTON_XPM 0x00000004 -#define OPT_CHAT_LOGON 0x00000008 -#define OPT_CHAT_POPUP 0x00000010 -#define OPT_CHAT_SIDE_TAB 0x00000020 -#define OPT_CHAT_BR_TAB 0x00000040 -#define OPT_CHAT_TAB_COMPLETE 0x00000080 -#define OPT_CHAT_OLD_STYLE_TAB 0x00000100 -#define OPT_CHAT_COLORIZE 0x00000200 - -extern guint conv_placement_option; - -extern guint font_options; -#define OPT_FONT_BOLD 0x00000001 -#define OPT_FONT_ITALIC 0x00000002 -#define OPT_FONT_UNDERLINE 0x00000008 -#define OPT_FONT_STRIKE 0x00000010 -#define OPT_FONT_FACE 0x00000020 -#define OPT_FONT_FGCOL 0x00000040 -#define OPT_FONT_BGCOL 0x00000080 -#define OPT_FONT_SIZE 0x00000100 - -extern guint sound_options; -#define OPT_SOUND_LOGIN 0x00000001 -#define OPT_SOUND_LOGOUT 0x00000002 -#define OPT_SOUND_RECV 0x00000004 -#define OPT_SOUND_SEND 0x00000008 -#define OPT_SOUND_FIRST_RCV 0x00000010 -#define OPT_SOUND_WHEN_AWAY 0x00000020 -#define OPT_SOUND_SILENT_SIGNON 0x00000040 -#define OPT_SOUND_THROUGH_GNOME 0x00000080 -#define OPT_SOUND_CHAT_JOIN 0x00000100 -#define OPT_SOUND_CHAT_SAY 0x00000200 -#define OPT_SOUND_BEEP 0x00000400 -#define OPT_SOUND_CHAT_PART 0x00000800 -#define OPT_SOUND_CHAT_YOU_SAY 0x00001000 -#define OPT_SOUND_NORMAL 0x00002000 -#define OPT_SOUND_NAS 0x00004000 -#define OPT_SOUND_ARTS 0x00008000 -#define OPT_SOUND_ESD 0x00010000 -#define OPT_SOUND_CMD 0x00020000 -#define OPT_SOUND_CHAT_NICK 0x00040000 - -extern guint away_options; -#define OPT_AWAY_BACK_ON_IM 0x00000002 -/* #define OPT_AWAY_TOMBSTONE 0x00000004 */ -#define OPT_AWAY_AUTO 0x00000008 -#define OPT_AWAY_NO_AUTO_RESP 0x00000010 -#define OPT_AWAY_QUEUE 0x00000020 -#define OPT_AWAY_IDLE_RESP 0x00000040 -#define OPT_AWAY_QUEUE_UNREAD 0x00000080 -#define OPT_AWAY_DELAY_IN_USE 0x00000100 - extern guint away_resend; extern int report_idle; extern int web_browser;
--- a/src/gaimrc.c Thu May 29 17:35:28 2003 +0000 +++ b/src/gaimrc.c Thu May 29 19:10:24 2003 +0000 @@ -52,18 +52,124 @@ #define BORING_DEFAULT_AWAY_MSG _("sorry, i ran out for a while. bbl") #define MAX_VALUES 10 +#define OPT_FONT_BOLD 0x00000001 +#define OPT_FONT_ITALIC 0x00000002 +#define OPT_FONT_UNDERLINE 0x00000008 +#define OPT_FONT_STRIKE 0x00000010 +#define OPT_FONT_FACE 0x00000020 +#define OPT_FONT_FGCOL 0x00000040 +#define OPT_FONT_BGCOL 0x00000080 +#define OPT_FONT_SIZE 0x00000100 + +#define OPT_MISC_DEBUG 0x00000001 +#define OPT_MISC_BROWSER_POPUP 0x00000002 +#define OPT_MISC_BUDDY_TICKER 0x00000004 +#define OPT_MISC_STEALTH_TYPING 0x00000010 +#define OPT_MISC_USE_SERVER_ALIAS 0x00000020 + +#define OPT_LOG_CONVOS 0x00000001 +#define OPT_LOG_STRIP_HTML 0x00000002 +#define OPT_LOG_INDIVIDUAL 0x00000040 +#define OPT_LOG_CHATS 0x00000100 + +#define OPT_BLIST_APP_BUDDY_SHOW 0x00000001 +#define OPT_BLIST_SAVED_WINDOWS 0x00000002 +#define OPT_BLIST_NEAR_APPLET 0x00000004 +#define OPT_BLIST_SHOW_GRPNUM 0x00000008 +#define OPT_BLIST_SHOW_PIXMAPS 0x00000010 +#define OPT_BLIST_SHOW_IDLETIME 0x00000020 +#define OPT_BLIST_SHOW_BUTTON_XPM 0x00000040 +#define OPT_BLIST_NO_BUTTON_TEXT 0x00000080 +#define OPT_BLIST_NO_MT_GRP 0x00000100 +#define OPT_BLIST_SHOW_WARN 0x00000200 +#define OPT_BLIST_GREY_IDLERS 0x00000400 +/* define OPT_BLIST_TOMBSTONE 0x00000800 */ +#define OPT_BLIST_POPUP 0x00001000 +#define OPT_BLIST_SHOW_ICONS 0x00002000 +#define OPT_BLIST_SHOW_OFFLINE 0x00004000 + +#define OPT_CONVO_ENTER_SENDS 0x00000001 +#define OPT_CONVO_SEND_LINKS 0x00000002 +#define OPT_CONVO_CHECK_SPELLING 0x00000004 +#define OPT_CONVO_CTL_CHARS 0x00000008 +#define OPT_CONVO_CTL_SMILEYS 0x00000010 +#define OPT_CONVO_ESC_CAN_CLOSE 0x00000020 +#define OPT_CONVO_CTL_ENTER 0x00000040 +#define OPT_CONVO_F2_TOGGLES 0x00000080 +#define OPT_CONVO_SHOW_TIME 0x00000100 +#define OPT_CONVO_IGNORE_COLOUR 0x00000200 +#define OPT_CONVO_SHOW_SMILEY 0x00000400 +#define OPT_CONVO_IGNORE_FONTS 0x00000800 +#define OPT_CONVO_IGNORE_SIZES 0x00001000 +#define OPT_CONVO_COMBINE 0x00002000 +#define OPT_CONVO_CTL_W_CLOSES 0x00004000 +#define OPT_CONVO_NO_X_ON_TAB 0x00008000 + +#define OPT_IM_POPUP 0x00000001 +#define OPT_IM_LOGON 0x00000002 +#define OPT_IM_BUTTON_TEXT 0x00000004 +#define OPT_IM_BUTTON_XPM 0x00000008 +#define OPT_IM_ONE_WINDOW 0x00000010 +#define OPT_IM_SIDE_TAB 0x00000020 +#define OPT_IM_BR_TAB 0x00000040 +#define OPT_IM_HIDE_ICONS 0x00000080 +#define OPT_IM_NO_ANIMATION 0x00000100 +#define OPT_IM_ALIAS_TAB 0x00002000 +#define OPT_IM_POPDOWN 0x00004000 + +#define OPT_CHAT_ONE_WINDOW 0x00000001 +#define OPT_CHAT_BUTTON_TEXT 0x00000002 +#define OPT_CHAT_BUTTON_XPM 0x00000004 +#define OPT_CHAT_LOGON 0x00000008 +#define OPT_CHAT_POPUP 0x00000010 +#define OPT_CHAT_SIDE_TAB 0x00000020 +#define OPT_CHAT_BR_TAB 0x00000040 +#define OPT_CHAT_TAB_COMPLETE 0x00000080 +#define OPT_CHAT_OLD_STYLE_TAB 0x00000100 +#define OPT_CHAT_COLORIZE 0x00000200 + +#define OPT_SOUND_LOGIN 0x00000001 +#define OPT_SOUND_LOGOUT 0x00000002 +#define OPT_SOUND_RECV 0x00000004 +#define OPT_SOUND_SEND 0x00000008 +#define OPT_SOUND_FIRST_RCV 0x00000010 +#define OPT_SOUND_WHEN_AWAY 0x00000020 +#define OPT_SOUND_SILENT_SIGNON 0x00000040 +#define OPT_SOUND_THROUGH_GNOME 0x00000080 +#define OPT_SOUND_CHAT_JOIN 0x00000100 +#define OPT_SOUND_CHAT_SAY 0x00000200 +#define OPT_SOUND_BEEP 0x00000400 +#define OPT_SOUND_CHAT_PART 0x00000800 +#define OPT_SOUND_CHAT_YOU_SAY 0x00001000 +#define OPT_SOUND_NORMAL 0x00002000 +#define OPT_SOUND_NAS 0x00004000 +#define OPT_SOUND_ARTS 0x00008000 +#define OPT_SOUND_ESD 0x00010000 +#define OPT_SOUND_CMD 0x00020000 +#define OPT_SOUND_CHAT_NICK 0x00040000 + +#define OPT_AWAY_BACK_ON_IM 0x00000002 +/* #define OPT_AWAY_TOMBSTONE 0x00000004 */ +#define OPT_AWAY_AUTO 0x00000008 +#define OPT_AWAY_NO_AUTO_RESP 0x00000010 +#define OPT_AWAY_QUEUE 0x00000020 +#define OPT_AWAY_IDLE_RESP 0x00000040 +#define OPT_AWAY_QUEUE_UNREAD 0x00000080 +#define OPT_AWAY_DELAY_IN_USE 0x00000100 + + GSList *gaim_accounts = NULL; -guint misc_options; -guint logging_options; -guint blist_options; -guint convo_options; -guint im_options; -guint conv_placement_option; -guint chat_options; -guint font_options; -guint sound_options; -guint away_options; -guint away_resend; +static guint misc_options; +static guint logging_options; +static guint blist_options; +static guint convo_options; +static guint im_options; +static guint conv_placement_option; +static guint chat_options; +static guint font_options; +static guint sound_options; +static guint away_options; +static guint away_resend; static guint is_loading_prefs = 0; static guint request_save_prefs = 0; static guint is_saving_prefs = 0; @@ -79,6 +185,9 @@ struct window_size conv_size, buddy_chat_size; char web_command[2048] = ""; +static GdkColor fgcolor; +static GdkColor bgcolor; + struct parse { char option[256]; char value[MAX_VALUES][4096]; @@ -923,6 +1032,10 @@ convo_options = atoi(p->value[0]); } else if (!strcmp(p->option, "im_options")) { im_options = atoi(p->value[0]); + + gaim_prefs_set_bool("/gaim/gtk/conversations/hide_im_on_send", + (im_options & OPT_IM_POPDOWN)); + } else if (!strcmp(p->option, "conv_placement")) { conv_placement_option = atoi(p->value[0]); gaim_conv_placement_set_active(conv_placement_option); @@ -930,6 +1043,24 @@ chat_options = atoi(p->value[0]); } else if (!strcmp(p->option, "font_options")) { font_options = atoi(p->value[0]); + + gaim_prefs_set_bool("/gaim/gtk/conversations/send_bold", + (font_options & OPT_FONT_BOLD)); + gaim_prefs_set_bool("/gaim/gtk/conversations/send_italic", + (font_options & OPT_FONT_ITALIC)); + gaim_prefs_set_bool("/gaim/gtk/conversations/send_underline", + (font_options & OPT_FONT_UNDERLINE)); + gaim_prefs_set_bool("/gaim/gtk/conversations/send_strikethrough", + (font_options & OPT_FONT_STRIKE)); + gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_font", + (font_options & OPT_FONT_FACE)); + gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_size", + (font_options & OPT_FONT_SIZE)); + gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_fgcolor", + (font_options & OPT_FONT_FGCOL)); + gaim_prefs_set_bool("/gaim/gtk/conversations/use_custom_bgcolor", + (font_options & OPT_FONT_BGCOL)); + } else if (!strcmp(p->option, "sound_options")) { sound_options = atoi(p->value[0]); gaim_sound_change_output_method(); @@ -937,17 +1068,30 @@ away_options = atoi(p->value[0]); away_resend = atoi(p->value[1]); } else if (!strcmp(p->option, "font_face")) { - g_snprintf(fontface, sizeof(fontface), "%s", p->value[0]); + gaim_prefs_set_string("/gaim/gtk/conversations/font_face", + p->value[0]); } else if (!strcmp(p->option, "font_size")) { - fontsize = atoi(p->value[0]); + gaim_prefs_set_int("/gaim/gtk/conversations/font_size", atoi(p->value[0])); } else if (!strcmp(p->option, "foreground")) { + char buf[8]; fgcolor.red = atoi(p->value[0]); fgcolor.green = atoi(p->value[1]); fgcolor.blue = atoi(p->value[2]); + + g_snprintf(buf, sizeof(buf), "#%2x%2x%2x", + atoi(p->value[0]), atoi(p->value[1]), atoi(p->value[2])); + gaim_prefs_set_string("/gaim/gtk/conversations/fgcolor", buf); + } else if (!strcmp(p->option, "background")) { + char buf[8]; bgcolor.red = atoi(p->value[0]); bgcolor.green = atoi(p->value[1]); bgcolor.blue = atoi(p->value[2]); + + g_snprintf(buf, sizeof(buf), "#%2x%2x%2x", + atoi(p->value[0]), atoi(p->value[1]), atoi(p->value[2])); + gaim_prefs_set_string("/gaim/gtk/conversations/bgcolor", buf); + } else if (!strcmp(p->option, "report_idle")) { report_idle = atoi(p->value[0]); } else if (!strcmp(p->option, "web_browser")) { @@ -1054,8 +1198,8 @@ fprintf(f, "\tfont_options { %u }\n", font_options); fprintf(f, "\tsound_options { %u }\n", sound_options); fprintf(f, "\taway_options { %u } { %u }\n", away_options, away_resend); - fprintf(f, "\tfont_face { %s }\n", fontface); - fprintf(f, "\tfont_size { %d }\n", fontsize); + fprintf(f, "\tfont_face { %s }\n", gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); + fprintf(f, "\tfont_size { %d }\n", gaim_prefs_get_int("/gaim/gtk/conversations/font_size")); fprintf(f, "\tforeground { %d } { %d } { %d }\n", fgcolor.red, fgcolor.green, fgcolor.blue); fprintf(f, "\tbackground { %d } { %d } { %d }\n", bgcolor.red, bgcolor.green, bgcolor.blue); fprintf(f, "\treport_idle { %d }\n", report_idle);
--- a/src/gtkconv.c Thu May 29 17:35:28 2003 +0000 +++ b/src/gtkconv.c Thu May 29 19:10:24 2003 +0000 @@ -45,6 +45,7 @@ #include "sound.h" #include "gtkblist.h" #include "notify.h" +#include "prefs.h" #ifdef _WIN32 #include "win32dep.h" @@ -402,39 +403,41 @@ buf2 = g_malloc(limit); if (gc && gc->flags & OPT_CONN_HTML) { - if (font_options & OPT_FONT_BOLD) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { g_snprintf(buf2, limit, "<B>%s</B>", buf); strcpy(buf, buf2); } - if (font_options & OPT_FONT_ITALIC) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { g_snprintf(buf2, limit, "<I>%s</I>", buf); strcpy(buf, buf2); } - if (font_options & OPT_FONT_UNDERLINE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { g_snprintf(buf2, limit, "<U>%s</U>", buf); strcpy(buf, buf2); } - if (font_options & OPT_FONT_STRIKE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { g_snprintf(buf2, limit, "<STRIKE>%s</STRIKE>", buf); strcpy(buf, buf2); } - if ((font_options & OPT_FONT_FACE) || gtkconv->has_font) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font") || + gtkconv->has_font) { + g_snprintf(buf2, limit, "<FONT FACE=\"%s\">%s</FONT>", gtkconv->fontface, buf); strcpy(buf, buf2); } - if (font_options & OPT_FONT_SIZE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { g_snprintf(buf2, limit, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); strcpy(buf, buf2); } - if (font_options & OPT_FONT_FGCOL) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { g_snprintf(buf2, limit, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", gtkconv->fg_color.red / 256, @@ -443,7 +446,7 @@ strcpy(buf, buf2); } - if (font_options & OPT_FONT_BGCOL) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { g_snprintf(buf2, limit, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", gtkconv->bg_color.red / 256, @@ -460,6 +463,9 @@ else gaim_chat_send(GAIM_CHAT(conv), buf); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/hide_on_send")) + gaim_window_hide(gaim_conversation_get_window(conv)); + g_free(buf); gtk_text_buffer_set_text(gtkconv->entry_buffer, "", -1); @@ -982,7 +988,7 @@ gtkwin = GAIM_GTK_WINDOW(win); if (event->keyval == GDK_Escape) { - if (convo_options & OPT_CONVO_ESC_CAN_CLOSE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/escape_closes")) { g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); gaim_conversation_destroy(conv); } @@ -999,14 +1005,14 @@ if (!(event->state & GDK_CONTROL_MASK)) gtk_imhtml_page_down(GTK_IMHTML(gtkconv->imhtml)); } - else if ((event->keyval == GDK_F2) && - (convo_options & OPT_CONVO_F2_TOGGLES)) { + else if (event->keyval == GDK_F2 && + gaim_prefs_get_bool("/gaim/gtk/conversations/f2_toggles_timestamps")) { gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), !GTK_IMHTML(gtkconv->imhtml)->comments); } else if (event->keyval == GDK_Return || event->keyval == GDK_KP_Enter) { if ((event->state & GDK_CONTROL_MASK) && - (convo_options & OPT_CONVO_CTL_ENTER)) { + gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_enter_sends")) { send_cb(NULL, conv); g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); @@ -1014,7 +1020,7 @@ return TRUE; } else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && - (convo_options & OPT_CONVO_ENTER_SENDS)) { + gaim_prefs_get_bool("/gaim/gtk/conversations/enter_sends")) { send_cb(NULL, conv); g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); @@ -1074,7 +1080,7 @@ break; } - if (convo_options & OPT_CONVO_CTL_CHARS) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/html_shortcuts")) { switch (event->keyval) { case 'i': case 'I': @@ -1142,7 +1148,7 @@ } } - if (convo_options & OPT_CONVO_CTL_SMILEYS) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/smiley_shortcuts")) { char buf[7]; *buf = '\0'; @@ -1179,8 +1185,8 @@ g_string_free(conv->history, TRUE); conv->history = g_string_new(""); } - else if ((event->keyval == 'w') && - (convo_options & OPT_CONVO_CTL_W_CLOSES)) { + else if (event->keyval == 'w' && + gaim_prefs_get_bool("/gaim/gtk/conversations/ctrl_w_closes")) { g_signal_stop_emission_by_name(G_OBJECT(entry), "key_press_event"); gaim_conversation_destroy(conv); @@ -1216,9 +1222,9 @@ return TRUE; } } - else if ((event->keyval == GDK_Tab) && + else if (event->keyval == GDK_Tab && gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && - (chat_options & OPT_CHAT_TAB_COMPLETE)) { + gaim_prefs_get_bool("/gaim/gtk/conversations/chat/tab_completion")) { tab_complete(conv); @@ -1279,7 +1285,7 @@ if (conv == NULL) return; - if (misc_options & OPT_MISC_STEALTH_TYPING) + if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) return; got_typing_keypress(conv, (gtk_text_iter_is_start(position) && @@ -1296,7 +1302,7 @@ if (conv == NULL) return; - if (misc_options & OPT_MISC_STEALTH_TYPING) + if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) return; im = GAIM_IM(conv); @@ -2352,7 +2358,7 @@ entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, &cursor, FALSE); - if (chat_options & OPT_CHAT_OLD_STYLE_TAB) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { if (strlen(entered) >= 2 && !strncmp(": ", entered + strlen(entered) - 2, 2)) { @@ -2391,7 +2397,7 @@ /* if we're here, it's a possible completion */ /* if we're doing old-style, just fill in the completion */ - if (chat_options & OPT_CHAT_OLD_STYLE_TAB) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/old_tab_complete")) { gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); @@ -3006,7 +3012,7 @@ gtk_container_add(GTK_CONTAINER(gtkconv->sw), gtkconv->imhtml); gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - (convo_options & OPT_CONVO_SHOW_TIME)); + gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", G_CALLBACK(entry_stop_rclick_cb), NULL); @@ -3142,7 +3148,7 @@ G_CALLBACK(entry_key_pressed_cb_2), conv); #ifdef USE_GTKSPELL - if (convo_options & OPT_CONVO_CHECK_SPELLING) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); #endif @@ -3199,7 +3205,7 @@ G_CALLBACK(entry_stop_rclick_cb), NULL); gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - (convo_options & OPT_CONVO_SHOW_TIME)); + gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); gaim_setup_imhtml(gtkconv->imhtml); @@ -3243,7 +3249,7 @@ G_CALLBACK(delete_text_cb), conv); #ifdef USE_GTKSPELL - if (convo_options & OPT_CONVO_CHECK_SPELLING) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); #endif @@ -3371,9 +3377,7 @@ /* Create the notebook. */ gtkwin->notebook = gtk_notebook_new(); - pos = ((im_options & OPT_IM_SIDE_TAB) - ? ((im_options & OPT_IM_BR_TAB) ? GTK_POS_RIGHT : GTK_POS_LEFT) - : ((im_options & OPT_IM_BR_TAB) ? GTK_POS_BOTTOM : GTK_POS_TOP)); + pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); #if 0 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(gtkwin->notebook), 0); @@ -3582,7 +3586,7 @@ fd = open_log_file(filename, (conv_type == GAIM_CONV_CHAT)); if (fd) { - if (!(logging_options & OPT_LOG_STRIP_HTML)) + if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) fprintf(fd, "<HR><BR><H3 Align=Center> " "---- New Conversation @ %s ----</H3><BR>\n", @@ -3636,8 +3640,10 @@ gtk_box_pack_start(GTK_BOX(tabby), gtkconv->tab_label, TRUE, TRUE, 0); gtk_widget_show(gtkconv->tab_label); gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); - if (!(convo_options & OPT_CONVO_NO_X_ON_TAB)) + + if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) gtk_widget_show_all(gtkconv->close); + gtk_widget_show(tabby); @@ -3652,16 +3658,11 @@ /* Er, bug in notebooks? Switch to the page manually. */ gtk_notebook_set_current_page(GTK_NOTEBOOK(gtkwin->notebook), 0); - if(conv_type == GAIM_CONV_IM) { - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), - (im_options & OPT_IM_ONE_WINDOW)); - } else if(conv_type == GAIM_CONV_CHAT) { - gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), - (chat_options & OPT_CHAT_ONE_WINDOW)); - } - } else { + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), + gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); + } + else gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), TRUE); - } focus_conv = g_list_nth_data(gaim_window_get_conversations(win), gtk_notebook_get_current_page(GTK_NOTEBOOK(gtkwin->notebook))); @@ -3701,10 +3702,7 @@ /* go back to tabless if need be */ if (gaim_window_get_conversation_count(win) <= 2) { gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gtkwin->notebook), - ((conv_type == GAIM_CONV_IM && - (im_options & OPT_IM_ONE_WINDOW)) || - (conv_type == GAIM_CONV_CHAT && - (im_options & OPT_CHAT_ONE_WINDOW)))); + gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); } @@ -3870,11 +3868,17 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); + if (!(flags & WFLAG_NOLOG) && + gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events")) { + + gaim_window_raise(gaim_conversation_get_window(conv)); + } + /* Play a sound, if specified in prefs. */ if (gtkconv->make_sound) { if (flags & WFLAG_RECV) { if (gtkconv->u.im->a_virgin && - (sound_options & OPT_SOUND_FIRST_RCV)) { + gaim_prefs_get_bool("/gaim/gtk/sound/first_im_recv")) { gaim_sound_play_event(GAIM_SOUND_FIRST_RECEIVE); } @@ -3904,16 +3908,26 @@ if (!(flags & WFLAG_WHISPER) && (flags & WFLAG_SEND)) gaim_sound_play_event(GAIM_SOUND_CHAT_YOU_SAY); else if (flags & WFLAG_RECV) { - if ((flags & WFLAG_NICK) && (sound_options & OPT_SOUND_CHAT_NICK)) + if ((flags & WFLAG_NICK) && + gaim_prefs_get_bool("/gaim/gtk/sound/nick_said")) { + gaim_sound_play_event(GAIM_SOUND_CHAT_NICK); + } else gaim_sound_play_event(GAIM_SOUND_CHAT_SAY); } } - if (chat_options & OPT_CHAT_COLORIZE) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/chat/color_nicks")) flags |= WFLAG_COLORIZE; + /* Raise the window, if specified in prefs. */ + if (!(flags & WFLAG_NOLOG) && + gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) { + + gaim_window_raise(gaim_conversation_get_window(conv)); + } + gaim_conversation_write(conv, who, message, -1, flags, mtime); } @@ -3923,6 +3937,7 @@ time_t mtime) { struct gaim_gtk_conversation *gtkconv; + struct gaim_window *win; struct gaim_connection *gc; int gtk_font_options = 0; GString *log_str; @@ -3941,6 +3956,19 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); gc = gaim_conversation_get_gc(conv); + win = gaim_conversation_get_window(conv); + + if (!(flags & WFLAG_NOLOG) && + ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT && + gaim_prefs_get_bool("/gaim/gtk/conversations/chat/raise_on_events")) || + (gaim_conversation_get_type(conv) == GAIM_CONV_IM && + (gaim_prefs_get_bool("/gaim/gtk/conversations/im/raise_on_events") || + gaim_prefs_get_bool("/gaim/gtk/conversations/im/hide_on_send"))))) { + + gaim_window_show(win); + } + + if(time(NULL) > mtime + 20*60) /* show date if older than 20 minutes */ strftime(mdate, sizeof(mdate), "%Y-%m-%d %H:%M:%S", localtime(&mtime)); else @@ -3951,22 +3979,26 @@ gtk_font_options ^= GTK_IMHTML_NO_COMMENTS; - if (convo_options & OPT_CONVO_IGNORE_COLOUR) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_colors")) gtk_font_options ^= GTK_IMHTML_NO_COLOURS; - if (convo_options & OPT_CONVO_IGNORE_FONTS) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_fonts")) gtk_font_options ^= GTK_IMHTML_NO_FONTS; - if (convo_options & OPT_CONVO_IGNORE_SIZES) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/ignore_font_sizes")) gtk_font_options ^= GTK_IMHTML_NO_SIZES; - if (!(logging_options & OPT_LOG_STRIP_HTML)) + if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) gtk_font_options ^= GTK_IMHTML_RETURN_LOG; - if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & OPT_PROTO_USE_POINTSIZE) + + if (GAIM_PLUGIN_PROTOCOL_INFO(conv->account->gc->prpl)->options & + OPT_PROTO_USE_POINTSIZE) { + gtk_font_options ^= GTK_IMHTML_USE_POINTSIZE; + } if (flags & WFLAG_SYSTEM) { - if (convo_options & OPT_CONVO_SHOW_TIME) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) g_snprintf(buf, BUF_LONG, "(%s) <B>%s</B>", mdate, message); else @@ -3978,7 +4010,7 @@ gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, -1, 0); - if (logging_options & OPT_LOG_STRIP_HTML) { + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { char *t1 = strip_html(buf); conv->history = g_string_append(conv->history, t1); @@ -3996,7 +4028,7 @@ char *t1; char nm[256]; - if (logging_options & OPT_LOG_STRIP_HTML) + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) t1 = strip_html(buf); else t1 = buf; @@ -4011,7 +4043,7 @@ (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); if (fd) { - if (logging_options & OPT_LOG_STRIP_HTML) + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) fprintf(fd, "%s\n", t1); else fprintf(fd, "%s<BR>\n", t1); @@ -4019,7 +4051,7 @@ fclose(fd); } - if (logging_options & OPT_LOG_STRIP_HTML) + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) g_free(t1); } } @@ -4090,7 +4122,7 @@ } } - if (convo_options & OPT_CONVO_SHOW_TIME) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")) g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\" %s>(%s) " "<B>%s</B></FONT> ", color, @@ -4133,7 +4165,7 @@ gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", -1, 0); /* XXX This needs to be updated for the new length argument. */ - if (logging_options & OPT_LOG_STRIP_HTML) { + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { char *t1, *t2; t1 = strip_html(buf); @@ -4173,7 +4205,7 @@ else strncpy(nm, gaim_conversation_get_name(conv), sizeof(nm)); - if (logging_options & OPT_LOG_STRIP_HTML) { + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) { t1 = strip_html(buf); t2 = strip_html(with_font_tag); } @@ -4186,7 +4218,7 @@ (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)); if (fd) { - if (logging_options & OPT_LOG_STRIP_HTML) + if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) fprintf(fd, "%s%s\n", t1, t2); else { fprintf(fd, "%s%s%s<BR>\n", t1, t2, log_str->str); @@ -4504,7 +4536,7 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); gtk_imhtml_show_smileys(GTK_IMHTML(gtkconv->imhtml), - (convo_options & OPT_CONVO_SHOW_SMILEY)); + gaim_prefs_get_bool("/gaim/gtk/conversations/show_smilies")); } } @@ -4525,7 +4557,7 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), - (convo_options & OPT_CONVO_SHOW_TIME)); + gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); } } @@ -4547,7 +4579,7 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); - if (convo_options & OPT_CONVO_CHECK_SPELLING) + if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck")) gtkspell_new_attach(GTK_TEXT_VIEW(gtkconv->entry), NULL, NULL); else { spell = gtkspell_get_from_text_view(GTK_TEXT_VIEW(gtkconv->entry)); @@ -4571,7 +4603,7 @@ gtkconv = GAIM_GTK_CONVERSATION(conv); - if (convo_options & OPT_CONVO_NO_X_ON_TAB) + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) gtk_widget_hide(gtkconv->close); else gtk_widget_show_all(gtkconv->close); @@ -4776,7 +4808,7 @@ remove_icon(gtkconv); - if (im_options & OPT_IM_HIDE_ICONS) + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) return; if (gaim_conversation_get_gc(conv) == NULL) @@ -4875,8 +4907,10 @@ gtk_container_add(GTK_CONTAINER(event), gtkconv->u.im->icon); gtk_widget_show(gtkconv->u.im->icon); - if ((im_options & OPT_IM_NO_ANIMATION) || animate == FALSE) + if (!animate || + !gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { stop_anim(NULL, conv); + } g_object_unref(G_OBJECT(pm)); @@ -4895,10 +4929,10 @@ { GList *l; - if (im_options & OPT_IM_HIDE_ICONS) + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) return; - if (im_options & OPT_IM_NO_ANIMATION) { + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons")) { for (l = gaim_get_ims(); l != NULL; l = l->next) stop_anim(NULL, (struct gaim_conversation *)l->data); } else { @@ -4924,15 +4958,15 @@ if (gtkconv->toolbar.bold != NULL) gtk_widget_set_sensitive(gtkconv->toolbar.bold, - (!(font_options & OPT_FONT_BOLD))); + !gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")); if (gtkconv->toolbar.italic != NULL) gtk_widget_set_sensitive(gtkconv->toolbar.italic, - (!(font_options & OPT_FONT_ITALIC))); + !gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")); if (gtkconv->toolbar.underline != NULL) gtk_widget_set_sensitive(gtkconv->toolbar.underline, - (!(font_options & OPT_FONT_UNDERLINE))); + !gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")); } } @@ -4945,14 +4979,12 @@ return; gtkconv = GAIM_GTK_CONVERSATION(conv); - - gtkconv->fg_color.red = fgcolor.red; - gtkconv->fg_color.blue = fgcolor.blue; - gtkconv->fg_color.green = fgcolor.green; - - gtkconv->bg_color.red = bgcolor.red; - gtkconv->bg_color.blue = bgcolor.blue; - gtkconv->bg_color.green = bgcolor.green; + + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), + >kconv->fg_color); + + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), + >kconv->bg_color); } void @@ -4976,9 +5008,7 @@ struct gaim_window *win; struct gaim_gtk_window *gtkwin; - pos = ((im_options & OPT_IM_SIDE_TAB) - ? ((im_options & OPT_IM_BR_TAB) ? GTK_POS_RIGHT : GTK_POS_LEFT) - : ((im_options & OPT_IM_BR_TAB) ? GTK_POS_BOTTOM : GTK_POS_TOP)); + pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); for (l = gaim_get_windows(); l != NULL; l = l->next) { win = (struct gaim_window *)l->data;
--- a/src/gtkprefs.c Thu May 29 17:35:28 2003 +0000 +++ b/src/gtkprefs.c Thu May 29 19:10:24 2003 +0000 @@ -53,45 +53,256 @@ #include "win32dep.h" #endif -GtkWidget *tree_v = NULL; -GtkWidget *prefs_away_menu = NULL; -GtkWidget *fontseld = NULL; - -GtkListStore *prefs_away_store = NULL; +#define PROXYHOST 0 +#define PROXYPORT 1 +#define PROXYTYPE 2 +#define PROXYUSER 3 +#define PROXYPASS 4 + +static GtkWidget *tree_v = NULL; +static GtkWidget *prefs_away_menu = NULL; +static GtkWidget *fontseld = NULL; + +static GtkListStore *prefs_away_store = NULL; static int sound_row_sel = 0; static char *last_sound_dir = NULL; +static GtkWidget *preflabel; +static GtkWidget *prefsnotebook; +static GtkTreeStore *prefstree; + static GtkWidget *sounddialog = NULL; static GtkWidget *browser_entry = NULL; static GtkWidget *sound_entry = NULL; static GtkWidget *away_text = NULL; static GtkListStore *smiley_theme_store = NULL; -GtkWidget *prefs_proxy_frame = NULL; -static GtkWidget *gaim_button(const char *, guint *, int, GtkWidget *); -GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, int, int, GtkSizeGroup *); -static GtkWidget *gaim_dropdown(GtkWidget *, const gchar *, int *, int, ...); -static GtkWidget *gaim_dropdown_from_list(GtkWidget *, const gchar *, int *, int, GList *); -static GtkWidget *show_color_pref(GtkWidget *, gboolean); -static void delete_prefs(GtkWidget *, void *); -void set_default_away(GtkWidget *, gpointer); -#ifndef _WIN32 -static gboolean program_is_valid(const char *); -#endif +static GtkWidget *prefs_proxy_frame = NULL; static GtkWidget *prefs = NULL; -GtkWidget *debugbutton = NULL; +static GtkWidget *debugbutton = NULL; static int notebook_page = 0; static GtkTreeIter plugin_iter; /* * PROTOTYPES */ -GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, GtkWidget*, GtkTreeIter*, GtkTreeIter*, int); - +static GtkTreeIter *prefs_notebook_add_page(const char*, GdkPixbuf*, + GtkWidget*, GtkTreeIter*, + GtkTreeIter*, int); +static GtkWidget *prefs_checkbox(const char *, const char *, int, GtkWidget *); +GtkWidget *gaim_labeled_spin_button(GtkWidget *, const gchar *, int*, + int, int, GtkSizeGroup *); +static GtkWidget *prefs_dropdown(GtkWidget *, const gchar *, const char *, + int, ...); +static GtkWidget *prefs_dropdown_from_list(GtkWidget *, const gchar *, + const char *, int, GList *); +static GtkWidget *show_color_pref(GtkWidget *, gboolean); +static void delete_prefs(GtkWidget *, void *); static void update_plugin_list(void *data); -void delete_prefs(GtkWidget *asdf, void *gdsa) { +#ifndef _WIN32 +static gboolean program_is_valid(const char *); +#endif + +void set_default_away(GtkWidget *, gpointer); + +static void +update_spin_value(GtkWidget *w, GtkWidget *spin) +{ + const char *key = g_object_get_data(G_OBJECT(spin), "val"); + int value; + + value = gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spin)); + + gaim_prefs_set_int(key, value); +} + +static GtkWidget * +gaim_labeled_spin_button(GtkWidget *box, const gchar *title, const char *key, + int min, int max, GtkSizeGroup *sg) +{ + 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_with_mnemonic(title); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); + spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); + g_object_set_data(G_OBJECT(spin), "val", key); + gtk_widget_set_size_request(spin, 50, -1); + gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); + g_signal_connect(G_OBJECT(adjust), "value-changed", + G_CALLBACK(update_spin_value), GTK_WIDGET(spin)); + gtk_widget_show(spin); + + gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); + + if (sg) { + gtk_size_group_add_widget(sg, label); + gtk_misc_set_alignment(GTK_MISC(label), 0, 0); + } + + return label; +} + +static void +dropdown_set(GObject *w, const char *key) +{ + int opt = GPOINTER_TO_INT(g_object_get_data(w, "value")); + int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear")); + + if (option == (int*)&sort_method) { + /* Hack city -- Population: Sean Egan */ + char *name = (char*)opt; + gaim_gtk_blist_sort_method_set(name); + return; + } + if (clear != -1) { + *option = *option & ~clear; + *option = *option | opt; + } else { + gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt); + *option = opt; + } + + if (option == (int*)&global_proxy_info.proxytype) { + 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) { + if (opt == BROWSER_MANUAL) + gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), TRUE); + else + gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), FALSE); + } else if (option == (int*)&sound_options) { + if (opt == OPT_SOUND_CMD) + gtk_widget_set_sensitive(sndcmd, TRUE); + else + gtk_widget_set_sensitive(sndcmd, FALSE); + gaim_sound_change_output_method(); + } else if (option == (int*)&blist_options) { + gaim_gtk_blist_update_toolbar(); + } else if (option == (int*)&im_options) { + if (clear == (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB)) + gaim_gtkconv_update_tabs(); + else if (clear == (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) + gaim_gtkconv_update_im_button_style(); + } else if (option == (int*)&chat_options) { + if (clear == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB)) + gaim_gtkconv_update_tabs(); + else if (clear == (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) + gaim_gtkconv_update_chat_button_style(); + // } else if (option == (int*)&blist_options) { + // set_blist_tab(); + } else if (option == (int *)&conv_placement_option) { + gaim_conv_placement_set_active(conv_placement_option); + } +} + +static GtkWidget * +prefs_dropdown_from_list(GtkWidget *box, const gchar *title, const char *key, + GList *menuitems) +{ + GtkWidget *dropdown, *opt, *menu; + GtkWidget *label; + gchar *text; + int value; + int stored_value; + int o = 0; + GtkWidget *hbox; + + g_return_val_if_fail(menuitems != NULL, NULL); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER (box), hbox); + gtk_widget_show(hbox); + + label = gtk_label_new_with_mnemonic(title); + gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); + gtk_widget_show(label); + + dropdown = gtk_option_menu_new(); + menu = gtk_menu_new(); + + gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); + + stored_value = gaim_prefs_get_int(key); + + while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { + menuitems = g_list_next(menuitems); + g_return_val_if_fail(menuitems != NULL, NULL); + value = GPOINTER_TO_INT(menuitems->data); + menuitems = g_list_next(menuitems); + + opt = gtk_menu_item_new_with_label(text); + g_object_set_data(G_OBJECT(opt), "value", GINT_TO_POINTER(value)); + g_object_set_data(G_OBJECT(opt), "clear", GINT_TO_POINTER(clear)); + g_signal_connect(G_OBJECT(opt), "activate", + G_CALLBACK(dropdown_set), (void *)option); + gtk_widget_show(opt); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); + + if (clear > -1 && stored_value == value) + gtk_menu_set_active(GTK_MENU(menu), o); +#if 0 + if (option == (int*)sort_method) { + /* Now Entering Hacksville, Estd. May 17, 2003 */ + gtk_menu_set_active(GTK_MENU(menu), clear); + } else if (((clear > -1) && ((*option & clear) == value)) || *option == value) { + gtk_menu_set_active(GTK_MENU(menu), o); + } +#endif + + o++; + } + + 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 label; +} + +static GtkWidget * +prefs_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) +{ + va_list ap; + GList *menuitems = NULL; + GtkWidget *dropdown = NULL; + char *name; + int id; + + va_start(ap, clear); + while ((name = va_arg(ap, char *)) != NULL) { + id = va_arg(ap, int); + + menuitems = g_list_prepend(menuitems, name); + menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(id)); + } + va_end(ap); + + g_return_val_if_fail(menuitems != NULL, NULL); + + menuitems = g_list_reverse(menuitems); + + dropdown = prefs_dropdown_from_list(box, title, option, clear, menuitems); + + g_list_free(menuitems); + + return dropdown; +} + + +static void delete_prefs(GtkWidget *asdf, void *gdsa) { GList *l; GaimPlugin *plug; @@ -127,25 +338,6 @@ } } -GtkWidget *preflabel; -GtkWidget *prefsnotebook; -GtkTreeStore *prefstree; - -static void set_misc_option(); -static void set_logging_option(); -static void set_blist_option(); -static void set_convo_option(); -static void set_im_option(); -static void set_chat_option(); -static void set_font_option(); -static void set_sound_option(); -static void set_away_option(); - -#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) @@ -189,7 +381,8 @@ vbox = gaim_gtk_make_frame(ret, _("Interface Options")); - gaim_button(_("D_isplay remote nicknames if no alias is set"), &misc_options, OPT_MISC_USE_SERVER_ALIAS, vbox); + prefs_checkbox(_("D_isplay remote nicknames if no alias is set"), + "/core/buddies/use_server_alias", vbox); gtk_widget_show_all(ret); @@ -432,22 +625,27 @@ GdkColor c; GtkStyle *style; c.pixel = 0; + GdkColor color; if (pic == pref_fg_picture) { - if (font_options & OPT_FONT_FGCOL) { - c.red = fgcolor.red; - c.blue = fgcolor.blue; - c.green = fgcolor.green; + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), + &color); + c.red = color.red; + c.blue = color.blue; + c.green = color.green; } else { c.red = 0; c.blue = 0; c.green = 0; } } else { - if (font_options & OPT_FONT_BGCOL) { - c.red = bgcolor.red; - c.blue = bgcolor.blue; - c.green = bgcolor.green; + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { + gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), + &color); + c.red = color.red; + c.blue = color.blue; + c.green = color.green; } else { c.red = 0xffff; c.blue = 0xffff; @@ -461,33 +659,6 @@ g_object_unref(style); } -static void -set_bool_pref(GtkWidget *w, const char *key) -{ - gaim_prefs_set_bool(key, - gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); -} - -static GtkWidget * -pref_checkbox(const char *text, char *key, GtkWidget *page) -{ - GtkWidget *button; - - button = gtk_check_button_new_with_mnemonic(text); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), - gaim_prefs_get_bool(key)); - - gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); - - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_bool_pref), key); - - gtk_widget_show(button); - - return button; -} - - GtkWidget *font_page() { GtkWidget *ret; GtkWidget *button; @@ -499,20 +670,26 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); vbox = gaim_gtk_make_frame(ret, _("Style")); - gaim_button(_("_Bold"), &font_options, OPT_FONT_BOLD, vbox); - gaim_button(_("_Italics"), &font_options, OPT_FONT_ITALIC, vbox); - gaim_button(_("_Underline"), &font_options, OPT_FONT_UNDERLINE, vbox); - gaim_button(_("_Strikethrough"), &font_options, OPT_FONT_STRIKE, vbox); + prefs_checkbox(_("_Bold"), + "/gaim/gtk/conversations/send_bold", vbox); + prefs_checkbox(_("_Italics"), + "/gaim/gtk/conversations/send_italics", vbox); + prefs_checkbox(_("_Underline"), + "/gaim/gtk/conversations/send_underline", vbox); + prefs_checkbox(_("_Strikethrough"), + "/gaim/gtk/conversations/send_strikethrough", vbox); vbox = gaim_gtk_make_frame(ret, _("Face")); hbox = gtk_hbox_new(FALSE, 6); gtk_container_add(GTK_CONTAINER(vbox), hbox); - button = gaim_button(_("Use custo_m face"), &font_options, OPT_FONT_FACE, hbox); + button = prefs_checkbox(_("Use custo_m face"), + "/gaim/gtk/conversations/use_custom_font", hbox); gtk_size_group_add_widget(sg, button); select = gtk_button_new_from_stock(GTK_STOCK_SELECT_FONT); - if (!(font_options & OPT_FONT_FACE)) + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), select); g_signal_connect(G_OBJECT(select), "clicked", @@ -521,11 +698,15 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(vbox), hbox); - button = gaim_button(_("Use custom si_ze"), &font_options, OPT_FONT_SIZE, hbox); + + button = prefs_checkbox(_("Use custom si_ze"), + "/gaim/gtk/conversations/use_custom_font", hbox); gtk_size_group_add_widget(sg, button); select = gaim_labeled_spin_button(hbox, NULL, &fontsize, 1, 7, NULL); - if (!(font_options & OPT_FONT_SIZE)) + + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), select); @@ -533,8 +714,8 @@ hbox = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(vbox), hbox); - - button = gaim_button(_("_Text color"), &font_options, OPT_FONT_FGCOL, hbox); + button = prefs_checkbox(_("_Text color"), + "/gaim/gtk/conversations/use_custom_fgcolor", hbox); gtk_size_group_add_widget(sg, button); select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); @@ -543,24 +724,27 @@ g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(update_color), pref_fg_picture); - if (!(font_options & OPT_FONT_FGCOL)) + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), select); g_signal_connect(G_OBJECT(select), "clicked", G_CALLBACK(show_fgcolor_dialog), NULL); hbox = gtk_hbox_new(FALSE, 5); gtk_container_add(GTK_CONTAINER(vbox), hbox); - button = gaim_button(_("Bac_kground color"), &font_options, OPT_FONT_BGCOL, hbox); + button = prefs_checkbox(_("Bac_kground color"), + "/gaim/gtk/conversations/use_custom_bgcolor", hbox); gtk_size_group_add_widget(sg, button); select = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); gtk_box_pack_start(GTK_BOX(hbox), select, FALSE, FALSE, 0); pref_bg_picture = show_color_pref(hbox, FALSE); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(update_color), pref_bg_picture); - - if (!(font_options & OPT_FONT_BGCOL)) + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(update_color), pref_bg_picture); + + if (!gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); + g_signal_connect(G_OBJECT(select), "clicked", G_CALLBACK(show_bgcolor_dialog), NULL); g_signal_connect(G_OBJECT(button), "clicked", @@ -578,18 +762,24 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); vbox = gaim_gtk_make_frame (ret, _("Display")); - 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); - pref_checkbox(_("Show _URLs as links"), + prefs_checkbox(_("Show graphical _smileys"), + "/gaim/gtk/conversations/show_smilies", vbox); + prefs_checkbox(_("Show _timestamp on messages"), + "/gaim/gtk/conversations/show_timestamps", vbox); + prefs_checkbox(_("Show _URLs as links"), "/gaim/gtk/conversations/show_urls_as_links", vbox); #ifdef USE_GTKSPELL - gaim_button(_("_Highlight misspelled words"), &convo_options, OPT_CONVO_CHECK_SPELLING, vbox); + prefs_checkbox(_("_Highlight misspelled words"), + "/gaim/gtk/conversations/spellcheck", vbox); #endif vbox = gaim_gtk_make_frame (ret, _("Ignore")); - gaim_button(_("Ignore c_olors"), &convo_options, OPT_CONVO_IGNORE_COLOUR, vbox); - gaim_button(_("Ignore font _faces"), &convo_options, OPT_CONVO_IGNORE_FONTS, vbox); - gaim_button(_("Ignore font si_zes"), &convo_options, OPT_CONVO_IGNORE_SIZES, vbox); + prefs_checkbox(_("Ignore c_olors"), + "/gaim/gtk/conversations/ignore_colors", vbox); + prefs_checkbox(_("Ignore font _faces"), + "/gaim/gtk/conversations/ignore_fonts", vbox); + prefs_checkbox(_("Ignore font si_zes"), + "/gaim/gtk/conversations/ignore_font_sizes", vbox); gtk_widget_show_all(ret); return ret; @@ -602,16 +792,22 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); vbox = gaim_gtk_make_frame(ret, _("Send Message")); - gaim_button(_("_Enter sends message"), &convo_options, OPT_CONVO_ENTER_SENDS, vbox); - gaim_button(_("C_ontrol-Enter sends message"), &convo_options, OPT_CONVO_CTL_ENTER, vbox); + prefs_checkbox(_("_Enter sends message"), + "/gaim/gtk/conversations/enter_sends", vbox); + prefs_checkbox(_("C_ontrol-Enter sends message"), + "/gaim/gtk/conversations/ctrl_enter_sends", vbox); vbox = gaim_gtk_make_frame (ret, _("Window Closing")); - gaim_button(_("E_scape closes window"), &convo_options, OPT_CONVO_ESC_CAN_CLOSE, vbox); - gaim_button(_("Control-_W closes window"), &convo_options, OPT_CONVO_CTL_W_CLOSES, vbox); + prefs_checkbox(_("E_scape closes window"), + "/gaim/gtk/conversations/escape_closes", vbox); + prefs_checkbox(_("Control-_W closes window"), + "/gaim/gtk/conversations/ctrl_w_closes", vbox); vbox = gaim_gtk_make_frame(ret, _("Insertions")); - 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); + prefs_checkbox(_("Control-{B/I/U/S} inserts _HTML tags"), + "/gaim/gtk/conversations/html_shortcuts", vbox); + prefs_checkbox(_("Control-(number) inserts _smileys"), + "/gaim/gtk/conversations/smiley_shortcuts", vbox); gtk_widget_show_all(ret); return ret; @@ -638,38 +834,46 @@ sl = sl->next; if (!fnd) r++; } - gaim_dropdown_from_list(vbox, _("Sorting:"), + prefs_dropdown_from_list(vbox, _("Sorting:"), (int*)&sort_method, r, l); g_list_free(l); vbox = gaim_gtk_make_frame (ret, _("Buddy List Toolbar")); - gaim_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, + prefs_dropdown(vbox, _("Show _buttons as:"), &blist_options, OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, _("Pictures"), OPT_BLIST_SHOW_BUTTON_XPM | OPT_BLIST_NO_BUTTON_TEXT, _("Text"), 0, _("Pictures and text"), OPT_BLIST_SHOW_BUTTON_XPM, _("None"), OPT_BLIST_NO_BUTTON_TEXT, NULL); vbox = gaim_gtk_make_frame (ret, _("Buddy List Window")); - gaim_button(_("_Raise window on events"), &blist_options, OPT_BLIST_POPUP, vbox); + prefs_checkbox(_("_Raise window on events"), + "/gaim/gtk/blist/raise_on_events", vbox); vbox = gaim_gtk_make_frame (ret, _("Group Display")); - /* gaim_button(_("Hide _groups with no online buddies"), &blist_options, OPT_BLIST_NO_MT_GRP, vbox); */ - gaim_button(_("Show _numbers in groups"), &blist_options, OPT_BLIST_SHOW_GRPNUM, vbox); + /* prefs_checkbox(_("Show _groups with no online buddies"), "/gaim/gtk/blist/show_empty_groups", vbox); */ + prefs_checkbox(_("Show _numbers in groups"), + "/gaim/gtk/blist/show_group_count", vbox); vbox = gaim_gtk_make_frame (ret, _("Buddy Display")); - button = gaim_button(_("Show buddy _icons"), &blist_options, OPT_BLIST_SHOW_ICONS, vbox); - b2 = gaim_button(_("Show _warning levels"), &blist_options, OPT_BLIST_SHOW_WARN, vbox); + button = prefs_checkbox(_("Show buddy _icons"), + "/gaim/gtk/blist/show_buddy_icons", vbox); + b2 = prefs_checkbox(_("Show _warning levels"), + "/gaim/gtk/blist/show_warning_level", vbox); + + if (blist_options & OPT_BLIST_SHOW_ICONS) + gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE); + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(gaim_gtk_toggle_sensitive), b2); + b2 = prefs_checkbox(_("Show idle _times"), + "/gaim/gtk/blist/show_idle_time", vbox); if (blist_options & OPT_BLIST_SHOW_ICONS) gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(gaim_gtk_toggle_sensitive), b2); - b2 = gaim_button(_("Show idle _times"), &blist_options, OPT_BLIST_SHOW_IDLETIME, vbox); - if (blist_options & OPT_BLIST_SHOW_ICONS) - gtk_widget_set_sensitive(GTK_WIDGET(b2), FALSE); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(gaim_gtk_toggle_sensitive), b2); - gaim_button(_("Dim i_dle buddies"), &blist_options, OPT_BLIST_GREY_IDLERS, vbox); + prefs_checkbox(_("Dim i_dle buddies"), + "/gaim/gtk/blist/grey_idle_buddies", vbox); gtk_widget_show_all(ret); return ret; @@ -695,7 +899,7 @@ names = g_list_append(names, GINT_TO_POINTER(i)); } - label = gaim_dropdown_from_list(vbox, _("_Placement:"), + label = prefs_dropdown_from_list(vbox, _("_Placement:"), &conv_placement_option, -1, names); g_list_free(names); @@ -703,9 +907,10 @@ gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_size_group_add_widget(sg, label); - gaim_button(_("Show IMs and chats in _same tabbed window"), - &convo_options, OPT_CONVO_COMBINE, vbox); - pref_checkbox(_("Send _URLs as Links"), + prefs_checkbox(_("Show IMs and chats in _tabbed windows"), + "/gaim/gtk/conversations/tabs", vbox); + + prefs_checkbox(_("Send _URLs as Links"), "/core/conversations/send_urls_as_links", vbox); gtk_widget_show_all(ret); @@ -725,7 +930,7 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("Window")); - widge = gaim_dropdown(vbox, _("Show _buttons as:"), &im_options, OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM, + widge = prefs_dropdown(vbox, _("Show _buttons as:"), &im_options, 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); @@ -734,21 +939,27 @@ gaim_labeled_spin_button(vbox, _("New window _width:"), &conv_size.width, 25, 9999, sg); gaim_labeled_spin_button(vbox, _("New window _height:"), &conv_size.height, 25, 9999, sg); gaim_labeled_spin_button(vbox, _("_Entry field height:"), &conv_size.entry_height, 25, 9999, sg); - gaim_button(_("_Raise windows on events"), &im_options, OPT_IM_POPUP, vbox); - gaim_button(_("Hide window on _send"), &im_options, OPT_IM_POPDOWN, vbox); + prefs_checkbox(_("_Raise windows on events"), + "/gaim/gtk/conversations/im/raise_on_events", vbox); + prefs_checkbox(_("Hide window on _send"), + "/gaim/gtk/conversations/hide_im_on_send", vbox); gtk_widget_show (vbox); vbox = gaim_gtk_make_frame (ret, _("Buddy Icons")); - gaim_button(_("Hide buddy _icons"), &im_options, OPT_IM_HIDE_ICONS, vbox); - gaim_button(_("Disable buddy icon a_nimation"), &im_options, OPT_IM_NO_ANIMATION, vbox); + prefs_checkbox(_("Show buddy _icons"), + "/gaim/gtk/conversations/show_buddy_icons", vbox); + prefs_checkbox(_("Enable buddy icon a_nimation"), + "/gaim/gtk/conversations/im/animate_buddy_icons", vbox); vbox = gaim_gtk_make_frame (ret, _("Display")); - gaim_button(_("Show _logins in window"), &im_options, OPT_IM_LOGON, vbox); - gaim_button(_("Show a_liases in tabs/titles"), &im_options, OPT_IM_ALIAS_TAB, vbox); + prefs_checkbox(_("Show _logins in window"), + "/core/conversations/im/show_login", vbox); + prefs_checkbox(_("Show a_liases in tabs/titles"), + "/core/conversations/use_alias_for_title", vbox); vbox = gaim_gtk_make_frame (ret, _("Typing Notification")); - typingbutton = gaim_button(_("Notify buddies that you are _typing to them"), &misc_options, - OPT_MISC_STEALTH_TYPING, vbox); + typingbutton = prefs_checkbox(_("Notify buddies that you are _typing to them"), + "/core/conversations/im/send_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; @@ -768,7 +979,7 @@ sg = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("Window")); - dd = gaim_dropdown(vbox, _("Show _buttons as:"), &chat_options, OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM, + dd = prefs_dropdown(vbox, _("Show _buttons as:"), &chat_options, 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); @@ -777,15 +988,22 @@ gaim_labeled_spin_button(vbox, _("New window _width:"), &buddy_chat_size.width, 25, 9999, sg); gaim_labeled_spin_button(vbox, _("New window _height:"), &buddy_chat_size.height, 25, 9999, sg); gaim_labeled_spin_button(vbox, _("_Entry field height:"), &buddy_chat_size.entry_height, 25, 9999, sg); - gaim_button(_("_Raise windows on events"), &chat_options, OPT_CHAT_POPUP, vbox); + prefs_checkbox(_("_Raise windows on events"), + "/gaim/gtk/conversations/chat/raise_on_events", vbox); vbox = gaim_gtk_make_frame (ret, _("Tab Completion")); - gaim_button(_("_Tab-complete nicks"), &chat_options, OPT_CHAT_TAB_COMPLETE, vbox); - gaim_button(_("_Old-style tab completion"), &chat_options, OPT_CHAT_OLD_STYLE_TAB, vbox); + prefs_checkbox(_("_Tab-complete nicks"), + "/gaim/gtk/conversations/chat/tab_completion", vbox); + prefs_checkbox(_("_Old-style tab completion"), + "/gaim/gtk/conversations/chat/old_tab_complete", vbox); vbox = gaim_gtk_make_frame (ret, _("Display")); - gaim_button(_("_Show people joining/leaving in window"), &chat_options, OPT_CHAT_LOGON, vbox); - gaim_button(_("Co_lorize screennames"), &chat_options, OPT_CHAT_COLORIZE, vbox); + prefs_checkbox(_("_Show people joining in window"), + "/core/conversations/chat/show_join", vbox); + prefs_checkbox(_("_Show people leaving in window"), + "/core/conversations/chat/show_leave", vbox); + prefs_checkbox(_("Co_lorize screennames"), + "/gaim/gtk/conversations/chat/color_nicks", vbox); gtk_widget_show_all(ret); return ret; @@ -803,27 +1021,28 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("IM Tabs")); - dd = gaim_dropdown(vbox, _("Tab _placement:"), &im_options, OPT_IM_SIDE_TAB | OPT_IM_BR_TAB, + dd = prefs_dropdown(vbox, _("Tab _placement:"), &im_options, 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); gtk_size_group_add_widget(sg, dd); - gaim_button(_("Show all _instant messages in one tabbed\nwindow"), &im_options, OPT_IM_ONE_WINDOW, vbox); + prefs_checkbox(_("Show all _instant messages in one tabbed\nwindow"), + &im_options, OPT_IM_ONE_WINDOW, vbox); vbox = gaim_gtk_make_frame (ret, _("Chat Tabs")); - dd = gaim_dropdown(vbox, _("Tab _placement:"), &chat_options, OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB, + dd = prefs_dropdown(vbox, _("Tab _placement:"), &chat_options, 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); gtk_size_group_add_widget(sg, dd); - gaim_button(_("Show all c_hats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW, + prefs_checkbox(_("Show all c_hats in one tabbed window"), &chat_options, OPT_CHAT_ONE_WINDOW, vbox); vbox = gaim_gtk_make_frame (ret, _("Tab Options")); - button = gaim_button(_("Show _close button on tabs."), &convo_options, OPT_CONVO_NO_X_ON_TAB, vbox); + button = prefs_checkbox(_("Show _close button on tabs."), &convo_options, OPT_CONVO_NO_X_ON_TAB, vbox); convo_options ^= OPT_CONVO_NO_X_ON_TAB; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(button), !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))); @@ -844,11 +1063,12 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); vbox = gaim_gtk_make_frame (ret, _("Proxy Type")); - gaim_dropdown(vbox, _("Proxy _type:"), (int*)&global_proxy_info.proxytype, -1, - _("No proxy"), PROXY_NONE, - "SOCKS 4", PROXY_SOCKS4, - "SOCKS 5", PROXY_SOCKS5, - "HTTP", PROXY_HTTP, NULL); + prefs_dropdown(vbox, _("Proxy _type:"), "/core/proxy/type", -1, + _("No proxy"), PROXY_NONE, + "SOCKS 4", PROXY_SOCKS4, + "SOCKS 5", PROXY_SOCKS5, + "HTTP", PROXY_HTTP, + NULL); vbox = gaim_gtk_make_frame(ret, _("Proxy Server")); prefs_proxy_frame = vbox; @@ -989,7 +1209,7 @@ browsers = get_available_browsers(); if (browsers != NULL) { - label = gaim_dropdown_from_list(vbox,_("_Browser"), &web_browser, -1, + label = prefs_dropdown_from_list(vbox,_("_Browser"), &web_browser, -1, browsers); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); gtk_size_group_add_widget(sg, label); @@ -1013,7 +1233,8 @@ if (browsers != NULL) { vbox = gaim_gtk_make_frame (ret, _("Browser Options")); - label = gaim_button(_("Open new _window by default"), &misc_options, OPT_MISC_BROWSER_POPUP, vbox); + label = prefs_checkbox(_("Open new _window by default"), + "/gaim/gtk/browsers/new_window", vbox); } gtk_widget_show_all(ret); @@ -1028,19 +1249,22 @@ gtk_container_set_border_width (GTK_CONTAINER (ret), 12); vbox = gaim_gtk_make_frame (ret, _("Message Logs")); - gaim_button(_("_Log all instant messages"), &logging_options, OPT_LOG_CONVOS, vbox); - gaim_button(_("Log all c_hats"), &logging_options, OPT_LOG_CHATS, vbox); - gaim_button(_("Strip _HTML from logs"), &logging_options, OPT_LOG_STRIP_HTML, vbox); + prefs_checkbox(_("_Log all instant messages"), + "/gaim/gtk/logging/log_chats", vbox); + prefs_checkbox(_("Log all c_hats"), + "/gaim/gtk/logging/log_ims", vbox); + prefs_checkbox(_("Strip _HTML from logs"), + "/gaim/gtk/logging/strip_html", vbox); vbox = gaim_gtk_make_frame (ret, _("System Logs")); - gaim_button(_("Log when buddies _sign on/sign off"), &logging_options, OPT_LOG_BUDDY_SIGNON, + prefs_checkbox(_("Log when buddies _sign on/sign off"), &logging_options, OPT_LOG_BUDDY_SIGNON, vbox); - gaim_button(_("Log when buddies become _idle/un-idle"), &logging_options, OPT_LOG_BUDDY_IDLE, + prefs_checkbox(_("Log when buddies become _idle/un-idle"), &logging_options, OPT_LOG_BUDDY_IDLE, vbox); - gaim_button(_("Log when buddies go away/come _back"), &logging_options, OPT_LOG_BUDDY_AWAY, vbox); - gaim_button(_("Log your _own signons/idleness/awayness"), &logging_options, OPT_LOG_MY_SIGNON, + prefs_checkbox(_("Log when buddies go away/come _back"), &logging_options, OPT_LOG_BUDDY_AWAY, vbox); + prefs_checkbox(_("Log your _own signons/idleness/awayness"), &logging_options, OPT_LOG_MY_SIGNON, vbox); - gaim_button(_("I_ndividual log file for each buddy's signons"), &logging_options, + prefs_checkbox(_("I_ndividual log file for each buddy's signons"), &logging_options, OPT_LOG_INDIVIDUAL, vbox); gtk_widget_show_all(ret); @@ -1074,12 +1298,12 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("Sound Options")); - 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); + prefs_checkbox(_("_No sounds when you log in"), &sound_options, OPT_SOUND_SILENT_SIGNON, vbox); + prefs_checkbox(_("_Sounds while away"), &sound_options, OPT_SOUND_WHEN_AWAY, vbox); #ifndef _WIN32 vbox = gaim_gtk_make_frame (ret, _("Sound Method")); - dd = gaim_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP | + dd = prefs_dropdown(vbox, _("_Method"), &sound_options, OPT_SOUND_BEEP | OPT_SOUND_ESD | OPT_SOUND_ARTS | OPT_SOUND_NAS | OPT_SOUND_NORMAL | OPT_SOUND_CMD, _("Console beep"), OPT_SOUND_BEEP, @@ -1139,23 +1363,28 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); vbox = gaim_gtk_make_frame (ret, _("Away")); - 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); + prefs_checkbox(_("_Sending messages removes away status"), + "/core/conversations/away_back_on_send", vbox); + prefs_checkbox(_("_Queue new messages when away"), + "/core/away/queue_messages", vbox); vbox = gaim_gtk_make_frame (ret, _("Auto-response")); hbox = gtk_hbox_new(FALSE, 0); gtk_container_add(GTK_CONTAINER(vbox), hbox); gaim_labeled_spin_button(hbox, _("Seconds before _resending:"), &away_resend, 1, 24 * 60 * 60, sg); - 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, OPT_AWAY_IDLE_RESP, vbox); - gaim_button(_("Do_n't send auto-response in active conversations"), &away_options, OPT_AWAY_DELAY_IN_USE, vbox); - - if (away_options & OPT_AWAY_NO_AUTO_RESP) + prefs_checkbox(_("_Send auto-response"), + "/core/away/auto_response/enabled", vbox); + prefs_checkbox(_("_Only send auto-response when idle"), + "/core/away/auto_response/idle_only", vbox); + prefs_checkbox(_("Send auto-response in active conversations"), + "/core/away/auto_response/in_active_conv", vbox); + + if (!gaim_prefs_get_bool("/core/away/auto_response/enabled")) gtk_widget_set_sensitive(hbox, FALSE); vbox = gaim_gtk_make_frame (ret, _("Idle")); - dd = gaim_dropdown(vbox, _("Idle _time reporting:"), &report_idle, -1, + dd = prefs_dropdown(vbox, _("Idle _time reporting:"), &report_idle, -1, _("None"), IDLE_NONE, _("Gaim usage"), IDLE_GAIM, #ifdef USE_SCREENSAVER @@ -1170,7 +1399,8 @@ gtk_misc_set_alignment(GTK_MISC(dd), 0, 0); vbox = gaim_gtk_make_frame (ret, _("Auto-away")); - button = gaim_button(_("Set away _when idle"), &away_options, OPT_AWAY_AUTO, vbox); + button = prefs_checkbox(_("Set away _when idle"), + "/core/away/away_when_idle", vbox); select = gaim_labeled_spin_button(vbox, _("_Minutes before setting away:"), &auto_away, 1, 24 * 60, sg); if (!(away_options & OPT_AWAY_AUTO)) gtk_widget_set_sensitive(GTK_WIDGET(select), FALSE); @@ -2115,13 +2345,6 @@ sound_options ^= option; } -static void set_font_option(GtkWidget *w, int option) -{ - font_options ^= option; - - gaim_gtkconv_update_font_buttons(); -} - static void set_away_option(GtkWidget *w, int option) { away_options ^= option; @@ -2130,45 +2353,27 @@ toggle_away_queue(); } -static GtkWidget *gaim_button(const char *text, guint *options, int option, GtkWidget *page) +static void +set_bool_pref(GtkWidget *w, const char *key) +{ + gaim_prefs_set_bool(key, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); +} + +static GtkWidget * +prefs_checkbox(const char *text, guint *options, int option, GtkWidget *page) { GtkWidget *button; + button = gtk_check_button_new_with_mnemonic(text); - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), (*options & option)); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), + gaim_prefs_get_bool(key)); + gtk_box_pack_start(GTK_BOX(page), button, FALSE, FALSE, 0); - g_object_set_data(G_OBJECT(button), "options", options); - - if (options == &misc_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_misc_option), (int *)option); - } else if (options == &logging_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_logging_option), (int *)option); - } else if (options == &blist_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_blist_option), (int *)option); - } else if (options == &convo_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_convo_option), (int *)option); - } else if (options == &im_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_im_option), (int *)option); - } else if (options == &chat_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_chat_option), (int *)option); - } else if (options == &font_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_font_option), (int *)option); - } else if (options == &sound_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_sound_option), (int *)option); - } else if (options == &away_options) { - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(set_away_option), (int *)option); - } else { - gaim_debug(GAIM_DEBUG_WARNING, "gaim_button", - "\"%s\" has no signal handler attached to it!\n", text); - } + + g_signal_connect(G_OBJECT(button), "clicked", + G_CALLBACK(set_bool_pref), key); + gtk_widget_show(button); return button; @@ -2279,182 +2484,6 @@ } #endif -static void update_spin_value(GtkWidget *w, GtkWidget *spin) -{ - int *value = g_object_get_data(G_OBJECT(spin), "val"); - *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, GtkSizeGroup *sg) -{ - 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_with_mnemonic(title); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - adjust = gtk_adjustment_new(*val, min, max, 1, 1, 1); - spin = gtk_spin_button_new(GTK_ADJUSTMENT(adjust), 1, 0); - g_object_set_data(G_OBJECT(spin), "val", val); - gtk_widget_set_size_request(spin, 50, -1); - gtk_box_pack_start(GTK_BOX(hbox), spin, FALSE, FALSE, 0); - g_signal_connect(G_OBJECT(adjust), "value-changed", - G_CALLBACK(update_spin_value), GTK_WIDGET(spin)); - gtk_widget_show(spin); - - gtk_label_set_mnemonic_widget(GTK_LABEL(label), spin); - - if (sg) { - gtk_size_group_add_widget(sg, label); - gtk_misc_set_alignment(GTK_MISC(label), 0, 0); - - } - return label; -} - -void dropdown_set(GObject *w, int *option) -{ - int opt = GPOINTER_TO_INT(g_object_get_data(w, "value")); - int clear = GPOINTER_TO_INT(g_object_get_data(w, "clear")); - - if (option == (int*)&sort_method) { - /* Hack city -- Population: Sean Egan */ - char *name = (char*)opt; - gaim_gtk_blist_sort_method_set(name); - return; - } - if (clear != -1) { - *option = *option & ~clear; - *option = *option | opt; - } else { - gaim_debug(GAIM_DEBUG_MISC, "dropdown_set", "HELLO %d\n", opt); - *option = opt; - } - - if (option == (int*)&global_proxy_info.proxytype) { - 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) { - if (opt == BROWSER_MANUAL) - gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), TRUE); - else - gtk_widget_set_sensitive(gtk_widget_get_parent(browser_entry), FALSE); - } else if (option == (int*)&sound_options) { - if (opt == OPT_SOUND_CMD) - gtk_widget_set_sensitive(sndcmd, TRUE); - else - gtk_widget_set_sensitive(sndcmd, FALSE); - gaim_sound_change_output_method(); - } else if (option == (int*)&blist_options) { - gaim_gtk_blist_update_toolbar(); - } else if (option == (int*)&im_options) { - if (clear == (OPT_IM_SIDE_TAB | OPT_IM_BR_TAB)) - gaim_gtkconv_update_tabs(); - else if (clear == (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) - gaim_gtkconv_update_im_button_style(); - } else if (option == (int*)&chat_options) { - if (clear == (OPT_CHAT_SIDE_TAB | OPT_CHAT_BR_TAB)) - gaim_gtkconv_update_tabs(); - else if (clear == (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) - gaim_gtkconv_update_chat_button_style(); - // } else if (option == (int*)&blist_options) { - // set_blist_tab(); - } else if (option == (int *)&conv_placement_option) { - gaim_conv_placement_set_active(conv_placement_option); - } -} - -static GtkWidget *gaim_dropdown(GtkWidget *box, const gchar *title, int *option, int clear, ...) -{ - va_list ap; - GList *menuitems = NULL; - GtkWidget *dropdown = NULL; - char *name; - int id; - - va_start(ap, clear); - while ((name = va_arg(ap, char *)) != NULL) { - id = va_arg(ap, int); - - menuitems = g_list_prepend(menuitems, name); - menuitems = g_list_prepend(menuitems, GINT_TO_POINTER(id)); - } - va_end(ap); - - g_return_val_if_fail(menuitems != NULL, NULL); - - menuitems = g_list_reverse(menuitems); - - dropdown = gaim_dropdown_from_list(box, title, option, clear, menuitems); - - g_list_free(menuitems); - - return dropdown; -} - -static GtkWidget *gaim_dropdown_from_list(GtkWidget *box, const gchar *title, int *option, int clear, GList *menuitems) -{ - GtkWidget *dropdown, *opt, *menu; - GtkWidget *label; - gchar *text; - int value; - int o = 0; - GtkWidget *hbox; - - g_return_val_if_fail(menuitems != NULL, NULL); - - hbox = gtk_hbox_new(FALSE, 5); - gtk_container_add (GTK_CONTAINER (box), hbox); - gtk_widget_show(hbox); - - label = gtk_label_new_with_mnemonic(title); - gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); - gtk_widget_show(label); - - dropdown = gtk_option_menu_new(); - menu = gtk_menu_new(); - - gtk_label_set_mnemonic_widget(GTK_LABEL(label), dropdown); - - while (menuitems != NULL && (text = (char *) menuitems->data) != NULL) { - menuitems = g_list_next(menuitems); - g_return_val_if_fail(menuitems != NULL, NULL); - value = GPOINTER_TO_INT(menuitems->data); - menuitems = g_list_next(menuitems); - - opt = gtk_menu_item_new_with_label(text); - g_object_set_data(G_OBJECT(opt), "value", GINT_TO_POINTER(value)); - g_object_set_data(G_OBJECT(opt), "clear", GINT_TO_POINTER(clear)); - g_signal_connect(G_OBJECT(opt), "activate", - G_CALLBACK(dropdown_set), (void *)option); - gtk_widget_show(opt); - gtk_menu_shell_append(GTK_MENU_SHELL(menu), opt); - - if (option == (int*)sort_method) { - /* Now Entering Hacksville, Estd. May 17, 2003 */ - gtk_menu_set_active(GTK_MENU(menu), clear); - } else if (((clear > -1) && ((*option & clear) == value)) || *option == value) { - gtk_menu_set_active(GTK_MENU(menu), o); - } - o++; - - } - - 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 label; -} - static GtkWidget *show_color_pref(GtkWidget *box, gboolean fgc) { /* more stuff stolen from X-Chat */ @@ -2463,7 +2492,7 @@ GtkStyle *style; c.pixel = 0; if (fgc) { - if (font_options & OPT_FONT_FGCOL) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { c.red = fgcolor.red; c.blue = fgcolor.blue; c.green = fgcolor.green; @@ -2473,7 +2502,7 @@ c.green = 0; } } else { - if (font_options & OPT_FONT_BGCOL) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { c.red = bgcolor.red; c.blue = bgcolor.blue; c.green = bgcolor.green; @@ -2521,20 +2550,98 @@ gaim_prefs_add_none("/gaim"); gaim_prefs_add_none("/gaim/gtk"); - /* Debug window preferences. */ - gaim_prefs_add_none("/gaim/gtk/debug"); - gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); - gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE); - gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); - gaim_prefs_add_int("/gaim/gtk/debug/width", 400); - gaim_prefs_add_int("/gaim/gtk/debug/height", 150); + /* Browsers */ + gaim_prefs_add_none("/gaim/gtk/browsers"); + gaim_prefs_add_bool("/gaim/gtk/browsers/new_window", FALSE); + + /* Buddy List */ + gaim_prefs_add_none("/gaim/gtk/blist"); + gaim_prefs_add_int("/gaim/gtk/blist/button_style", GAIM_BUTTON_TEXT_IMAGE); + gaim_prefs_add_bool("/gaim/gtk/blist/grey_idle_buddies", TRUE); + gaim_prefs_add_bool("/gaim/gtk/blist/raise_on_events", FALSE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_buddy_icons", TRUE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_buttons", TRUE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_empty_groups", FALSE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_group_count", TRUE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_idle_time", TRUE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_offline_buddies", FALSE); + gaim_prefs_add_bool("/gaim/gtk/blist/show_warning_level", TRUE); /* Conversations */ gaim_prefs_add_none("/gaim/gtk/conversations"); + gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_enter_sends", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/enter_sends", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/escape_closes", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/ctrl_w_closes", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/f2_toggles_timestamps", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/send_strikethrough", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/show_smilies", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); gaim_prefs_add_bool("/gaim/gtk/conversations/show_urls_as_links", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_colors", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_fonts", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/ignore_font_sizes", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_bgcolor", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_fgcolor", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_font", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/use_custom_size", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/html_shortcuts", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/smiley_shortcuts", FALSE); + gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", "#FFFFFF"); + gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", "#000000"); + gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); + gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); + gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); + gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); + + /* Conversations -> Chat */ + gaim_prefs_add_none("/gaim/gtk/conversations/chat"); + gaim_prefs_add_bool("/gaim/gtk/conversations/chat/color_nicks", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/chat/old_tab_complete", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/chat/raise_on_events", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/chat/tab_completion", TRUE); + + /* Conversations -> IM */ + gaim_prefs_add_none("/gaim/gtk/conversations/im"); + gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); + gaim_prefs_add_bool("/gaim/gtk/conversations/im/hide_on_send", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/im/raise_on_events", FALSE); + gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); + + /* Debug window preferences. */ + gaim_prefs_add_none("/gaim/gtk/debug"); + gaim_prefs_add_bool("/gaim/gtk/debug/enabled", FALSE); + gaim_prefs_add_bool("/gaim/gtk/debug/timestamps", FALSE); + gaim_prefs_add_bool("/gaim/gtk/debug/toolbar", TRUE); + gaim_prefs_add_int("/gaim/gtk/debug/width", 400); + gaim_prefs_add_int("/gaim/gtk/debug/height", 150); + + /* Logging */ + gaim_prefs_add_none("/gaim/gtk/logging"); + gaim_prefs_add_string("/gaim/gtk/logging/log_ims", TRUE); + gaim_prefs_add_string("/gaim/gtk/logging/log_chats", TRUE); + gaim_prefs_add_string("/gaim/gtk/logging/strip_html", TRUE); /* Smiley Themes */ gaim_prefs_add_none("/gaim/gtk/smilies"); gaim_prefs_add_string("/gaim/gtk/smilies/theme", ""); + + /* Sound */ + gaim_prefs_add_none("/gaim/gtk/sound"); + gaim_prefs_add_bool("/gaim/gtk/sound/login", TRUE); + gaim_prefs_add_bool("/gaim/gtk/sound/logout", TRUE); + gaim_prefs_add_bool("/gaim/gtk/sound/im_recv", TRUE); + gaim_prefs_add_bool("/gaim/gtk/sound/first_im_recv", FALSE); + gaim_prefs_add_bool("/gaim/gtk/sound/send_im", TRUE); + gaim_prefs_add_bool("/gaim/gtk/sound/join_chat", FALSE); + gaim_prefs_add_bool("/gaim/gtk/sound/left_chat", FALSE); + gaim_prefs_add_bool("/gaim/gtk/sound/send_chat_msg", FALSE); + gaim_prefs_add_bool("/gaim/gtk/sound/chat_msg_recv", FALSE); + gaim_prefs_add_bool("/gaim/gtk/sound/nick_said", FALSE); }
--- a/src/main.c Thu May 29 17:35:28 2003 +0000 +++ b/src/main.c Thu May 29 19:10:24 2003 +0000 @@ -884,8 +884,9 @@ gaim_prefs_init(); gaim_gtk_prefs_init(); - gaim_prefs_load(); - load_prefs(); + + if (!gaim_prefs_load()) + load_prefs(); plugin_search_paths[0] = LIBDIR; plugin_search_paths[1] = gaim_user_dir();
--- a/src/prefs.c Thu May 29 17:35:28 2003 +0000 +++ b/src/prefs.c Thu May 29 19:10:24 2003 +0000 @@ -97,8 +97,55 @@ gaim_prefs_add_none("/core"); /* XXX: this is where you would want to put prefs declarations */ + + /* Away */ + gaim_prefs_add_none("/core/away"); + gaim_prefs_add_bool("/core/away/queue_messages", FALSE); + gaim_prefs_add_bool("/core/away/away_when_idle", TRUE); + + /* Away -> Auto Response */ + gaim_prefs_add_none("/core/away/auto_response"); + gaim_prefs_add_bool("/core/away/auto_response/enabled", TRUE); + gaim_prefs_add_bool("/core/away/auto_response/in_active_conv", TRUE); + gaim_prefs_add_bool("/core/away/auto_response/idle_only", FALSE); + + /* Buddies */ + gaim_prefs_add_none("/core/buddies"); + gaim_prefs_add_bool("/core/buddies/use_server_alias", TRUE); + + /* Conversations */ gaim_prefs_add_none("/core/conversations"); gaim_prefs_add_bool("/core/conversations/send_urls_as_links", TRUE); + gaim_prefs_add_bool("/core/conversations/away_back_on_send", TRUE); + gaim_prefs_add_bool("/core/conversations/use_alias_for_title", TRUE); + gaim_prefs_add_bool("/core/conversations/combine_chat_im", FALSE); + + /* Conversations -> Chat */ + gaim_prefs_add_none("/core/conversations/chat"); + gaim_prefs_add_bool("/core/conversations/chat/show_join", TRUE); + gaim_prefs_add_bool("/core/conversations/chat/show_leave", TRUE); + gaim_prefs_add_bool("/core/conversations/chat/show_nick_change", TRUE); + + /* Conversations -> IM */ + gaim_prefs_add_none("/core/conversations/im"); + gaim_prefs_add_bool("/core/conversations/im/show_login", TRUE); + gaim_prefs_add_bool("/core/conversations/im/show_logoff", TRUE); + gaim_prefs_add_bool("/core/conversations/im/send_typing", TRUE); + + /* Proxy */ + gaim_prefs_add_none("/core/proxy"); + gaim_prefs_add_int("/core/proxy/type"); + + /* Sound */ + gaim_prefs_add_none("/core/sound"); + gaim_prefs_add_bool("/core/sound/command", FALSE); + gaim_prefs_add_bool("/core/sound/use_arts", FALSE); + gaim_prefs_add_bool("/core/sound/use_beep", FALSE); + gaim_prefs_add_bool("/core/sound/use_custom", FALSE); + gaim_prefs_add_bool("/core/sound/use_esd", FALSE); + gaim_prefs_add_bool("/core/sound/use_nas", TRUE); + gaim_prefs_add_bool("/core/sound/use_sys_default", TRUE); + gaim_prefs_add_bool("/core/sound/while_away", FALSE); } static char *pref_full_name(struct gaim_pref *pref) { @@ -370,7 +417,7 @@ return pref->value.integer; } -char *gaim_prefs_get_string(const char *name) { +const char *gaim_prefs_get_string(const char *name) { struct gaim_pref *pref = find_pref(name); g_return_val_if_fail(pref != NULL, NULL); @@ -596,7 +643,7 @@ NULL }; -void gaim_prefs_load() { +gboolean gaim_prefs_load() { gchar *filename = g_build_filename(gaim_user_dir(), "prefs.xml", NULL); gchar *contents = NULL; gsize length; @@ -606,7 +653,7 @@ if(!filename) { prefs_is_loaded = TRUE; - return; + return FALSE; } gaim_debug(GAIM_DEBUG_INFO, "prefs", "Reading %s\n", filename); @@ -616,7 +663,7 @@ error->message); g_error_free(error); prefs_is_loaded = TRUE; - return; + return FALSE; } context = g_markup_parse_context_new(&prefs_parser, 0, NULL, NULL); @@ -625,7 +672,7 @@ g_markup_parse_context_free(context); g_free(contents); prefs_is_loaded = TRUE; - return; + return FALSE; } if(!g_markup_parse_context_end_parse(context, NULL)) { @@ -633,7 +680,7 @@ g_markup_parse_context_free(context); g_free(contents); prefs_is_loaded = TRUE; - return; + return FALSE; } g_markup_parse_context_free(context); @@ -642,6 +689,7 @@ gaim_debug(GAIM_DEBUG_INFO, "prefs", "Finished reading %s\n", filename); g_free(filename); prefs_is_loaded = TRUE; + + return TRUE; } -
--- a/src/prefs.h Thu May 29 17:35:28 2003 +0000 +++ b/src/prefs.h Thu May 29 19:10:24 2003 +0000 @@ -149,7 +149,7 @@ * @param name The name of the pref * @return The value of the pref */ -char *gaim_prefs_get_string(const char *name); +const char *gaim_prefs_get_string(const char *name); /** * Add a callback to a pref (and its children) @@ -165,7 +165,7 @@ /** * Read preferences */ -void gaim_prefs_load(); +gboolean gaim_prefs_load(); /** * Force an immediate write of preferences
--- a/src/server.c Thu May 29 17:35:28 2003 +0000 +++ b/src/server.c Thu May 29 19:10:24 2003 +0000 @@ -208,8 +208,10 @@ if (!(flags & IM_FLAG_AWAY)) serv_touch_idle(gc); - if (gc->away && away_options & OPT_AWAY_DELAY_IN_USE && - !(away_options & OPT_AWAY_NO_AUTO_RESP)) { + if (gc->away && + !gaim_prefs_get_bool("/core/away/auto_response/in_active_conv") && + gaim_prefs_get_bool("/core/away/auto_response/enabled")) { + time_t t; struct queued_away_response *qar; time(&t); @@ -856,7 +858,8 @@ * this to be queued properly, we have to make sure that the * imaway dialog actually exists, first. */ - if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) { + if (!cnv && awayqueue && + gaim_prefs_get_bool("/core/away/queue_messages")) { /* * Alright, so we're going to queue it. Neat, eh? :) * So first we create something to store the message, and add @@ -923,8 +926,10 @@ * is set */ if (!(gc->flags & OPT_CONN_AUTO_RESP) || - (away_options & OPT_AWAY_NO_AUTO_RESP) || !strlen(gc->away) || - ((away_options & OPT_AWAY_IDLE_RESP) && !gc->is_idle)) { + !gaim_prefs_get_bool("/core/away/auto_response/enabled") || + *gc->away == '\0' || + (!gc->is_idle && + gaim_prefs_get_bool("/core/away/auto_response/idle_only"))) { g_free(name); g_free(message); @@ -957,8 +962,11 @@ /* apply default fonts and colors */ tmpmsg = stylize(gc->away, MSG_LEN); serv_send_im(gc, name, away_subs(tmpmsg, alias), -1, IM_FLAG_AWAY); - if (!cnv && awayqueue && (away_options & OPT_AWAY_QUEUE)) { + if (!cnv && awayqueue && + gaim_prefs_get_bool("/core/away/queue_messages")) { + struct queued_message *qm; + qm = g_new0(struct queued_message, 1); g_snprintf(qm->name, sizeof(qm->name), "%s", name); qm->message = g_strdup(away_subs(tmpmsg, alias)); @@ -979,6 +987,8 @@ * earlier), then play a sound indicating we've received it and * then display it. Easy. */ +#if 0 + /* XXX This is never TRUE, since nothing sets OPT_AWAY_QUEUE_UNREAD */ if (away_options & OPT_AWAY_QUEUE_UNREAD && !gaim_find_conversation(name) && docklet_count) { @@ -995,16 +1005,18 @@ qm->flags = away | WFLAG_RECV; qm->len = len; unread_message_queue = g_slist_append(unread_message_queue, qm); - } else { + } + else { +#endif if (cnv == NULL) cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name); - /* CONV XXX gaim_conversation_set_name(cnv, name); */ - gaim_im_write(GAIM_IM(cnv), NULL, message, len, away | WFLAG_RECV, mtime); gaim_window_flash(gaim_conversation_get_window(cnv)); +#if 0 } +#endif } gaim_event_broadcast(event_im_displayed_rcvd, gc, name, message, flags, mtime); @@ -1073,12 +1085,17 @@ if (loggedin) { if (!GAIM_BUDDY_IS_ONLINE(b)) { struct gaim_conversation *c = gaim_find_conversation(b->name); - if (c && (im_options & OPT_IM_LOGON)) { - char *tmp = g_strdup_printf(_("%s logged in."), gaim_get_buddy_alias(b)); + if (c != NULL && + gaim_prefs_get_bool("/core/conversations/im/show_login")) { + + char *tmp = g_strdup_printf(_("%s logged in."), + gaim_get_buddy_alias(b)); + gaim_conversation_write(c, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL)); g_free(tmp); - } else if (awayqueue && find_queue_total_by_name(b->name)) { + } + else if (awayqueue && find_queue_total_by_name(b->name)) { struct queued_message *qm = g_new0(struct queued_message, 1); g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); qm->message = g_strdup_printf(_("%s logged in."), @@ -1096,8 +1113,11 @@ } else { if (GAIM_BUDDY_IS_ONLINE(b)) { struct gaim_conversation *c = gaim_find_conversation(b->name); - if (c && (im_options & OPT_IM_LOGON)) { - char *tmp = g_strdup_printf(_("%s logged out."), gaim_get_buddy_alias(b)); + if (c != NULL && + gaim_prefs_get_bool("/core/conversations/im/show_login")) { + + char *tmp = g_strdup_printf(_("%s logged out."), + gaim_get_buddy_alias(b)); gaim_conversation_write(c, NULL, tmp, -1, WFLAG_SYSTEM, time(NULL)); g_free(tmp); @@ -1258,7 +1278,8 @@ gaim_chat_set_id(chat, id); - if ((logging_options & OPT_LOG_CHATS) || + /* TODO Move this to UI logging code! */ + if (gaim_prefs_get_bool("/gaim/gtk/logging/log_chats") || find_log_info(gaim_conversation_get_name(b))) { FILE *fd; @@ -1270,7 +1291,7 @@ fd = open_log_file(filename, TRUE); if (fd) { - if (!(logging_options & OPT_LOG_STRIP_HTML)) + if (!gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) fprintf(fd, "<HR><BR><H3 Align=Center> ---- New Conversation @ %s ----</H3><BR>\n", full_date());
--- a/src/sound.c Thu May 29 17:35:28 2003 +0000 +++ b/src/sound.c Thu May 29 19:10:24 2003 +0000 @@ -50,6 +50,7 @@ #include "gaim.h" #include "sound.h" #include "notify.h" +#include "prefs.h" #ifdef _WIN32 #include "win32dep.h" @@ -57,7 +58,7 @@ struct gaim_sound_event { char *label; - guint opt; + char *pref; char *def; }; @@ -76,18 +77,18 @@ * the order here has to match the defines in gaim.h. * * -Robot101 */ static struct gaim_sound_event sounds[GAIM_NUM_SOUNDS] = { - {N_("Buddy logs in"), OPT_SOUND_LOGIN, "arrive.wav"}, - {N_("Buddy logs out"), OPT_SOUND_LOGOUT, "leave.wav"}, - {N_("Message received"), OPT_SOUND_RECV, "receive.wav"}, - {N_("Message received begins conversation"), OPT_SOUND_FIRST_RCV, "receive.wav"}, - {N_("Message sent"), OPT_SOUND_SEND, "send.wav"}, - {N_("Person enters chat"), OPT_SOUND_CHAT_JOIN, "arrive.wav"}, - {N_("Person leaves chat"), OPT_SOUND_CHAT_PART, "leave.wav"}, - {N_("You talk in chat"), OPT_SOUND_CHAT_YOU_SAY, "send.wav"}, - {N_("Others talk in chat"), OPT_SOUND_CHAT_SAY, "receive.wav"}, + {N_("Buddy logs in"), "/gaim/gtk/sound/login", "arrive.wav"}, + {N_("Buddy logs out"), "/gaim/gtk/sound/logout", "leave.wav"}, + {N_("Message received"), "/gaim/gtk/sound/message_recv", "receive.wav"}, + {N_("Message received begins conversation"), "/gaim/gtk/sound/first_message_recv", "receive.wav"}, + {N_("Message sent"), "/gaim/gtk/sound/send_im", "send.wav"}, + {N_("Person enters chat"), "/gaim/gtk/sound/join_chat", "arrive.wav"}, + {N_("Person leaves chat"), "/gaim/gtk/sound/left_chat", "leave.wav"}, + {N_("You talk in chat"), "/gaim/gtk/sound/send_chat_msg", "send.wav"}, + {N_("Others talk in chat"), "/gaim/gtk/sound/chat_msg_recv", "receive.wav"}, /* this isn't a terminator, it's the buddy pounce default sound event ;-) */ {NULL, 0, "redalert.wav"}, - {N_("Someone says your name in chat"), OPT_SOUND_CHAT_NICK, "redalert.wav"} + {N_("Someone says your name in chat"), "/gaim/gtk/sound/nick_said", "redalert.wav"} }; static char *sound_file[GAIM_NUM_SOUNDS]; @@ -109,19 +110,22 @@ #ifdef USE_AO ao_driver = -1; - if ((sound_options & OPT_SOUND_ESD) || (sound_options & OPT_SOUND_ARTS) || - (sound_options & OPT_SOUND_NORMAL)) { + if (gaim_prefs_get_bool("/core/sound/use_esd") || + gaim_prefs_get_bool("/core/sound/use_arts") || + gaim_prefs_get_bool("/core/sound/use_sys_default")) { + check_ao_init(); - if (ao_driver == -1 && (sound_options & OPT_SOUND_ESD)) { + + if (ao_driver == -1 && gaim_prefs_get_bool("/core/sound/use_esd")) ao_driver = ao_driver_id("esd"); - } - if(ao_driver == -1 && (sound_options & OPT_SOUND_ARTS)) { + + if (ao_driver == -1 && gaim_prefs_get_bool("/core/sound/use_arts")) ao_driver = ao_driver_id("arts"); - } - if (ao_driver == -1) { + + if (ao_driver == -1) ao_driver = ao_default_driver_id(); - } } + if(ao_driver != -1) { ao_info *info = ao_driver_info(ao_driver); gaim_debug(GAIM_DEBUG_INFO, "sound", @@ -129,7 +133,7 @@ } #endif /* USE_AO */ #ifdef USE_NAS - if((sound_options & OPT_SOUND_NAS)) + if (gaim_prefs_get_bool("/core/sound/use_nas")) gaim_debug(GAIM_DEBUG_INFO, "sound", "Sound output driver loaded: NAS output\n"); #endif /* USE_NAS */ @@ -172,10 +176,10 @@ if (mute_sounds) return; - if (awaymessage && !(sound_options & OPT_SOUND_WHEN_AWAY)) + if (awaymessage && !gaim_prefs_get_bool("/core/sound/while_away")) return; /* check here in case a buddy pounce plays a file while away */ - if (sound_options & OPT_SOUND_BEEP) { + if (gaim_prefs_get_bool("/core/sound/use_beep")) { gdk_beep(); return; } @@ -188,11 +192,14 @@ } #ifndef _WIN32 - if ((sound_options & OPT_SOUND_CMD)) { + if (gaim_prefs_get_bool("/core/sound/use_custom")) { + const char *sound_cmd; char *command; GError *error = NULL; - if(!sound_cmd) { + sound_cmd = gaim_prefs_get_string("/core/sound/command"); + + if (!sound_cmd || *sound_cmd == '\0') { gaim_notify_error(NULL, NULL, _("Unable to play sound because the " "'Command' sound method has been chosen, " @@ -218,7 +225,7 @@ return; else if (pid == 0) { #ifdef USE_NAS_AUDIO - if ((sound_options & OPT_SOUND_NAS)) { + if (gaim_prefs_get_bool("/core/sound/use_nas")) { if (play_file_nas(filename)) _exit(0); } @@ -301,7 +308,7 @@ } /* check NULL for sounds that don't have an option, ie buddy pounce */ - if ((sound_options & sounds[event].opt) || (sounds[event].opt == 0)) { + if (sounds[event].pref == NULL || gaim_prefs_get_bool(sounds[event].pref)) { if (sound_file[event]) { gaim_sound_play_file(sound_file[event]); } else { @@ -349,12 +356,12 @@ return sound_file[event]; } -guint gaim_sound_get_event_option(GaimSoundEventID event) +const char *gaim_sound_get_event_option(GaimSoundEventID event) { if(event >= GAIM_NUM_SOUNDS) return 0; - return sounds[event].opt; + return sounds[event].pref; } char *gaim_sound_get_event_label(GaimSoundEventID event)
--- a/src/sound.h Thu May 29 17:35:28 2003 +0000 +++ b/src/sound.h Thu May 29 19:10:24 2003 +0000 @@ -119,7 +119,7 @@ * @param event The event. * @return The option. */ -guint gaim_sound_get_event_option(GaimSoundEventID event); +const char *gaim_sound_get_event_option(GaimSoundEventID event); /** * Get the label for an event.
--- a/src/ui.h Thu May 29 17:35:28 2003 +0000 +++ b/src/ui.h Thu May 29 19:10:24 2003 +0000 @@ -86,9 +86,19 @@ #define GAIM_WARNING 2 #define GAIM_INFO 3 -typedef enum { - GAIM_BUTTON_HORIZONTAL, - GAIM_BUTTON_VERTICAL +typedef enum +{ + GAIM_BUTTON_HORIZONTAL, + GAIM_BUTTON_VERTICAL + +} GaimButtonOrientation; + +typedef enum +{ + GAIM_BUTTON_TEXT, + GAIM_BUTTON_IMAGE, + GAIM_BUTTON_TEXT_IMAGE + } GaimButtonStyle; /* XXX CUI: save_pos and window_size are used by gaimrc.c which is core. @@ -164,11 +174,7 @@ extern GtkListStore *awayqueuestore; /* Globals in dialog.c */ -extern char fontface[128]; extern char fontxfld[256]; -extern int fontsize; -extern GdkColor bgcolor; -extern GdkColor fgcolor; extern int smiley_array[FACE_TOTAL]; extern GtkWidget *fgcseld; extern GtkWidget *bgcseld; @@ -281,8 +287,8 @@ extern void show_rename_group(GtkWidget *, struct group *); extern void show_rename_buddy(GtkWidget *, struct buddy *); extern void load_perl_script(); -extern GtkWidget *gaim_pixbuf_button(char *, char *, GaimButtonStyle); -extern GtkWidget *gaim_pixbuf_button_from_stock(const char *, const char *, GaimButtonStyle); +extern GtkWidget *gaim_pixbuf_button(char *, char *, GaimButtonOrientation); +extern GtkWidget *gaim_pixbuf_button_from_stock(const char *, const char *, GaimButtonOrientation); extern GtkWidget *gaim_pixbuf_toolbar_button_from_stock(char *); extern int file_is_dir(const char *, GtkWidget *); extern void update_privacy_connections();
--- a/src/util.c Thu May 29 17:35:28 2003 +0000 +++ b/src/util.c Thu May 29 19:10:24 2003 +0000 @@ -45,6 +45,7 @@ #include <math.h> #include "gaim.h" #include "prpl.h" +#include "prefs.h" #ifndef _WIN32 #include <sys/socket.h> @@ -654,45 +655,63 @@ buf = g_malloc(length); g_snprintf(buf, length, "%s", text); - if (font_options & OPT_FONT_BOLD) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold")) { g_snprintf(tmp, length, "<B>%s</B>", buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_ITALIC) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic")) { g_snprintf(tmp, length, "<I>%s</I>", buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_UNDERLINE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline")) { g_snprintf(tmp, length, "<U>%s</U>", buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_STRIKE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_strikethrough")) { g_snprintf(tmp, length, "<S>%s</S>", buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_FACE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_font")) { + const char *fontface; + + fontface = gaim_prefs_get_string("/gaim/gtk/conversations/font_face"); + g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_SIZE) { + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_size")) { + int fontsize = gaim_prefs_get_int("/gaim/gtk/conversations/font_size"); + g_snprintf(tmp, length, "<FONT SIZE=\"%d\">%s</FONT>", fontsize, buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_FGCOL) { - g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red/256, - fgcolor.green/256, fgcolor.blue/256, buf); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_fgcolor")) { + GdkColor fgcolor; + + gdk_color_parse( + gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), + &fgcolor); + + g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", + fgcolor.red/256, fgcolor.green/256, fgcolor.blue/256, buf); strcpy(buf, tmp); } - if (font_options & OPT_FONT_BGCOL) { - g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red/256, - bgcolor.green/256, bgcolor.blue/256, buf); + if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_custom_bgcolor")) { + GdkColor bgcolor; + + gdk_color_parse( + gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), + &bgcolor); + + g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", + bgcolor.red/256, bgcolor.green/256, bgcolor.blue/256, buf); strcpy(buf, tmp); }