Disable tray when using Unity

This commit is contained in:
TingPing 2013-03-25 02:41:13 -04:00
parent 1c929cd694
commit e9a3528bbd
5 changed files with 43 additions and 5 deletions

View File

@ -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)
{

View File

@ -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);

View File

@ -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 */

View File

@ -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 */

View File

@ -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));