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)
committerpaul <paul@claws-mail.org>
Sat, 11 Jul 2020 08:52:45 +0000 (09:52 +0100)
Workaround for bug 3922

src/plugins/notification/notification_plugin.c

index c0e9b4f8e853701de544457f55a66cbf691d3a41..6fad9c50c38bf39c6a5628e0b9dbe52ff855e407 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);