GNOME Bugzilla – Bug 327734
Impossible to delete several items in one time
Last modified: 2008-09-03 15:41:13 UTC
All is in title. it's impossible to select all items and to choose "Stop" button.
it's not all items but several all least. :)
It's impossible to _select_ them, it might be possible to delete them however. Maybe there's a reason for this (like not being possible to stop more than one element at a time :P).
Created attachment 100500 [details] [review] Enables multiple selection. This patch enables multiple selection and canceling multiple downloads, I'm not sure about what to do with pause/resume...
I would make it possible also for pause/resume to use multiple selection...Is there a reason you are unsure about it?
I'm not sure what to set the label to... if I select 2paused and 1runnning, what should the label say? What should the label do?
+ for (; downloads; downloads = downloads->next) + { + if (!downloads->data) continue; + ephy_download_cancel ((EphyDownload*)downloads->data); + downloader_view_remove_download (dv, downloads->data); + } + + g_list_foreach (selected, (GFunc) gtk_tree_path_free, NULL); + g_list_free (selected); + g_list_free (downloads); This leaks the downloads list (except for the last node).
Created attachment 100571 [details] [review] Updated, without leaks I'm using the good ole l = list method. A quick explanation of how that works did the trick. Any opinion on the resume/pause thing?
Christian ?
+ gtk_tree_model_get_value (model, &iter, COL_DOWNLOAD_OBJECT, &val); I'd just use gtk_tree_model_get() here, not get_value. + downloads = g_list_append (downloads, g_value_get_object (&val)); g_list_prepend please. + /* We have to kill the downloads separately (not in the previous for) + * because if we did, the TreePaths would be -for example- '1' when the + * first and only iter is '0' (because we removed the previous 0, the old + * 1 is now 0). + */ I'd remove that 'for example' part and only say that it'd change the selection.
Created attachment 101489 [details] [review] bgo_327734_download-selections_20071223 Makes the comment shorter and uses gtk_tree_model_get instead of gtk_tree_model_get_value.
Wrong patch attached? It's still using get_value.
Created attachment 101512 [details] [review] bgo_327734_download-selections: uses gtk_tree_model_get This is the correct one hopefully.
+ for (l = downloads; l; l = l->next) + { + if (!l->data) continue; + ephy_download_cancel ((EphyDownload*) l->data); + downloader_view_remove_download (dv, l->data); + } I think you need to g_object_unref (l->data) too. With that fixed & tested, oktc. Thanks!
Ok I tried with unref and everything is still fine. I committed it: ------------------------------------------------------------------------ r7812 | diegoe | 2007-12-23 20:29:11 -0500 (Sun, 23 Dec 2007) | 6 lines Enable multiple selection in download dialog, now you can cancel more than one download at a time. Note that this has no effect over the Pause button, only over Stop. Bug #327734. Should we still think about the case for Pause button or shall we just close this as fixed?.
Speaking from the top of my head: I think it would be OK to close this if the Pause button simply pauses/resumes _all_ downloads. However I don't think it is OK if the Pause button pauses/resumes a single selected download whereas the Stop button applies to multiple selected downloads.
Right now: on single selection: - both buttons work on the selected download as always on multiple selection: - stop works on all the selected downloads - pause button is insensitive my doubt is if I should botter thinking about what to do with pause instead of insensitivizing it, should I care?