After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720941 - A few fixes for the download bar
A few fixes for the download bar
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: Interface
unspecified
Other All
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
polish
: 720895 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-12-22 17:47 UTC by William Jon McCann
Modified: 2014-01-13 23:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Refactor download widget to split create and populate (10.00 KB, patch)
2013-12-22 17:47 UTC, William Jon McCann
reviewed Details | Review
Improve the display of remaining time (1.32 KB, patch)
2013-12-22 17:48 UTC, William Jon McCann
reviewed Details | Review
Separate the icon from the label in the download item (810 bytes, patch)
2013-12-22 17:48 UTC, William Jon McCann
committed Details | Review
Make download label smaller (1.48 KB, patch)
2013-12-22 17:48 UTC, William Jon McCann
committed Details | Review
Fix download bar close button (1.35 KB, patch)
2013-12-22 17:48 UTC, William Jon McCann
committed Details | Review
Use a menu button for the download item (5.63 KB, patch)
2013-12-22 17:48 UTC, William Jon McCann
committed Details | Review
Refactor download widget to split create and populate (9.79 KB, patch)
2014-01-08 02:24 UTC, William Jon McCann
committed Details | Review
Improve the display of remaining time (2.90 KB, patch)
2014-01-08 02:24 UTC, William Jon McCann
committed Details | Review
screenshot (before) (159.38 KB, image/png)
2014-01-08 02:26 UTC, William Jon McCann
  Details
screenshot (after) (146.34 KB, image/png)
2014-01-08 02:26 UTC, William Jon McCann
  Details

Description William Jon McCann 2013-12-22 17:47:55 UTC
Here are a few fixes for the download bar.
Comment 1 William Jon McCann 2013-12-22 17:47:57 UTC
Created attachment 264762 [details] [review]
Refactor download widget to split create and populate
Comment 2 William Jon McCann 2013-12-22 17:48:00 UTC
Created attachment 264763 [details] [review]
Improve the display of remaining time
Comment 3 William Jon McCann 2013-12-22 17:48:03 UTC
Created attachment 264764 [details] [review]
Separate the icon from the label in the download item
Comment 4 William Jon McCann 2013-12-22 17:48:06 UTC
Created attachment 264765 [details] [review]
Make download label smaller
Comment 5 William Jon McCann 2013-12-22 17:48:10 UTC
Created attachment 264766 [details] [review]
Fix download bar close button
Comment 6 William Jon McCann 2013-12-22 17:48:14 UTC
Created attachment 264767 [details] [review]
Use a menu button for the download item
Comment 7 Bastien Nocera 2014-01-07 13:50:55 UTC
Review of attachment 264762 [details] [review]:

Rest looks fine.

::: lib/widgets/ephy-download-widget.c
@@ +404,3 @@
+    return;
+
+  if (widget->priv->download != NULL) {

You don't need to do this, the download property is construct-only.

I'd either remove the construct-only from the property definition, or do this in the same patch that would remove the construct-only flag.

@@ +593,3 @@
 }
 
+

Whitespace change.
Comment 8 Bastien Nocera 2014-01-07 13:54:15 UTC
Review of attachment 264763 [details] [review]:

