]> spindle.queued.net Git - midori/commitdiff
Implement opening of downloaded files
authorChristian Dywan <christian@twotoasts.de>
Fri, 20 Mar 2009 23:08:22 +0000 (00:08 +0100)
committerChristian Dywan <christian@twotoasts.de>
Fri, 20 Mar 2009 23:08:22 +0000 (00:08 +0100)
midori/midori-browser.c

index ffe4b3fb2813d541060807d2ca47c9bdde28d3e1..a92278ddff69b6a52f71f4d056fee946ee72a817 100644 (file)
@@ -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;
     }