hexchat/src/fe-gtk/setup.c

2325 lines
71 KiB
C
Raw Normal View History

2011-02-23 22:14:30 -05:00
/* X-Chat
* Copyright (C) 2004-2007 Peter Zelezny.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
2011-02-23 22:14:30 -05:00
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
2012-10-24 15:33:02 -04:00
#include "../common/hexchat.h"
2011-02-23 22:14:30 -05:00
#include "../common/cfgfiles.h"
#include "../common/fe.h"
#include "../common/text.h"
#include "../common/userlist.h"
#include "../common/util.h"
2012-10-24 15:33:02 -04:00
#include "../common/hexchatc.h"
2011-02-23 22:14:30 -05:00
#include "fe-gtk.h"
#include "gtkutil.h"
#include "maingui.h"
#include "palette.h"
#include "pixmaps.h"
#include "menu.h"
2012-07-21 08:26:19 -04:00
#include "plugin-tray.h"
#include "notifications/notification-backend.h"
2011-02-23 22:14:30 -05:00
#ifdef WIN32
#include "../common/fe.h"
#endif
#include "sexy-spell-entry.h"
GtkStyle *create_input_style (GtkStyle *);
#define LABEL_INDENT 12
static int last_selected_page = 0;
static int last_selected_row = 0; /* sound row */
static gboolean color_change;
2012-10-22 03:00:35 -04:00
static struct hexchatprefs setup_prefs;
2011-02-23 22:14:30 -05:00
static GtkWidget *cancel_button;
static GtkWidget *font_dialog = NULL;
enum
{
ST_END,
ST_TOGGLE,
ST_TOGGLR,
ST_3OGGLE,
ST_ENTRY,
ST_EFONT,
ST_EFILE,
ST_EFOLDER,
ST_MENU,
ST_RADIO,
ST_NUMBER,
ST_HSCALE,
ST_HEADER,
ST_LABEL,
ST_ALERTHEAD
};
typedef struct
{
int type;
char *label;
int offset;
char *tooltip;
char const *const *list;
int extra;
} setting;
2012-10-18 17:26:06 -04:00
#ifdef WIN32
static const char *const langsmenu[] =
{
N_("Afrikaans"),
N_("Albanian"),
N_("Amharic"),
N_("Asturian"),
N_("Azerbaijani"),
N_("Basque"),
N_("Belarusian"),
N_("Bulgarian"),
N_("Catalan"),
N_("Chinese (Simplified)"),
N_("Chinese (Traditional)"),
N_("Czech"),
N_("Danish"),
N_("Dutch"),
2012-12-01 17:42:53 -05:00
N_("English (British)"),
2012-10-20 10:00:03 -04:00
N_("English"),
N_("Estonian"),
N_("Finnish"),
N_("French"),
N_("Galician"),
N_("German"),
N_("Greek"),
N_("Gujarati"),
N_("Hindi"),
N_("Hungarian"),
N_("Indonesian"),
N_("Italian"),
N_("Japanese"),
N_("Kannada"),
N_("Kinyarwanda"),
N_("Korean"),
N_("Latvian"),
N_("Lithuanian"),
N_("Macedonian"),
N_("Malay"),
2012-10-22 11:39:00 -04:00
N_("Malayalam"),
2012-10-18 18:34:47 -04:00
N_("Norwegian (Bokmal)"),
N_("Norwegian (Nynorsk)"),
N_("Polish"),
N_("Portuguese"),
N_("Portuguese (Brazilian)"),
N_("Punjabi"),
N_("Russian"),
N_("Serbian"),
N_("Slovak"),
N_("Slovenian"),
N_("Spanish"),
N_("Swedish"),
N_("Thai"),
N_("Turkish"),
N_("Ukrainian"),
N_("Vietnamese"),
N_("Walloon"),
NULL
};
2012-10-18 17:26:06 -04:00
#endif
2011-02-23 22:14:30 -05:00
static const setting appearance_settings[] =
2011-02-23 22:14:30 -05:00
{
2012-10-19 13:37:10 -04:00
{ST_HEADER, N_("General"),0,0,0},
#ifdef WIN32
2012-10-22 07:49:28 -04:00
{ST_MENU, N_("Language:"), P_OFFINTNL(hex_gui_lang), 0, langsmenu, 0},
2012-10-22 09:55:43 -04:00
{ST_EFONT, N_("Main font:"), P_OFFSETNL(hex_text_font_main), 0, 0, sizeof prefs.hex_text_font_main},
#else
2012-10-22 09:59:52 -04:00
{ST_EFONT, N_("Font:"), P_OFFSETNL(hex_text_font), 0, 0, sizeof prefs.hex_text_font},
#endif
2012-10-22 01:24:52 -04:00
2012-10-19 13:37:10 -04:00
{ST_HEADER, N_("Text Box"),0,0,0},
{ST_TOGGLE, N_("Colored nick names"), P_OFFINTNL(hex_text_color_nicks), N_("Give each person on IRC a different color"),0,0},
{ST_TOGGLR, N_("Indent nick names"), P_OFFINTNL(hex_text_indent), N_("Make nick names right-justified"),0,0},
{ST_TOGGLE, N_ ("Show marker line"), P_OFFINTNL (hex_text_show_marker), N_ ("Insert a red line after the last read text."), 0, 0},
{ST_EFILE, N_ ("Background image:"), P_OFFSETNL (hex_text_background), 0, 0, sizeof prefs.hex_text_background},
2011-10-29 07:25:33 -04:00
{ST_HEADER, N_("Transparency Settings"), 0,0,0},
{ST_HSCALE, N_("Window Opacity:"), P_OFFINTNL(hex_gui_transparency),0,0,0},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Time Stamps"),0,0,0},
{ST_TOGGLE, N_("Enable time stamps"), P_OFFINTNL(hex_stamp_text),0,0,1},
2012-10-22 09:55:43 -04:00
{ST_ENTRY, N_("Time stamp format:"), P_OFFSETNL(hex_stamp_text_format),
2012-01-30 08:37:07 -05:00
#ifdef WIN32
2012-10-22 09:55:43 -04:00
N_("See the strftime MSDN article for details."),0,sizeof prefs.hex_stamp_text_format},
2012-01-30 08:37:07 -05:00
#else
2012-10-22 09:55:43 -04:00
N_("See the strftime manpage for details."),0,sizeof prefs.hex_stamp_text_format},
2012-01-30 08:37:07 -05:00
#endif
2011-02-23 22:14:30 -05:00
2012-10-25 14:39:45 -04:00
{ST_HEADER, N_("Title Bar"),0,0,0},
{ST_TOGGLE, N_("Show channel modes"), P_OFFINTNL(hex_gui_win_modes),0,0,0},
{ST_TOGGLR, N_("Show number of users"), P_OFFINTNL(hex_gui_win_ucount),0,0,0},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
static const char *const tabcompmenu[] =
{
N_("A-Z"),
N_("Last-spoke order"),
NULL
};
static const setting inputbox_settings[] =
{
2012-09-01 15:40:56 -04:00
{ST_HEADER, N_("Input Box"),0,0,0},
2012-10-22 07:49:28 -04:00
{ST_TOGGLE, N_("Use the Text box font and colors"), P_OFFINTNL(hex_gui_input_style),0,0,0},
{ST_TOGGLE, N_("Render colors and attributes"), P_OFFINTNL (hex_gui_input_attr),0,0,0},
{ST_TOGGLE, N_("Show nick box"), P_OFFINTNL(hex_gui_input_nick),0,0,1},
{ST_TOGGLE, N_("Show user mode icon in nick box"), P_OFFINTNL(hex_gui_input_icon),0,0,0},
2013-04-15 21:10:25 -04:00
{ST_TOGGLE, N_("Spell checking"), P_OFFINTNL(hex_gui_input_spell),0,0,1},
2012-10-22 09:55:43 -04:00
{ST_ENTRY, N_("Dictionaries to use:"), P_OFFSETNL(hex_text_spell_langs),0,0,sizeof prefs.hex_text_spell_langs},
#ifdef WIN32
{ST_LABEL, N_("Use language codes (as in \"%LOCALAPPDATA%\\enchant\\myspell\\dicts\").\nSeparate multiple entries with commas.")},
#else
{ST_LABEL, N_("Use language codes. Separate multiple entries with commas.")},
2011-02-23 22:14:30 -05:00
#endif
{ST_HEADER, N_("Nick Completion"),0,0,0},
2012-10-22 04:10:19 -04:00
{ST_ENTRY, N_("Nick completion suffix:"), P_OFFSETNL(hex_completion_suffix),0,0,sizeof prefs.hex_completion_suffix},
{ST_MENU, N_("Nick completion sorted:"), P_OFFINTNL(hex_completion_sort), 0, tabcompmenu, 0},
2013-06-09 15:01:00 -04:00
{ST_NUMBER, N_("Nick completion amount:"), P_OFFINTNL(hex_completion_amount), N_("Threshold of nicks to start listing instead of completing"), (const char **)N_("nicks."), 1000},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
2012-10-22 07:49:28 -04:00
static const char *const lagmenutext[] =
2011-02-23 22:14:30 -05:00
{
N_("Off"),
2012-10-22 11:23:04 -04:00
N_("Graphical"),
N_("Text"),
2011-02-23 22:14:30 -05:00
N_("Both"),
NULL
2012-10-22 07:49:28 -04:00
};
2011-02-23 22:14:30 -05:00
static const char *const ulmenutext[] =
{
N_("A-Z, Ops first"),
N_("A-Z"),
N_("Z-A, Ops last"),
N_("Z-A"),
N_("Unsorted"),
NULL
};
static const char *const cspos[] =
{
N_("Left (Upper)"),
N_("Left (Lower)"),
N_("Right (Upper)"),
N_("Right (Lower)"),
N_("Top"),
N_("Bottom"),
N_("Hidden"),
NULL
};
static const char *const ulpos[] =
{
N_("Left (Upper)"),
N_("Left (Lower)"),
N_("Right (Upper)"),
N_("Right (Lower)"),
NULL
};
static const setting userlist_settings[] =
{
{ST_HEADER, N_("User List"),0,0,0},
2012-10-22 07:49:28 -04:00
{ST_TOGGLE, N_("Show hostnames in user list"), P_OFFINTNL(hex_gui_ulist_show_hosts), 0, 0, 0},
{ST_TOGGLE, N_("Use the Text box font and colors"), P_OFFINTNL(hex_gui_ulist_style),0,0,0},
2012-10-22 14:03:32 -04:00
{ST_TOGGLE, N_("Show icons for user modes"), P_OFFINTNL(hex_gui_ulist_icons), N_("Use graphical icons instead of text symbols in the user list."), 0, 0},
{ST_TOGGLE, N_("Color nicknames in userlist"), P_OFFINTNL(hex_gui_ulist_color), N_("Will color nicknames the same as in chat."), 0, 0},
2012-10-22 12:59:45 -04:00
{ST_TOGGLE, N_("Show user count in channels"), P_OFFINTNL(hex_gui_ulist_count), 0, 0, 0},
2012-10-22 07:49:28 -04:00
/* {ST_TOGGLE, N_("Resizable user list"), P_OFFINTNL(hex_gui_ulist_resizable),0,0,0},*/
{ST_MENU, N_("User list sorted by:"), P_OFFINTNL(hex_gui_ulist_sort), 0, ulmenutext, 0},
{ST_MENU, N_("Show user list at:"), P_OFFINTNL(hex_gui_ulist_pos), 0, ulpos, 1},
2011-02-23 22:14:30 -05:00
2012-09-01 15:40:56 -04:00
{ST_HEADER, N_("Away Tracking"),0,0,0},
{ST_TOGGLE, N_("Track the Away status of users and mark them in a different color"), P_OFFINTNL(hex_away_track),0,0,1},
2012-10-22 03:53:28 -04:00
{ST_NUMBER, N_("On channels smaller than:"), P_OFFINTNL(hex_away_size_max),0,0,10000},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Action Upon Double Click"),0,0,0},
2012-10-22 07:49:28 -04:00
{ST_ENTRY, N_("Execute command:"), P_OFFSETNL(hex_gui_ulist_doubleclick), 0, 0, sizeof prefs.hex_gui_ulist_doubleclick},
2011-02-23 22:14:30 -05:00
2012-10-22 07:49:28 -04:00
{ST_HEADER, N_("Extra Gadgets"),0,0,0},
{ST_MENU, N_("Lag meter:"), P_OFFINTNL(hex_gui_lagometer), 0, lagmenutext, 0},
{ST_MENU, N_("Throttle meter:"), P_OFFINTNL(hex_gui_throttlemeter), 0, lagmenutext, 0},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
static const char *const tabwin[] =
{
N_("Windows"),
N_("Tabs"),
NULL
};
static const char *const focusnewtabsmenu[] =
{
N_("Never"),
N_("Always"),
N_("Only requested tabs"),
NULL
};
2013-03-09 17:09:38 -05:00
static const char *const noticeposmenu[] =
{
N_("Automatic"),
N_("In an extra tab"),
N_("In the front tab"),
NULL
};
2011-02-23 22:14:30 -05:00
static const char *const swtype[] =
{
N_("Tabs"), /* 0 tabs */
"", /* 1 reserved */
N_("Tree"), /* 2 tree */
NULL
};
static const setting tabs_settings[] =
{
/*{ST_HEADER, N_("Channel Switcher"),0,0,0},*/
2012-10-22 07:49:28 -04:00
{ST_RADIO, N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0},
{ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0},
{ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0},
{ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(hex_gui_tab_sort), 0, 0, 0},
{ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0},
{ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0},
{ST_TOGGLE, N_("Scroll mouse-wheel to change tabs"), P_OFFINTNL (hex_gui_tab_scrollchans), 0, 0, 0},
{ST_TOGGLE, N_("Middle click to close tab"), P_OFFINTNL(hex_gui_tab_middleclose), 0, 0, 0},
2012-10-22 07:49:28 -04:00
{ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0},
{ST_MENU, N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0},
2013-03-14 16:28:25 -04:00
{ST_MENU, N_("Placement of notices:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0},
2012-10-22 07:49:28 -04:00
{ST_MENU, N_("Show channel switcher at:"), P_OFFINTNL(hex_gui_tab_pos), 0, cspos, 1},
{ST_NUMBER, N_("Shorten tab labels to:"), P_OFFINTNL(hex_gui_tab_trunc), 0, (const char **)N_("letters."), 99},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Tabs or Windows"),0,0,0},
2012-10-22 07:49:28 -04:00
{ST_MENU, N_("Open channels in:"), P_OFFINTNL(hex_gui_tab_chans), 0, tabwin, 0},
{ST_MENU, N_("Open dialogs in:"), P_OFFINTNL(hex_gui_tab_dialogs), 0, tabwin, 0},
{ST_MENU, N_("Open utilities in:"), P_OFFINTNL(hex_gui_tab_utils), N_("Open DCC, Ignore, Notify etc, in tabs or windows?"), tabwin, 0},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
static const setting color_settings[] =
{
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Messages"), P_OFFINTNL(hex_text_stripcolor_msg), 0, 0, 0},
{ST_TOGGLE, N_("Scrollback"), P_OFFINTNL(hex_text_stripcolor_replay), 0, 0, 0},
{ST_TOGGLE, N_("Topic"), P_OFFINTNL(hex_text_stripcolor_topic), 0, 0, 0},
{ST_END, 0, 0, 0, 0, 0}
};
2011-02-23 22:14:30 -05:00
static const char *const dccaccept[] =
{
2012-10-22 06:10:55 -04:00
N_("Ask for confirmation"),
N_("Ask for download folder"),
N_("Save without interaction"),
2011-02-23 22:14:30 -05:00
NULL
};
static const setting filexfer_settings[] =
{
{ST_HEADER, N_("Files and Directories"), 0, 0, 0},
2012-10-22 06:10:55 -04:00
{ST_MENU, N_("Auto accept file offers:"), P_OFFINTNL(hex_dcc_auto_recv), 0, dccaccept, 0},
{ST_EFOLDER,N_("Download files to:"), P_OFFSETNL(hex_dcc_dir), 0, 0, sizeof prefs.hex_dcc_dir},
{ST_EFOLDER,N_("Move completed files to:"), P_OFFSETNL(hex_dcc_completed_dir), 0, 0, sizeof prefs.hex_dcc_completed_dir},
{ST_TOGGLE, N_("Save nick name in filenames"), P_OFFINTNL(hex_dcc_save_nick), 0, 0, 0},
2011-02-23 22:14:30 -05:00
2013-05-19 14:43:21 -04:00
{ST_HEADER, N_("Auto Open DCC Windows"),0,0,0},
{ST_TOGGLE, N_("Send window"), P_OFFINTNL(hex_gui_autoopen_send), 0, 0, 0},
{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Maximum File Transfer Speeds (bytes per second)"), 0, 0, 0},
2012-10-22 06:10:55 -04:00
{ST_NUMBER, N_("One upload:"), P_OFFINTNL(hex_dcc_max_send_cps),
N_("Maximum speed for one transfer"), 0, 10000000},
2012-10-22 06:10:55 -04:00
{ST_NUMBER, N_("One download:"), P_OFFINTNL(hex_dcc_max_get_cps),
N_("Maximum speed for one transfer"), 0, 10000000},
2012-10-22 06:10:55 -04:00
{ST_NUMBER, N_("All uploads combined:"), P_OFFINTNL(hex_dcc_global_max_send_cps),
N_("Maximum speed for all files"), 0, 10000000},
2012-10-22 06:10:55 -04:00
{ST_NUMBER, N_("All downloads combined:"), P_OFFINTNL(hex_dcc_global_max_get_cps),
N_("Maximum speed for all files"), 0, 10000000},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
static const int balloonlist[3] =
{
2012-10-22 08:18:20 -04:00
P_OFFINTNL(hex_input_balloon_chans), P_OFFINTNL(hex_input_balloon_priv), P_OFFINTNL(hex_input_balloon_hilight)
2011-02-23 22:14:30 -05:00
};
static const int trayblinklist[3] =
{
2012-10-22 08:18:20 -04:00
P_OFFINTNL(hex_input_tray_chans), P_OFFINTNL(hex_input_tray_priv), P_OFFINTNL(hex_input_tray_hilight)
2011-02-23 22:14:30 -05:00
};
static const int taskbarlist[3] =
{
2012-10-22 08:18:20 -04:00
P_OFFINTNL(hex_input_flash_chans), P_OFFINTNL(hex_input_flash_priv), P_OFFINTNL(hex_input_flash_hilight)
2011-02-23 22:14:30 -05:00
};
static const int beeplist[3] =
{
2012-10-22 08:18:20 -04:00
P_OFFINTNL(hex_input_beep_chans), P_OFFINTNL(hex_input_beep_priv), P_OFFINTNL(hex_input_beep_hilight)
2011-02-23 22:14:30 -05:00
};
static const setting alert_settings[] =
{
{ST_HEADER, N_("Alerts"),0,0,0},
{ST_ALERTHEAD},
{ST_3OGGLE, N_("Show notifications on:"), 0, 0, (void *)balloonlist, 0},
{ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0},
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
#ifdef WIN32
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play the \"Instant Message Notification\" system sound upon the selected events"), (void *)beeplist, 0},
#else
#ifdef USE_LIBCANBERRA
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play \"message-new-instant\" from the freedesktop.org sound theme upon the selected events"), (void *)beeplist, 0},
#else
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play a GTK beep upon the selected events"), (void *)beeplist, 0},
#endif
2011-02-23 22:14:30 -05:00
#endif
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
{ST_HEADER, N_("Tray Behavior"), 0, 0, 0},
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 4},
{ST_TOGGLE, N_("Minimize to tray"), P_OFFINTNL(hex_gui_tray_minimize), 0, 0, 0},
{ST_TOGGLE, N_("Close to tray"), P_OFFINTNL(hex_gui_tray_close), 0, 0, 0},
{ST_TOGGLE, N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("Automatically change status when hiding to tray."), 0, 0},
{ST_TOGGLE, N_("Only show notifications when hidden or iconified"), P_OFFINTNL(hex_gui_tray_quiet), 0, 0, 0},
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
{ST_END, 0, 0, 0, 0, 0}
};
static const setting alert_settings_nonotifications[] =
{
{ST_HEADER, N_("Alerts"),0,0,0},
{ST_ALERTHEAD},
2011-02-23 22:14:30 -05:00
{ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0},
2014-05-11 04:43:01 -04:00
#ifdef HAVE_GTK_MAC
{ST_3OGGLE, N_("Bounce dock icon on:"), 0, 0, (void *)taskbarlist, 0},
#else
#ifndef __APPLE__
2011-02-23 22:14:30 -05:00
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
2014-05-11 04:43:01 -04:00
#endif
#endif
2013-04-27 23:31:45 -04:00
#ifdef WIN32
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play the \"Instant Message Notification\" system sound upon the selected events"), (void *)beeplist, 0},
#else
#ifdef USE_LIBCANBERRA
2013-04-27 23:31:45 -04:00
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play \"message-new-instant\" from the freedesktop.org sound theme upon the selected events"), (void *)beeplist, 0},
#else
{ST_3OGGLE, N_("Make a beep sound on:"), 0, N_("Play a GTK beep upon the selected events"), (void *)beeplist, 0},
#endif
2013-04-27 23:31:45 -04:00
#endif
2011-02-23 22:14:30 -05:00
2012-10-22 03:53:28 -04:00
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
2011-02-23 22:14:30 -05:00
2012-11-10 13:29:12 -05:00
{ST_HEADER, N_("Tray Behavior"), 0, 0, 0},
{ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 4},
2012-11-10 13:29:12 -05:00
{ST_TOGGLE, N_("Minimize to tray"), P_OFFINTNL(hex_gui_tray_minimize), 0, 0, 0},
{ST_TOGGLE, N_("Close to tray"), P_OFFINTNL(hex_gui_tray_close), 0, 0, 0},
2013-03-24 22:14:23 -04:00
{ST_TOGGLE, N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("Automatically change status when hiding to tray."), 0, 0},
2012-11-10 13:29:12 -05:00
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
2012-10-22 08:50:36 -04:00
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
2011-02-23 22:14:30 -05:00
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
2013-03-25 02:41:13 -04:00
static const setting alert_settings_unity[] =
{
{ST_HEADER, N_("Alerts"),0,0,0},
{ST_ALERTHEAD},
{ST_3OGGLE, N_("Show notifications on:"), 0, 0, (void *)balloonlist, 0},
2013-03-25 02:41:13 -04:00
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL(hex_gui_focus_omitalerts), 0, 0, 0},
2013-03-25 02:41:13 -04:00
{ST_HEADER, N_("Highlighted Messages"),0,0,0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL(hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL(hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL(hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
{ST_END, 0, 0, 0, 0, 0}
};
static const setting alert_settings_unityandnonotifications[] =
{
{ST_HEADER, N_("Alerts"), 0, 0, 0},
{ST_ALERTHEAD},
{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
{ST_TOGGLE, N_("Omit alerts when marked as being away"), P_OFFINTNL (hex_away_omit_alerts), 0, 0, 0},
{ST_TOGGLE, N_("Omit alerts while the window is focused"), P_OFFINTNL (hex_gui_focus_omitalerts), 0, 0, 0},
{ST_HEADER, N_("Highlighted Messages"), 0, 0, 0},
{ST_LABEL, N_("Highlighted messages are ones where your nickname is mentioned, but also:"), 0, 0, 0, 1},
{ST_ENTRY, N_("Extra words to highlight:"), P_OFFSETNL (hex_irc_extra_hilight), 0, 0, sizeof prefs.hex_irc_extra_hilight},
{ST_ENTRY, N_("Nick names not to highlight:"), P_OFFSETNL (hex_irc_no_hilight), 0, 0, sizeof prefs.hex_irc_no_hilight},
{ST_ENTRY, N_("Nick names to always highlight:"), P_OFFSETNL (hex_irc_nick_hilight), 0, 0, sizeof prefs.hex_irc_nick_hilight},
{ST_LABEL, N_("Separate multiple words with commas.\nWildcards are accepted.")},
{ST_END, 0, 0, 0, 0, 0}
};
2011-02-23 22:14:30 -05:00
static const setting general_settings[] =
{
{ST_HEADER, N_("Default Messages"),0,0,0},
2012-10-22 08:50:36 -04:00
{ST_ENTRY, N_("Quit:"), P_OFFSETNL(hex_irc_quit_reason), 0, 0, sizeof prefs.hex_irc_quit_reason},
{ST_ENTRY, N_("Leave channel:"), P_OFFSETNL(hex_irc_part_reason), 0, 0, sizeof prefs.hex_irc_part_reason},
2012-10-22 03:53:28 -04:00
{ST_ENTRY, N_("Away:"), P_OFFSETNL(hex_away_reason), 0, 0, sizeof prefs.hex_away_reason},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Away"),0,0,0},
{ST_TOGGLE, N_("Show away once"), P_OFFINTNL(hex_away_show_once), N_("Show identical away messages only once."), 0, 0},
{ST_TOGGLE, N_("Automatically unmark away"), P_OFFINTNL(hex_away_auto_unmark), N_("Unmark yourself as away before sending messages."), 0, 0},
2013-05-19 14:43:21 -04:00
{ST_HEADER, N_("Miscellaneous"),0,0,0},
{ST_TOGGLE, N_("Display MODEs in raw form"), P_OFFINTNL(hex_irc_raw_modes), 0, 0, 0},
{ST_TOGGLE, N_("WHOIS on notify"), P_OFFINTNL(hex_notify_whois_online), N_("Sends a /WHOIS when a user comes online in your notify list."), 0, 0},
{ST_TOGGLE, N_("Hide join and part messages"), P_OFFINTNL(hex_irc_conf_mode), N_("Hide channel join/part messages by default."), 0, 0},
{ST_TOGGLE, N_("Hide nick change messages"), P_OFFINTNL(hex_irc_hide_nickchange), 0, 0, 0},
2013-05-19 14:43:21 -04:00
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
2013-06-09 15:51:57 -04:00
static const char *const bantypemenu[] =
{
N_("*!*@*.host"),
N_("*!*@domain"),
N_("*!*user@*.host"),
N_("*!*user@domain"),
NULL
};
2011-02-23 22:14:30 -05:00
static const setting advanced_settings[] =
{
2012-09-01 15:40:56 -04:00
{ST_HEADER, N_("Auto Copy Behavior"),0,0,0},
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Automatically copy selected text"), P_OFFINTNL(hex_text_autocopy_text),
N_("Copy selected text to clipboard when left mouse button is released. "
"Otherwise, CONTROL-SHIFT-C will copy the "
"selected text to the clipboard."), 0, 0},
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Automatically include time stamps"), P_OFFINTNL(hex_text_autocopy_stamp),
N_("Automatically include time stamps in copied lines of text. Otherwise, "
"include time stamps if the SHIFT key is held down while selecting."), 0, 0},
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Automatically include color information"), P_OFFINTNL(hex_text_autocopy_color),
N_("Automatically include color information in copied lines of text. "
"Otherwise, include color information if the CONTROL key is held down "
"while selecting."), 0, 0},
{ST_HEADER, N_("Miscellaneous"), 0, 0, 0},
2013-05-19 14:43:21 -04:00
{ST_ENTRY, N_("Real name:"), P_OFFSETNL(hex_irc_real_name), 0, 0, sizeof prefs.hex_irc_real_name},
#ifdef WIN32
{ST_ENTRY, N_("Alternative fonts:"), P_OFFSETNL(hex_text_font_alternative), N_("Separate multiple entries with commas without spaces before or after."), 0, sizeof prefs.hex_text_font_alternative},
2013-05-19 14:43:21 -04:00
#endif
{ST_TOGGLE, N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0},
{ST_TOGGLE, N_("Use server time if supported"), P_OFFINTNL(hex_irc_cap_server_time), N_("Display timestamps obtained from server if it supports the time-server extension."), 0, 0},
2013-05-19 14:43:21 -04:00
{ST_TOGGLE, N_("Automatically reconnect to servers on disconnect"), P_OFFINTNL(hex_net_auto_reconnect), 0, 0, 1},
{ST_NUMBER, N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999},
{ST_NUMBER, N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999},
2013-06-09 15:51:57 -04:00
{ST_MENU, N_("Ban Type:"), P_OFFINTNL(hex_irc_ban_type), N_("Attempt to use this banmask when banning or quieting. (requires irc_who_join)"), bantypemenu, 0},
2013-05-19 14:43:21 -04:00
{ST_END, 0, 0, 0, 0, 0}
};
2011-02-23 22:14:30 -05:00
static const setting logging_settings[] =
{
{ST_HEADER, N_("Logging"),0,0,0},
{ST_TOGGLE, N_("Display scrollback from previous session"), P_OFFINTNL(hex_text_replay), 0, 0, 0},
2012-10-24 13:19:06 -04:00
{ST_NUMBER, N_("Scrollback lines:"), P_OFFINTNL(hex_text_max_lines),0,0,100000},
{ST_TOGGLE, N_("Enable logging of conversations to disk"), P_OFFINTNL(hex_irc_logging), 0, 0, 0},
2012-10-22 08:50:36 -04:00
{ST_ENTRY, N_("Log filename:"), P_OFFSETNL(hex_irc_logmask), 0, 0, sizeof prefs.hex_irc_logmask},
2011-02-23 22:14:30 -05:00
{ST_LABEL, N_("%s=Server %c=Channel %n=Network.")},
{ST_HEADER, N_("Time Stamps"),0,0,0},
{ST_TOGGLE, N_("Insert timestamps in logs"), P_OFFINTNL(hex_stamp_log), 0, 0, 1},
2012-10-22 09:55:43 -04:00
{ST_ENTRY, N_("Log timestamp format:"), P_OFFSETNL(hex_stamp_log_format), 0, 0, sizeof prefs.hex_stamp_log_format},
2012-02-16 11:21:15 -05:00
#ifdef WIN32
{ST_LABEL, N_("See the strftime MSDN article for details.")},
#else
{ST_LABEL, N_("See the strftime manpage for details.")},
#endif
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("URLs"),0,0,0},
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Enable logging of URLs to disk"), P_OFFINTNL(hex_url_logging), 0, 0, 0},
{ST_TOGGLE, N_("Enable URL grabber"), P_OFFINTNL(hex_url_grabber), 0, 0, 1},
2012-10-22 09:55:43 -04:00
{ST_NUMBER, N_("Maximum number of URLs to grab:"), P_OFFINTNL(hex_url_grabber_limit), 0, 0, 9999},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
static const char *const proxytypes[] =
{
N_("(Disabled)"),
N_("Wingate"),
N_("Socks4"),
N_("Socks5"),
N_("HTTP"),
#ifdef USE_LIBPROXY
N_("Auto"),
#endif
NULL
};
static const char *const proxyuse[] =
{
N_("All Connections"),
N_("IRC Server Only"),
N_("DCC Get Only"),
NULL
};
static const setting network_settings[] =
{
{ST_HEADER, N_("Your Address"), 0, 0, 0, 0},
2012-10-22 09:55:43 -04:00
{ST_ENTRY, N_("Bind to:"), P_OFFSETNL(hex_net_bind_host), 0, 0, sizeof prefs.hex_net_bind_host},
2011-02-23 22:14:30 -05:00
{ST_LABEL, N_("Only useful for computers with multiple addresses.")},
2013-05-19 14:43:21 -04:00
{ST_HEADER, N_("File Transfers"), 0, 0, 0},
{ST_TOGGLE, N_("Get my address from the IRC server"), P_OFFINTNL(hex_dcc_ip_from_server),
N_("Asks the IRC server for your real address. Use this if you have a 192.168.*.* address!"), 0, 0},
{ST_ENTRY, N_("DCC IP address:"), P_OFFSETNL(hex_dcc_ip),
N_("Claim you are at this address when offering files."), 0, sizeof prefs.hex_dcc_ip},
{ST_NUMBER, N_("First DCC send port:"), P_OFFINTNL(hex_dcc_port_first), 0, 0, 65535},
{ST_NUMBER, N_("Last DCC send port:"), P_OFFINTNL(hex_dcc_port_last), 0,
(const char **)N_("!Leave ports at zero for full range."), 65535},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Proxy Server"), 0, 0, 0, 0},
2012-10-22 09:55:43 -04:00
{ST_ENTRY, N_("Hostname:"), P_OFFSETNL(hex_net_proxy_host), 0, 0, sizeof prefs.hex_net_proxy_host},
{ST_NUMBER, N_("Port:"), P_OFFINTNL(hex_net_proxy_port), 0, 0, 65535},
{ST_MENU, N_("Type:"), P_OFFINTNL(hex_net_proxy_type), 0, proxytypes, 0},
{ST_MENU, N_("Use proxy for:"), P_OFFINTNL(hex_net_proxy_use), 0, proxyuse, 0},
2011-02-23 22:14:30 -05:00
{ST_HEADER, N_("Proxy Authentication"), 0, 0, 0, 0},
2012-10-22 09:55:43 -04:00
{ST_TOGGLE, N_("Use Authentication (HTTP or Socks5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0},
{ST_ENTRY, N_("Username:"), P_OFFSETNL(hex_net_proxy_user), 0, 0, sizeof prefs.hex_net_proxy_user},
{ST_ENTRY, N_("Password:"), P_OFFSETNL(hex_net_proxy_pass), 0, GINT_TO_POINTER(1), sizeof prefs.hex_net_proxy_pass},
2011-02-23 22:14:30 -05:00
{ST_END, 0, 0, 0, 0, 0}
};
#define setup_get_str(pr,set) (((char *)pr)+set->offset)
#define setup_get_int(pr,set) *(((int *)pr)+set->offset)
#define setup_get_int3(pr,off) *(((int *)pr)+off)
#define setup_set_int(pr,set,num) *((int *)pr+set->offset)=num
#define setup_set_str(pr,set,str) strcpy(((char *)pr)+set->offset,str)
static void
setup_3oggle_cb (GtkToggleButton *but, unsigned int *setting)
{
*setting = gtk_toggle_button_get_active (but);
2011-02-23 22:14:30 -05:00
}
static void
setup_headlabel (GtkWidget *tab, int row, int col, char *text)
{
GtkWidget *label;
char buf[128];
char *sp;
2014-12-17 18:49:59 -05:00
g_snprintf (buf, sizeof (buf), "<b><span size=\"smaller\">%s</span></b>", text);
2011-02-23 22:14:30 -05:00
sp = strchr (buf + 17, ' ');
if (sp)
*sp = '\n';
label = gtk_label_new (NULL);
gtk_label_set_markup (GTK_LABEL (label), buf);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (tab), label, col, col + 1, row, row + 1, 0, 0, 4, 0);
}
static void
setup_create_alert_header (GtkWidget *tab, int row, const setting *set)
{
setup_headlabel (tab, row, 3, _("Channel Message"));
setup_headlabel (tab, row, 4, _("Private Message"));
setup_headlabel (tab, row, 5, _("Highlighted Message"));
}
/* makes 3 toggles side-by-side */
static void
setup_create_3oggle (GtkWidget *tab, int row, const setting *set)
{
GtkWidget *label, *wid;
int *offsets = (int *)set->list;
label = gtk_label_new (_(set->label));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
2013-04-27 23:31:45 -04:00
if (set->tooltip)
{
2014-01-18 04:08:32 -05:00
gtk_widget_set_tooltip_text (label, _(set->tooltip));
2013-04-27 23:31:45 -04:00
}
2011-02-23 22:14:30 -05:00
gtk_table_attach (GTK_TABLE (tab), label, 2, 3, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, LABEL_INDENT, 0);
wid = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid),
setup_get_int3 (&setup_prefs, offsets[0]));
g_signal_connect (G_OBJECT (wid), "toggled",
G_CALLBACK (setup_3oggle_cb), ((int *)&setup_prefs) + offsets[0]);
gtk_table_attach (GTK_TABLE (tab), wid, 3, 4, row, row + 1, 0, 0, 0, 0);
wid = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid),
setup_get_int3 (&setup_prefs, offsets[1]));
g_signal_connect (G_OBJECT (wid), "toggled",
G_CALLBACK (setup_3oggle_cb), ((int *)&setup_prefs) + offsets[1]);
gtk_table_attach (GTK_TABLE (tab), wid, 4, 5, row, row + 1, 0, 0, 0, 0);
wid = gtk_check_button_new ();
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wid),
setup_get_int3 (&setup_prefs, offsets[2]));
g_signal_connect (G_OBJECT (wid), "toggled",
G_CALLBACK (setup_3oggle_cb), ((int *)&setup_prefs) + offsets[2]);
gtk_table_attach (GTK_TABLE (tab), wid, 5, 6, row, row + 1, 0, 0, 0, 0);
}
static void
setup_toggle_cb (GtkToggleButton *but, const setting *set)
{
GtkWidget *label, *disable_wid;
setup_set_int (&setup_prefs, set, gtk_toggle_button_get_active (but));
2011-02-23 22:14:30 -05:00
/* does this toggle also enable/disable another widget? */
disable_wid = g_object_get_data (G_OBJECT (but), "nxt");
if (disable_wid)
{
gtk_widget_set_sensitive (disable_wid, gtk_toggle_button_get_active (but));
2011-02-23 22:14:30 -05:00
label = g_object_get_data (G_OBJECT (disable_wid), "lbl");
gtk_widget_set_sensitive (label, gtk_toggle_button_get_active (but));
2011-02-23 22:14:30 -05:00
}
}
static void