]> spindle.queued.net Git - midori/commitdiff
Don't always show the "Pending downloads" dialog.
authorJérôme Guelfucci <jeromeg@xfce.org>
Mon, 28 Jun 2010 17:41:13 +0000 (19:41 +0200)
committerChristian Dywan <christian@twotoasts.de>
Tue, 29 Jun 2010 05:20:26 +0000 (07:20 +0200)
If all donwloads are finished, cancelled or errored, the dialog should
not be shown.

toolbars/midori-transferbar.c

index 3309e892e1a83b788fd051ef52201a5603eeac87..f0fb0304b634683fc7abb1f4abc73e60403d1ae9 100644 (file)
@@ -267,9 +267,29 @@ gboolean
 midori_transferbar_confirm_delete (MidoriTransferbar* transferbar)
 {
     GtkWidget* dialog = NULL;
+    GList* list;
     gboolean cancel = FALSE;
+    gboolean all_done = TRUE;
+
+    #if WEBKIT_CHECK_VERSION (1, 1, 3)
+    for (list = transferbar->infos; list != NULL; list = g_list_next (list))
+    {
+        TransferInfo* info = list->data;
+        WebKitDownloadStatus status = webkit_download_get_status (info->download);
+
+        if (status != WEBKIT_DOWNLOAD_STATUS_FINISHED
+         && status != WEBKIT_DOWNLOAD_STATUS_CANCELLED
+         && status != WEBKIT_DOWNLOAD_STATUS_ERROR)
+        {
+            all_done = FALSE;
+            break;
+        }
+    }
 
+    if (!all_done)
+    #else
     if (transferbar->infos || g_list_nth_data (transferbar->infos, 0))
+    #endif
     {
         GtkWidget* widget = gtk_widget_get_toplevel (GTK_WIDGET (transferbar));
         dialog = gtk_message_dialog_new (GTK_WINDOW (widget),