From ce48fc9d0d8e603e69f01e58f3a717fc845888f7 Mon Sep 17 00:00:00 2001 From: Christian Meissl Date: Tue, 19 Nov 2024 23:07:52 +0100 Subject: [PATCH] fix(tray): prevent widget buttons from piling up (#788) each call to set_menu_widget registered a new event handler, resulting in multiple popups to be created. each popup tried to issue a grab with the same serial. prevent this by disconnecting any previously registered handler. --- src/modules/tray/interface.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/modules/tray/interface.rs b/src/modules/tray/interface.rs index 9eed83a8..207cd10e 100644 --- a/src/modules/tray/interface.rs +++ b/src/modules/tray/interface.rs @@ -1,4 +1,4 @@ -use glib::Propagation; +use glib::{Propagation, SignalHandlerId}; use gtk::gdk::Gravity; use gtk::prelude::*; use gtk::{EventBox, Image, Label, MenuItem}; @@ -7,6 +7,7 @@ use system_tray::item::{IconPixmap, StatusNotifierItem, Tooltip}; /// Main tray icon to show on the bar pub(crate) struct TrayMenu { pub event_box: EventBox, + button_handler: Option, widget: MenuItem, image_widget: Option, label_widget: Option