Use destination filename in the transferbar
This commit is contained in:
parent
54a2272b7a
commit
60bcbcf470
1 changed files with 12 additions and 3 deletions
|
@ -1183,6 +1183,7 @@ midori_browser_add_download_item (MidoriBrowser* browser,
|
||||||
GtkWidget* icon;
|
GtkWidget* icon;
|
||||||
GtkWidget* button;
|
GtkWidget* button;
|
||||||
GtkWidget* progress;
|
GtkWidget* progress;
|
||||||
|
const gchar* uri;
|
||||||
gint width;
|
gint width;
|
||||||
|
|
||||||
box = gtk_hbox_new (FALSE, 0);
|
box = gtk_hbox_new (FALSE, 0);
|
||||||
|
@ -1191,6 +1192,14 @@ midori_browser_add_download_item (MidoriBrowser* browser,
|
||||||
progress = gtk_progress_bar_new ();
|
progress = gtk_progress_bar_new ();
|
||||||
gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (progress),
|
gtk_progress_bar_set_ellipsize (GTK_PROGRESS_BAR (progress),
|
||||||
PANGO_ELLIPSIZE_MIDDLE);
|
PANGO_ELLIPSIZE_MIDDLE);
|
||||||
|
if ((uri = webkit_download_get_destination_uri (download)))
|
||||||
|
{
|
||||||
|
gchar* path = soup_uri_decode (uri);
|
||||||
|
gchar* filename = g_strrstr (path, "/") + 1;
|
||||||
|
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress), filename);
|
||||||
|
g_free (path);
|
||||||
|
}
|
||||||
|
else
|
||||||
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress),
|
gtk_progress_bar_set_text (GTK_PROGRESS_BAR (progress),
|
||||||
webkit_download_get_suggested_filename (download));
|
webkit_download_get_suggested_filename (download));
|
||||||
sokoke_widget_get_text_size (progress, "M", &width, NULL);
|
sokoke_widget_get_text_size (progress, "M", &width, NULL);
|
||||||
|
@ -1227,8 +1236,8 @@ midori_view_download_save_as_response_cb (GtkWidget* dialog,
|
||||||
{
|
{
|
||||||
gchar* uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
|
gchar* uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
|
||||||
MidoriBrowser* browser = midori_browser_get_for_widget (dialog);
|
MidoriBrowser* browser = midori_browser_get_for_widget (dialog);
|
||||||
midori_browser_add_download_item (browser, download);
|
|
||||||
webkit_download_set_destination_uri (download, uri);
|
webkit_download_set_destination_uri (download, uri);
|
||||||
|
midori_browser_add_download_item (browser, download);
|
||||||
g_free (uri);
|
g_free (uri);
|
||||||
webkit_download_start (download);
|
webkit_download_start (download);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue