From feed868ec22aa184f3659b14ec2ef8c82d473cf3 Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Sat, 21 Mar 2009 00:08:22 +0100 Subject: [PATCH] Implement opening of downloaded files --- midori/midori-browser.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/midori/midori-browser.c b/midori/midori-browser.c index ffe4b3fb..a92278dd 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -916,8 +916,6 @@ midori_browser_download_notify_status_cb (WebKitDownload* download, GtkWidget* icon; icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); gtk_button_set_image (GTK_BUTTON (button), icon); - /* FIXME: Implement opening of files */ - gtk_widget_set_sensitive (button, FALSE); break; } case WEBKIT_DOWNLOAD_STATUS_CANCELLED: @@ -938,6 +936,18 @@ midori_browser_download_button_clicked_cb (GtkWidget* button, case WEBKIT_DOWNLOAD_STATUS_STARTED: webkit_download_cancel (download); break; + case WEBKIT_DOWNLOAD_STATUS_FINISHED: + { + const gchar* uri = webkit_download_get_destination_uri (download); + if (!gtk_show_uri (gtk_widget_get_screen (button), + uri, gtk_get_current_event_time (), NULL)) + { + gchar* command = g_strconcat ("exo-open ", uri, NULL); + g_spawn_command_line_async (command, NULL); + g_free (command); + } + break; + } default: break; }