diff options
Diffstat (limited to 'src/fe-gtk/setup.c')
-rw-r--r-- | src/fe-gtk/setup.c | 118 |
1 files changed, 91 insertions, 27 deletions
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index e4372dc9..dc469591 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -36,6 +36,7 @@ #include "pixmaps.h" #include "menu.h" #include "plugin-tray.h" +#include "notifications/notification-backend.h" #ifdef WIN32 #include "../common/fe.h" @@ -314,6 +315,7 @@ static const setting tabs_settings[] = {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}, {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}, {ST_MENU, N_("Placement of notices:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0}, @@ -396,9 +398,47 @@ static const setting alert_settings[] = {ST_HEADER, N_("Alerts"),0,0,0}, {ST_ALERTHEAD}, -#if !defined (WIN32) && !defined (__APPLE__) - {ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0}, + + + {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 +#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}, {ST_3OGGLE, N_("Blink tray icon on:"), 0, 0, (void *)trayblinklist, 0}, #ifdef HAVE_GTK_MAC {ST_3OGGLE, N_("Bounce dock icon on:"), 0, 0, (void *)taskbarlist, 0}, @@ -421,17 +461,10 @@ static const setting alert_settings[] = {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}, -#ifdef WIN32 - {ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 3}, -#else {ST_TOGGLE, N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 4}, -#endif {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}, -#ifndef WIN32 - {ST_TOGGLE, N_("Only show tray balloons when hidden or iconified"), P_OFFINTNL(hex_gui_tray_quiet), 0, 0, 0}, -#endif {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}, @@ -449,7 +482,7 @@ static const setting alert_settings_unity[] = {ST_HEADER, N_("Alerts"),0,0,0}, {ST_ALERTHEAD}, - {ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0}, + {ST_3OGGLE, N_("Show notifications on:"), 0, 0, (void *)balloonlist, 0}, {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}, @@ -467,6 +500,28 @@ static const setting alert_settings_unity[] = {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} +}; + static const setting general_settings[] = { {ST_HEADER, N_("Default Messages"),0,0,0}, @@ -559,9 +614,6 @@ static const char *const proxytypes[] = N_("Socks4"), N_("Socks5"), N_("HTTP"), -#ifdef USE_MSPROXY - N_("MS Proxy (ISA)"), -#endif #ifdef USE_LIBPROXY N_("Auto"), #endif @@ -598,11 +650,7 @@ static const setting network_settings[] = {ST_MENU, N_("Use proxy for:"), P_OFFINTNL(hex_net_proxy_use), 0, proxyuse, 0}, {ST_HEADER, N_("Proxy Authentication"), 0, 0, 0, 0}, -#ifdef USE_MSPROXY - {ST_TOGGLE, N_("Use Authentication (MS Proxy, HTTP or Socks5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0}, -#else {ST_TOGGLE, N_("Use Authentication (HTTP or Socks5 only)"), P_OFFINTNL(hex_net_proxy_auth), 0, 0, 0}, -#endif {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}, @@ -630,7 +678,7 @@ setup_headlabel (GtkWidget *tab, int row, int col, char *text) char buf[128]; char *sp; - snprintf (buf, sizeof (buf), "<b><span size=\"smaller\">%s</span></b>", text); + g_snprintf (buf, sizeof (buf), "<b><span size=\"smaller\">%s</span></b>", text); sp = strchr (buf + 17, ' '); if (sp) *sp = '\n'; @@ -752,7 +800,7 @@ setup_create_italic_label (char *text) char buf[256]; label = gtk_label_new (NULL); - snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", text); + g_snprintf (buf, sizeof (buf), "<i><span size=\"smaller\">%s</span></i>", text); gtk_label_set_markup (GTK_LABEL (label), buf); gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER); @@ -1121,8 +1169,8 @@ setup_entry_cb (GtkEntry *entry, setting *set) { int size; int pos; - int len = gtk_entry_get_text_length (entry); unsigned char *p = (unsigned char*)gtk_entry_get_text (entry); + int len = strlen (p); /* need to truncate? */ if (len >= set->extra) @@ -1220,9 +1268,9 @@ setup_create_header (GtkWidget *table, int row, char *labeltext) char buf[128]; if (row == 0) - snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext)); + g_snprintf (buf, sizeof (buf), "<b>%s</b>", _(labeltext)); else - snprintf (buf, sizeof (buf), "\n<b>%s</b>", _(labeltext)); + g_snprintf (buf, sizeof (buf), "\n<b>%s</b>", _(labeltext)); label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), buf); @@ -1683,9 +1731,8 @@ setup_snd_changed_cb (GtkEntry *ent, GtkTreeView *tree) return; /* get the new sound file */ - if (sound_files[n]) - free (sound_files[n]); - sound_files[n] = strdup (gtk_entry_get_text (GTK_ENTRY (ent))); + g_free (sound_files[n]); + sound_files[n] = g_strdup (gtk_entry_get_text (GTK_ENTRY (ent))); /* update the TreeView list */ store = (GtkListStore *)gtk_tree_view_get_model (tree); @@ -1790,7 +1837,7 @@ setup_add_page (const char *title, GtkWidget *book, GtkWidget *tab) /* label */ label = gtk_label_new (NULL); - snprintf (buf, sizeof (buf), "<b><big>%s</big></b>", _(title)); + g_snprintf (buf, sizeof (buf), "<b><big>%s</big></b>", _(title)); gtk_label_set_markup (GTK_LABEL (label), buf); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); gtk_misc_set_padding (GTK_MISC (label), 2, 1); @@ -1839,10 +1886,18 @@ setup_create_pages (GtkWidget *box) setup_add_page (cata[8], book, setup_create_page (general_settings)); - if (unity_mode ()) + if (unity_mode () && !notification_backend_supported ()) + { + setup_add_page (cata[9], book, setup_create_page (alert_settings_unityandnonotifications)); + } + else if (unity_mode ()) { setup_add_page (cata[9], book, setup_create_page (alert_settings_unity)); } + else if (!notification_backend_supported ()) + { + setup_add_page (cata[9], book, setup_create_page (alert_settings_nonotifications)); + } else { setup_add_page (cata[9], book, setup_create_page (alert_settings)); @@ -2121,6 +2176,8 @@ setup_apply (struct hexchatprefs *pr) noapply = TRUE; if (DIFF (hex_gui_ulist_style)) noapply = TRUE; + if (DIFF (hex_gui_ulist_sort)) + noapply = TRUE; if (DIFF (hex_gui_tab_dots)) do_layout = TRUE; @@ -2137,6 +2194,13 @@ setup_apply (struct hexchatprefs *pr) " menu first."), FE_MSG_WARN | FE_MSG_MARKUP); + /* format cannot be blank, there is already a setting for this */ + if (pr->hex_stamp_text_format[0] == 0) + { + pr->hex_stamp_text = 0; + strcpy (pr->hex_stamp_text_format, prefs.hex_stamp_text_format); + } + memcpy (&prefs, pr, sizeof (prefs)); #ifdef WIN32 |