From 907211a73352daeb9ef22c95b4ab363b7aa85d56 Mon Sep 17 00:00:00 2001 From: deepend Date: Fri, 30 Jan 2026 19:33:56 -0700 Subject: [PATCH] Unified tray tooltip handling so GTK3 uses the tooltip-text property while GTK2 keeps the legacy API behind guards, and wired fe_tray_set_tooltip to the shared helper. Centralized embedded-state checks through a GTK3-safe helper in the tray notification callback, avoiding GTK2-only calls under GTK3. --- src/fe-gtk/plugin-tray.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c index 33702284..88fc11f3 100644 --- a/src/fe-gtk/plugin-tray.c +++ b/src/fe-gtk/plugin-tray.c @@ -188,16 +188,21 @@ tray_set_custom_icon_state (TrayCustomIcon icon, TrayIconState state) tray_icon_state = state; } -#if HAVE_GTK3 static void tray_set_tooltip_text (GtkStatusIcon *icon, const char *text) { +#if HAVE_GTK3 g_object_set (G_OBJECT (icon), "tooltip-text", text, NULL); +#endif +#if !HAVE_GTK3 + gtk_status_icon_set_tooltip_text (icon, text); +#endif } static gboolean tray_is_embedded (GtkStatusIcon *icon) { +#if HAVE_GTK3 GObjectClass *klass; gboolean embedded = TRUE; @@ -209,19 +214,17 @@ tray_is_embedded (GtkStatusIcon *icon) g_object_get (G_OBJECT (icon), "embedded", &embedded, NULL); return embedded; -} #endif +#if !HAVE_GTK3 + return gtk_status_icon_is_embedded (icon); +#endif +} void fe_tray_set_tooltip (const char *text) { if (sticon) -#if HAVE_GTK3 tray_set_tooltip_text (sticon, text); -#endif -#if !HAVE_GTK3 - gtk_status_icon_set_tooltip_text (sticon, text); -#endif } static void @@ -461,12 +464,7 @@ tray_menu_notify_cb (GObject *tray, GParamSpec *pspec, gpointer user_data) { if (sticon) { -#if HAVE_GTK3 if (!tray_is_embedded (sticon)) -#endif -#if !HAVE_GTK3 - if (!gtk_status_icon_is_embedded (sticon)) -#endif { tray_restore_timer = g_timeout_add(500, (GSourceFunc)tray_menu_try_restore, NULL); }