Notification plugin: Add timeout to hide-on-startup until main win is shown again
authorHolger Berndt <hb@claws-mail.org>
Wed, 24 Jun 2020 16:30:27 +0000 (18:30 +0200)
committerHolger Berndt <hb@claws-mail.org>
Wed, 24 Jun 2020 16:30:27 +0000 (18:30 +0200)
Workaround for bug 3922

src/plugins/notification/notification_plugin.c

index 18671d6e4b47d182df51ad572f7aa8a95ee50321..90b83a172193f797317c74b98a08b4460f2e3099 100644 (file)
 #  include <libnotify/notify.h>
 #endif
 
+/* delay in ms until the tray icon shall be embedded in the
+   system tray before it is assumed that the tray doesn't
+   work and the main window is shown again */
+#define CM_NOTIFICATION_TRAYICON_SAFETY_NET_DELAY_MS 5000
 
 static gboolean my_folder_item_update_hook(gpointer, gpointer);
 static gboolean my_folder_update_hook(gpointer, gpointer);
@@ -342,7 +346,7 @@ gint plugin_init(gchar **error)
                 notify_config.trayicon_hide_at_startup && claws_is_starting()) {
     MainWindow *mainwin = mainwindow_get_mainwindow();
 
-               g_idle_add(trayicon_startup_idle,NULL);
+               g_timeout_add(CM_NOTIFICATION_TRAYICON_SAFETY_NET_DELAY_MS, trayicon_startup_idle,NULL);
     if(mainwin && gtk_widget_get_visible(GTK_WIDGET(mainwin->window)))
       main_window_hide(mainwin);
     main_set_show_at_startup(FALSE);