mirror of
https://github.com/moparisthebest/hexchat
synced 2024-12-22 23:58:52 -05:00
Merge pull request #337 from TingPing/tray
add even more tray icon changes
This commit is contained in:
commit
0ecbeb7152
@ -460,6 +460,8 @@ 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_away", P_OFFINT (hex_gui_tray_away), TYPE_BOOL},
|
||||
{"gui_tray_blink", P_OFFINT (hex_gui_tray_blink), TYPE_BOOL},
|
||||
{"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},
|
||||
@ -668,6 +670,7 @@ load_config (void)
|
||||
prefs.hex_gui_tab_sort = 1;
|
||||
prefs.hex_gui_topicbar = 1;
|
||||
prefs.hex_gui_tray = 1;
|
||||
prefs.hex_gui_tray_blink = 1;
|
||||
prefs.hex_gui_ulist_count = 1;
|
||||
prefs.hex_gui_ulist_icons = 1;
|
||||
prefs.hex_gui_ulist_resizable = 1;
|
||||
|
@ -152,6 +152,8 @@ struct hexchatprefs
|
||||
unsigned int hex_gui_tab_utils;
|
||||
unsigned int hex_gui_topicbar;
|
||||
unsigned int hex_gui_tray;
|
||||
unsigned int hex_gui_tray_away;
|
||||
unsigned int hex_gui_tray_blink;
|
||||
unsigned int hex_gui_tray_close;
|
||||
unsigned int hex_gui_tray_minimize;
|
||||
unsigned int hex_gui_tray_quiet;
|
||||
|
@ -73,9 +73,13 @@ static int tray_priv_count = 0;
|
||||
static int tray_pub_count = 0;
|
||||
static int tray_hilight_count = 0;
|
||||
static int tray_file_count = 0;
|
||||
static int tray_restore_timer = 0;
|
||||
|
||||
|
||||
void tray_apply_setup (void);
|
||||
static gboolean tray_menu_try_restore ();
|
||||
static void tray_cleanup (void);
|
||||
static void tray_init (void);
|
||||
|
||||
|
||||
static WinStatus
|
||||
@ -301,6 +305,7 @@ tray_set_flash (TrayIcon icon)
|
||||
tray_stop_flash ();
|
||||
|
||||
gtk_status_icon_set_from_pixbuf (sticon, icon);
|
||||
if (prefs.hex_gui_tray_blink)
|
||||
flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon);
|
||||
}
|
||||
|
||||
@ -395,6 +400,8 @@ tray_toggle_visibility (gboolean force_hide)
|
||||
if (force_hide || GTK_WIDGET_VISIBLE (win))
|
||||
#endif
|
||||
{
|
||||
if (prefs.hex_gui_tray_away)
|
||||
hexchat_command (ph, "ALLSERV AWAY");
|
||||
gtk_window_get_position (win, &x, &y);
|
||||
screen = gtk_window_get_screen (win);
|
||||
maximized = prefs.hex_gui_win_state;
|
||||
@ -402,6 +409,8 @@ tray_toggle_visibility (gboolean force_hide)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (prefs.hex_gui_tray_away)
|
||||
hexchat_command (ph, "ALLSERV BACK");
|
||||
gtk_window_set_screen (win, screen);
|
||||
gtk_window_move (win, x, y);
|
||||
if (maximized)
|
||||
@ -419,6 +428,34 @@ tray_menu_restore_cb (GtkWidget *item, gpointer userdata)
|
||||
tray_toggle_visibility (FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data)
|
||||
{
|
||||
if (sticon)
|
||||
{
|
||||
if (!gtk_status_icon_is_embedded (sticon))
|
||||
{
|
||||
tray_restore_timer = g_timeout_add(500, (GSourceFunc)tray_menu_try_restore, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tray_restore_timer)
|
||||
{
|
||||
g_source_remove (tray_restore_timer);
|
||||
tray_restore_timer = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
tray_menu_try_restore ()
|
||||
{
|
||||
tray_cleanup();
|
||||
tray_init();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
tray_menu_quit_cb (GtkWidget *item, gpointer userdata)
|
||||
{
|
||||
@ -626,6 +663,9 @@ tray_init (void)
|
||||
|
||||
g_signal_connect (G_OBJECT (sticon), "activate",
|
||||
G_CALLBACK (tray_menu_restore_cb), NULL);
|
||||
|
||||
g_signal_connect (G_OBJECT (sticon), "notify::embedded",
|
||||
G_CALLBACK (tray_menu_notify_cb), NULL);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -435,6 +435,7 @@ static const setting alert_settings[] =
|
||||
{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},
|
||||
{ST_TOGGLE, N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("When hiding to tray automatically change status."), 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
|
||||
|
Loading…
Reference in New Issue
Block a user