summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2013-03-25 02:41:13 -0400
committerTingPing <tingping@tingping.se>2013-03-25 02:41:13 -0400
commite9a3528bbd6babdda1b287fe244abc4041f217ae (patch)
tree2b9c85a37f4c1c97db34cb5937c2d7c8e0023a2c /src
parent1c929cd69482b52f780e1faedf7b8998d346dc1e (diff)
Disable tray when using Unity
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c11
-rw-r--r--src/common/util.h1
-rw-r--r--src/fe-gtk/maingui.c6
-rw-r--r--src/fe-gtk/plugin-tray.c4
-rw-r--r--src/fe-gtk/setup.c26
5 files changed, 43 insertions, 5 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 2319f75e..0f04d9ca 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -1877,6 +1877,17 @@ hextray_mode ()
 #endif
 }
 
+int
+unity_mode ()
+{
+#ifdef G_OS_UNIX
+	const char *env = g_getenv("XDG_CURRENT_DESKTOP");
+	if (env && strcmp (env, "Unity") == 0)
+		return 1;
+#endif
+	return 0;
+}
+
 /* Routine for listing subfolders of a given folder. ALWAYS free correctly after use, e.g.
 void display_list (GSList *list)
 {
diff --git a/src/common/util.h b/src/common/util.h
index 8114cbc7..601d9e50 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -60,6 +60,7 @@ void safe_strcpy (char *dest, const char *src, int bytes_left);
 void canonalize_key (char *key);
 int portable_mode ();
 int hextray_mode ();
+int unity_mode ();
 GSList *get_subdirs (const char *path);
 char *encode_sasl_pass (char *user, char *pass);
 
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 2d02c59d..d344c591 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -501,7 +501,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_minimize && !hextray_mode ())
+		 prefs.hex_gui_tray_minimize && !hextray_mode () && !unity_mode ())
 	{
 		tray_toggle_visibility (TRUE);
 		gtk_window_deiconify (wid);
@@ -1295,7 +1295,7 @@ mg_open_quit_dialog (gboolean minimize_button)
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
 										GTK_BUTTONBOX_END);
 
-	if (minimize_button && !hextray_mode ())
+	if (minimize_button && !hextray_mode () && !unity_mode ())
 	{
 		button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
 		gtk_widget_show (button);
@@ -3087,7 +3087,7 @@ mg_tabwindow_de_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 	GSList *list;
 	session *sess;
 
-	if (prefs.hex_gui_tray_close && !hextray_mode () && tray_toggle_visibility (FALSE))
+	if (prefs.hex_gui_tray_close && !hextray_mode () && !unity_mode () && 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 694e4c35..2d8553a3 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -837,7 +837,7 @@ tray_apply_setup (void)
 	}
 	else
 	{
-		if (prefs.hex_gui_tray && !hextray_mode ())
+		if (prefs.hex_gui_tray && !hextray_mode () && !unity_mode ())
 			tray_init ();
 	}
 }
@@ -869,7 +869,7 @@ tray_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
 
 	hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
 
-	if (prefs.hex_gui_tray && !hextray_mode ())
+	if (prefs.hex_gui_tray && !hextray_mode () && !unity_mode ())
 		tray_init ();
 
 	return 1;       /* return 1 for success */
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index 33004a8f..ef9dd8cd 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -462,6 +462,28 @@ static const setting alert_settings[] =
 	{ST_END, 0, 0, 0, 0, 0}
 };
 
+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_("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_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_hextray[] =
 {
 	{ST_HEADER,	N_("Alerts"),0,0,0},
@@ -1950,6 +1972,10 @@ setup_create_pages (GtkWidget *box)
 	{
 		setup_add_page (cata[8], book, setup_create_page (alert_settings_hextray));
 	}
+	else if (unity_mode ())
+	{
+		setup_add_page (cata[8], book, setup_create_page (alert_settings_unity));
+	}
 	else
 	{
 		setup_add_page (cata[8], book, setup_create_page (alert_settings));