summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2012-11-10 19:29:12 +0100
committerBerke Viktor <bviktor@hexchat.org>2012-11-10 19:29:12 +0100
commit475607826343340f509cf8a3f194b11e469ff8ad (patch)
tree9aee2368ec270c9adc83b1d8674e6449d20d4603
parent5781cd0c44350907b65f855fcd22e338509e35b0 (diff)
Explode gui_tray_flags
-rw-r--r--src/common/cfgfiles.c4
-rw-r--r--src/common/hexchat.h4
-rw-r--r--src/fe-gtk/maingui.c6
-rw-r--r--src/fe-gtk/plugin-tray.c2
-rw-r--r--src/fe-gtk/setup.c9
5 files changed, 18 insertions, 7 deletions
diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c
index 516de473..3daab3a0 100644
--- a/src/common/cfgfiles.c
+++ b/src/common/cfgfiles.c
@@ -459,7 +459,9 @@ const struct prefs vars[] =
 	{"gui_throttlemeter", P_OFFINT (hex_gui_throttlemeter), TYPE_INT},
 	{"gui_topicbar", P_OFFINT (hex_gui_topicbar), TYPE_BOOL},
 	{"gui_tray", P_OFFINT (hex_gui_tray), TYPE_BOOL},
-	{"gui_tray_flags", P_OFFINT (hex_gui_tray_flags), TYPE_INT},
+	{"gui_tray_close", P_OFFINT (hex_gui_tray_close), TYPE_BOOL},
+	{"gui_tray_minimize", P_OFFINT (hex_gui_tray_minimize), TYPE_BOOL},
+	{"gui_tray_quiet", P_OFFINT (hex_gui_tray_quiet), TYPE_BOOL},
 	{"gui_ulist_buttons", P_OFFINT (hex_gui_ulist_buttons), TYPE_BOOL},
 	{"gui_ulist_count", P_OFFINT (hex_gui_ulist_count), TYPE_BOOL},
 	{"gui_ulist_doubleclick", P_OFFSET (hex_gui_ulist_doubleclick), TYPE_STR},
diff --git a/src/common/hexchat.h b/src/common/hexchat.h
index 5a187d3a..357bdad3 100644
--- a/src/common/hexchat.h
+++ b/src/common/hexchat.h
@@ -152,6 +152,9 @@ struct hexchatprefs
 	unsigned int hex_gui_tab_utils;
 	unsigned int hex_gui_topicbar;
 	unsigned int hex_gui_tray;
+	unsigned int hex_gui_tray_close;
+	unsigned int hex_gui_tray_minimize;
+	unsigned int hex_gui_tray_quiet;
 	unsigned int hex_gui_ulist_buttons;
 	unsigned int hex_gui_ulist_count;
 	unsigned int hex_gui_ulist_hide;
@@ -259,7 +262,6 @@ struct hexchatprefs
 	int hex_gui_tab_small;
 	int hex_gui_tab_trunc;
 	int hex_gui_throttlemeter;
-	int hex_gui_tray_flags;
 	int hex_gui_ulist_pos;
 	int hex_gui_ulist_sort;
 	int hex_gui_url_mod;
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index e6817dc6..a71c2cbf 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -504,7 +504,7 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
 
 	if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
 		 (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
-		 (prefs.hex_gui_tray_flags & 4))
+		 prefs.hex_gui_tray_minimize)
 	{
 		tray_toggle_visibility (TRUE);
 		gtk_window_deiconify (wid);
@@ -1325,7 +1325,7 @@ mg_open_quit_dialog (gboolean minimize_button)
 	case 1: /* minimize to tray */
 		if (GTK_TOGGLE_BUTTON (checkbutton1)->active)
 		{
-			prefs.hex_gui_tray_flags |= 1;
+			prefs.hex_gui_tray_close = 1;
 			/*prefs.hex_gui_quit_dialog = 0;*/
 		}
 		/* force tray icon ON, if not already */
@@ -3074,7 +3074,7 @@ mg_tabwindow_de_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 	GSList *list;
 	session *sess;
 
-	if ((prefs.hex_gui_tray_flags & 1) && tray_toggle_visibility (FALSE))
+	if (prefs.hex_gui_tray_close && tray_toggle_visibility (FALSE))
 		return TRUE;
 
 	/* check for remaining toplevel windows */
diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c
index adbddf8f..d649c9f9 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -148,7 +148,7 @@ fe_tray_set_balloon (const char *title, const char *text)
 		return;
 
 	/* bit 1 of flags means "no balloons unless hidden/iconified" */
-	if (ws != WS_HIDDEN && (prefs.hex_gui_tray_flags & 2))
+	if (ws != WS_HIDDEN && prefs.hex_gui_tray_quiet)
 		return;
 
 	/* FIXME: this should close the current balloon */
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 7f6e37ff..24e1cd4d 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -429,9 +429,16 @@ static const setting alert_settings[] =
 	{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_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 0},
 	{ST_TOGGLE,	N_("Omit alerts when marked as being away"), P_OFFINTNL(hex_away_omit_alerts), 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, 0},
+	{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},
+#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},