[Xfce4-commits] <midori:master> Register successfully downloaded files as recent

Christian Dywan noreply at xfce.org
Wed Oct 5 10:04:01 CEST 2011


Updating branch refs/heads/master
         to f303736ad0e7bc0c44c307127dfbb08ee1a4c109 (commit)
       from 441191b4a1d8ab11dd6defc8e2fa9c7e7e7b117c (commit)

commit f303736ad0e7bc0c44c307127dfbb08ee1a4c109
Author: Christian Dywan <christian at twotoasts.de>
Date:   Wed Oct 5 09:59:02 2011 +0200

    Register successfully downloaded files as recent
    
    So they show up in Recent menus and modern dash boards.

 toolbars/midori-transferbar.c |   23 +++++++++--------------
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/toolbars/midori-transferbar.c b/toolbars/midori-transferbar.c
index 8e715af..4c35388 100644
--- a/toolbars/midori-transferbar.c
+++ b/toolbars/midori-transferbar.c
@@ -76,19 +76,9 @@ midori_transferbar_download_notify_progress_cb (WebKitDownload* download,
 {
     gchar* tooltip;
     gchar* text;
-    guint64 size;
 
     gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
         webkit_download_get_progress (download));
-    size = webkit_download_get_current_size (download);
-
-    if (size == webkit_download_get_total_size (download))
-    {
-        gtk_widget_set_tooltip_text (progress,
-            gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)));
-        return;
-    }
-
     tooltip = midori_download_prepare_tooltip_text (download);
     text = g_strdup_printf ("%s\n%s",
         gtk_progress_bar_get_text (GTK_PROGRESS_BAR (progress)), tooltip);
@@ -114,6 +104,7 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
             WebKitNetworkRequest* request;
             const gchar* original_uri;
             gchar** fingerprint;
+            gboolean verified = TRUE;
 
             icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
             gtk_button_set_image (GTK_BUTTON (button), icon);
@@ -152,8 +143,7 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
                 g_free (contents);
                 /* Checksums are case-insensitive */
                 if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
-                    gtk_image_set_from_stock (GTK_IMAGE (icon),
-                        GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
+                    verified = FALSE;
                 g_free (checksum);
             }
             else
@@ -172,13 +162,18 @@ midori_transferbar_download_notify_status_cb (WebKitDownload* download,
                     g_free (contents);
                     /* Checksums are case-insensitive */
                     if (!y || g_ascii_strcasecmp (fingerprint[1], checksum) != 0)
-                        gtk_image_set_from_stock (GTK_IMAGE (icon),
-                            GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
+                        verified = FALSE;
                     g_free (checksum);
                 }
                 g_free (filename);
             }
             g_strfreev (fingerprint);
+            if (verified)
+                gtk_recent_manager_add_item (gtk_recent_manager_get_default (),
+                    webkit_download_get_destination_uri (download));
+            else
+                gtk_image_set_from_stock (GTK_IMAGE (icon),
+                    GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
             break;
         }
         case WEBKIT_DOWNLOAD_STATUS_CANCELLED:


More information about the Xfce4-commits mailing list