::: lib/widgets/ephy-download-widget.c
@@ +109,2 @@
    if (hours > 0) {
+     return g_strdup_printf (ngettext ("%u hour left", "%u hours left", hours), hours);

I don't think this is good enough. You'd probably want to round the hours (eg. 2 hours 45 minutes left should read "more than 2 hours left" or "3 hours left".

@@ +111,3 @@
    } else {
      if (mins > 0)
+       return g_strdup_printf (ngettext ("%u minute left", "%u minutes left", mins), mins);

Ditto.

I think splitting up this code into a cut'n'paste lib would also be useful to share with other programs that can deal with downloads (say, Totem if we implement offline viewing).
Comment 9 Bastien Nocera 2014-01-07 13:55:43 UTC
Review of attachment 264764 [details] [review]:

Looks fine.
Comment 10 Bastien Nocera 2014-01-07 13:56:59 UTC
Review of attachment 264765 [details] [review]:

Looks fine. Would be good to have screenshots to compare before and after all those changes.
Comment 11 Bastien Nocera 2014-01-07 13:59:07 UTC
Review of attachment 264766 [details] [review]:

Looks fine otherwise.

::: src/ephy-window.c
@@ +2939,3 @@
 	gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
 
+	image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);

Maybe use g_object_new() to do all this in one go?
Comment 12 Bastien Nocera 2014-01-07 14:03:19 UTC
Review of attachment 264767 [details] [review]:

::: lib/widgets/ephy-download-widget.c
@@ +189,2 @@
   download = ephy_download_get_webkit_download (widget->priv->download);
+  dest = webkit_download_get_destination (download);

In which cases would that happen? Is it possible for widget->priv->download to be NULL as well?

@@ +309,2 @@
   download = ephy_download_get_webkit_download (widget->priv->download);
+  dest = webkit_download_get_destination (download);

Ditto.

@@ +537,3 @@
   button = totem_glow_button_new ();
+  menu_button = gtk_menu_button_new ();
+  gtk_menu_button_set_direction (GTK_MENU_BUTTON (menu_button), GTK_ARROW_UP);

Why up, rather than down? Even if the popup will usually be above the button (if the browser is fullscreen, there wouldn't be space to show it below).
Comment 13 William Jon McCann 2014-01-08 01:44:20 UTC
Review of attachment 264762 [details] [review]:

::: lib/widgets/ephy-download-widget.c
@@ +404,3 @@
+    return;
+
+  if (widget->priv->download != NULL) {

I really don't like functions to make assumptions about how they are called, or have to look at other parts of the code to read the function correctly, and it is too easy to change one part of the code and have unintended consequences.
Comment 14 William Jon McCann 2014-01-08 01:57:47 UTC
Review of attachment 264763 [details] [review]:

::: lib/widgets/ephy-download-widget.c
@@ +111,3 @@
    } else {
      if (mins > 0)
+       return g_strdup_printf (ngettext ("%u minute left", "%u minutes left", mins), mins);

https://git.gnome.org/browse/telepathy-account-widgets/tree/tp-account-widgets/tpaw-time.c#n82
Comment 15 William Jon McCann 2014-01-08 02:14:38 UTC
Review of attachment 264767 [details] [review]:

::: lib/widgets/ephy-download-widget.c
@@ +189,2 @@
   download = ephy_download_get_webkit_download (widget->priv->download);
+  dest = webkit_download_get_destination (download);

I think it is null before the destination file is selected or something. NULL is a valid result. As suggested by the docs and the webkit tests. And it happens in practice.

It is not possible for download to be null here because this function is only used while the download in in progress.
Comment 16 William Jon McCann 2014-01-08 02:24:37 UTC
Created attachment 265625 [details] [review]
Refactor download widget to split create and populate
Comment 17 William Jon McCann 2014-01-08 02:24:40 UTC
Created attachment 265626 [details] [review]
Improve the display of remaining time
Comment 18 William Jon McCann 2014-01-08 02:26:36 UTC
Created attachment 265628 [details]
screenshot (before)
Comment 19 William Jon McCann 2014-01-08 02:26:58 UTC
Created attachment 265629 [details]
screenshot (after)
Comment 20 Claudio Saavedra 2014-01-08 14:08:13 UTC
Review of attachment 264764 [details] [review]:

OK
Comment 21 Claudio Saavedra 2014-01-08 14:08:43 UTC
Review of attachment 264765 [details] [review]:

OK
Comment 22 Claudio Saavedra 2014-01-08 14:09:56 UTC
Review of attachment 264766 [details] [review]:

::: src/ephy-window.c
@@ +2939,3 @@
 	gtk_button_set_relief (GTK_BUTTON (close_button), GTK_RELIEF_NONE);
 
+	image = gtk_image_new_from_icon_name ("window-close-symbolic", GTK_ICON_SIZE_MENU);

Yes, you could do this if you want.
Comment 23 William Jon McCann 2014-01-08 14:47:47 UTC
Attachment 264764 [details] pushed as 6b7999b - Separate the icon from the label in the download item
Attachment 264765 [details] pushed as a2cb59a - Make download label smaller
Attachment 264766 [details] pushed as e0bf405 - Fix download bar close button
Attachment 264767 [details] pushed as f24d612 - Use a menu button for the download item
Attachment 265625 [details] pushed as b390094 - Refactor download widget to split create and populate
Attachment 265626 [details] pushed as 08aa34f - Improve the display of remaining time
Comment 24 William Jon McCann 2014-01-13 23:11:55 UTC
*** Bug 720895 has been marked as a duplicate of this bug. ***