From 4524367cc037f6b3e173de96ea9b57afc2a0da5a Mon Sep 17 00:00:00 2001 From: TingPing Date: Thu, 20 Dec 2012 19:39:52 -0500 Subject: [PATCH 1/5] Add auto-away to plugin-tray --- src/common/cfgfiles.c | 1 + src/common/hexchat.h | 1 + src/fe-gtk/plugin-tray.c | 4 ++++ src/fe-gtk/setup.c | 1 + 4 files changed, 7 insertions(+) diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index b51fb1d2..c1e742c5 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -460,6 +460,7 @@ 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_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}, diff --git a/src/common/hexchat.h b/src/common/hexchat.h index d84e2761..5d5cda69 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -152,6 +152,7 @@ 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_close; unsigned int hex_gui_tray_minimize; unsigned int hex_gui_tray_quiet; diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 07207a99..1db0f630 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -394,12 +394,16 @@ 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); gtk_widget_hide (GTK_WIDGET (win)); } else { + if (prefs.hex_gui_tray_away) + hexchat_command (ph, "ALLSERV BACK"); gtk_window_set_screen (win, screen); gtk_window_move (win, x, y); gtk_widget_show (GTK_WIDGET (win)); diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c index df31376d..87a943a5 100644 --- a/src/fe-gtk/setup.c +++ b/src/fe-gtk/setup.c @@ -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 From b259595c9d5d27686e26f8aac2a74f4ef189555a Mon Sep 17 00:00:00 2001 From: TingPing Date: Thu, 20 Dec 2012 19:53:58 -0500 Subject: [PATCH 2/5] allow tray blinks to be static icons --- src/common/cfgfiles.c | 2 ++ src/common/hexchat.h | 1 + src/fe-gtk/plugin-tray.c | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index c1e742c5..31336c20 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -461,6 +461,7 @@ const struct prefs vars[] = {"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}, @@ -669,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; diff --git a/src/common/hexchat.h b/src/common/hexchat.h index 5d5cda69..c80156bd 100644 --- a/src/common/hexchat.h +++ b/src/common/hexchat.h @@ -153,6 +153,7 @@ struct hexchatprefs 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; diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 1db0f630..9f0eff32 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -301,7 +301,8 @@ tray_set_flash (TrayIcon icon) tray_stop_flash (); gtk_status_icon_set_from_pixbuf (sticon, icon); - flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon); + if (prefs.hex_gui_tray_blink) + flash_tag = g_timeout_add (TIMEOUT, (GSourceFunc) tray_timeout_cb, icon); } void From 9aa33ad1d36c345a6fa34d142d2839127a742cde Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 21 Dec 2012 15:09:00 -0500 Subject: [PATCH 3/5] add glebihans disappearing tray patch --- src/fe-gtk/plugin-tray.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 9f0eff32..73a7572b 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -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 @@ -420,6 +424,35 @@ 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 && strcmp (pspec->name, "embedded") == 0) + { + 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) { @@ -627,6 +660,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", + G_CALLBACK (tray_menu_notify_cb), NULL); } static int From 00bd8d42c3b2e3a6fd453393f401cc0af5071135 Mon Sep 17 00:00:00 2001 From: TingPing Date: Thu, 3 Jan 2013 18:18:04 -0500 Subject: [PATCH 4/5] use tabs --- src/fe-gtk/plugin-tray.c | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 73a7572b..17d55780 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -427,29 +427,29 @@ tray_menu_restore_cb (GtkWidget *item, gpointer userdata) static void tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data) { - if (sticon && strcmp (pspec->name, "embedded") == 0) - { - 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; - } - } - } + if (sticon && strcmp (pspec->name, "embedded") == 0) + { + 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; + tray_cleanup(); + tray_init(); + return TRUE; } @@ -661,7 +661,7 @@ tray_init (void) g_signal_connect (G_OBJECT (sticon), "activate", G_CALLBACK (tray_menu_restore_cb), NULL); - g_signal_connect (G_OBJECT (sticon), "notify", + g_signal_connect (G_OBJECT (sticon), "notify", G_CALLBACK (tray_menu_notify_cb), NULL); } From af92429ea05918dfa2502eb3ba2323b1423870cb Mon Sep 17 00:00:00 2001 From: TingPing Date: Fri, 4 Jan 2013 20:30:30 -0500 Subject: [PATCH 5/5] use notify::embedded --- src/fe-gtk/plugin-tray.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 17d55780..ccd00f97 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -427,7 +427,7 @@ tray_menu_restore_cb (GtkWidget *item, gpointer userdata) static void tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data) { - if (sticon && strcmp (pspec->name, "embedded") == 0) + if (sticon) { if (!gtk_status_icon_is_embedded (sticon)) { @@ -452,7 +452,6 @@ tray_menu_try_restore () return TRUE; } - static void tray_menu_quit_cb (GtkWidget *item, gpointer userdata) { @@ -661,7 +660,7 @@ tray_init (void) g_signal_connect (G_OBJECT (sticon), "activate", G_CALLBACK (tray_menu_restore_cb), NULL); - g_signal_connect (G_OBJECT (sticon), "notify", + g_signal_connect (G_OBJECT (sticon), "notify::embedded", G_CALLBACK (tray_menu_notify_cb), NULL); }