summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPaul Wise <pabs3@bonedaddy.net>2020-08-03 09:26:26 +0800
committerPatrick <tingping@tingping.se>2020-08-05 18:12:31 +0200
commit71eb79fee4881a9ad06012a642b8deb3b4453c77 (patch)
tree05b139a657c3ba8c0bc4036f39781d5ee067ebdd
parentaec72593f265b09bc53291d00300490a5d0d9911 (diff)
Hide Focus Channel when the selected channel is already focussed
When the channel is focussed, the menu item does nothing so
it isn't useful to have it in the menu.

Fixes: commit c361bdca6afdc933eeac35732334464990295cd4
See-also: https://github.com/hexchat/hexchat/pull/2255#issuecomment-475841824
-rw-r--r--src/fe-gtk/menu.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index aba3d745..233715e5 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -1030,8 +1030,11 @@ menu_chanmenu (struct session *sess, GdkEventButton * event, char *chan)
 {
 	GtkWidget *menu;
 	int is_joined = FALSE;
+	session * chan_session;
 
-	if (find_channel (sess->server, chan))
+	chan_session = find_channel (sess->server, chan);
+
+	if (chan_session)
 		is_joined = TRUE;
 
 	g_free (str_copy);
@@ -1047,8 +1050,9 @@ menu_chanmenu (struct session *sess, GdkEventButton * event, char *chan)
 												 str_copy);
 	else
 	{
-		menu_quick_item_with_callback (menu_chan_focus, _("Focus Channel"), menu,
-												 str_copy);
+		if (chan_session != current_sess)
+			menu_quick_item_with_callback (menu_chan_focus, _("Focus Channel"), menu,
+													 str_copy);
 		menu_quick_item_with_callback (menu_chan_part, _("Part Channel"), menu,
 												 str_copy);
 		menu_quick_item_with_callback (menu_chan_cycle, _("Cycle Channel"), menu,