Provide a Clear button for cancelled downloads

This commit is contained in:
Christian Dywan 2009-03-21 20:08:37 +01:00
parent 863f2db611
commit e5d1f36561

View file

@ -909,21 +909,20 @@ midori_browser_download_notify_status_cb (WebKitDownload* download,
GParamSpec* pspec, GParamSpec* pspec,
GtkWidget* button) GtkWidget* button)
{ {
GtkWidget* icon;
switch (webkit_download_get_status (download)) switch (webkit_download_get_status (download))
{ {
case WEBKIT_DOWNLOAD_STATUS_FINISHED: case WEBKIT_DOWNLOAD_STATUS_FINISHED:
{
GtkWidget* icon;
icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU); icon = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), icon); gtk_button_set_image (GTK_BUTTON (button), icon);
if (g_object_get_data (G_OBJECT (download), "open-download")) if (g_object_get_data (G_OBJECT (download), "open-download"))
gtk_button_clicked (GTK_BUTTON (button)); gtk_button_clicked (GTK_BUTTON (button));
break; break;
}
case WEBKIT_DOWNLOAD_STATUS_CANCELLED: case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
case WEBKIT_DOWNLOAD_STATUS_ERROR: case WEBKIT_DOWNLOAD_STATUS_ERROR:
gtk_widget_set_sensitive (button, FALSE); icon = gtk_image_new_from_stock (GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU);
gtk_button_set_image (GTK_BUTTON (button), icon);
break; break;
default: default:
break; break;
@ -954,6 +953,8 @@ midori_browser_download_button_clicked_cb (GtkWidget* button,
gtk_widget_destroy (gtk_widget_get_parent (button)); gtk_widget_destroy (gtk_widget_get_parent (button));
break; break;
} }
case WEBKIT_DOWNLOAD_STATUS_CANCELLED:
gtk_widget_destroy (gtk_widget_get_parent (button));
default: default:
break; break;
} }