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 c361bdca6a
See-also: https://github.com/hexchat/hexchat/pull/2255#issuecomment-475841824
This commit is contained in:
Paul Wise 2020-08-03 09:26:26 +08:00 committed by Patrick
parent aec72593f2
commit 71eb79fee4

View File

@ -1030,8 +1030,11 @@ menu_chanmenu (struct session *sess, GdkEventButton * event, char *chan)
{ {
GtkWidget *menu; GtkWidget *menu;
int is_joined = FALSE; 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; is_joined = TRUE;
g_free (str_copy); g_free (str_copy);
@ -1047,8 +1050,9 @@ menu_chanmenu (struct session *sess, GdkEventButton * event, char *chan)
str_copy); str_copy);
else else
{ {
menu_quick_item_with_callback (menu_chan_focus, _("Focus Channel"), menu, if (chan_session != current_sess)
str_copy); menu_quick_item_with_callback (menu_chan_focus, _("Focus Channel"), menu,
str_copy);
menu_quick_item_with_callback (menu_chan_part, _("Part Channel"), menu, menu_quick_item_with_callback (menu_chan_part, _("Part Channel"), menu,
str_copy); str_copy);
menu_quick_item_with_callback (menu_chan_cycle, _("Cycle Channel"), menu, menu_quick_item_with_callback (menu_chan_cycle, _("Cycle Channel"), menu,