]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Hide Focus Channel when the selected channel is already focussed
authorPaul Wise <redacted>
Mon, 3 Aug 2020 01:26:26 +0000 (09:26 +0800)
committerPatrick <redacted>
Wed, 5 Aug 2020 16:12:31 +0000 (18:12 +0200)
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

src/fe-gtk/menu.c

index aba3d74563465389121db00af469203d6a1ab75d..233715e54fe541c3393257c85d4e9ebc986adfad 100644 (file)
@@ -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,