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 689351 - [regression] Drag'n'drop doesn't work anymore
[regression] Drag'n'drop doesn't work anymore
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Background
3.6.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
3.10
: 707001 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-30 14:45 UTC by Bastien Nocera
Modified: 2014-11-11 14:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
implement dnd (4.52 KB, patch)
2012-12-04 04:45 UTC, Matthias Clasen
needs-work Details | Review
background: Re-add drag'n'drop support (4.34 KB, patch)
2014-04-14 15:25 UTC, Bastien Nocera
reviewed Details | Review
background: Allow dropping colours as well (10.42 KB, patch)
2014-04-14 15:25 UTC, Bastien Nocera
needs-work Details | Review
background: Remember added colours (3.79 KB, patch)
2014-04-14 15:25 UTC, Bastien Nocera
none Details | Review
background: Copy all the manually added backgrounds (2.91 KB, patch)
2014-04-14 15:25 UTC, Bastien Nocera
none Details | Review
background: Prevent monitor_pictures_model() running multiple times (990 bytes, patch)
2014-07-18 09:35 UTC, Bastien Nocera
committed Details | Review
background: Re-add drag'n'drop support (11.26 KB, patch)
2014-07-18 09:35 UTC, Bastien Nocera
committed Details | Review
background: Allow dropping colours as well (11.35 KB, patch)
2014-07-18 09:35 UTC, Bastien Nocera
committed Details | Review
background: Remember added colours (3.62 KB, patch)
2014-07-18 09:35 UTC, Bastien Nocera
committed Details | Review
background: Copy all the manually added backgrounds (2.97 KB, patch)
2014-07-18 09:35 UTC, Bastien Nocera
needs-work Details | Review
background: Copy all the manually added backgrounds (3.04 KB, patch)
2014-07-18 11:02 UTC, Bastien Nocera
none Details | Review
background: Split up creation of loading icon (3.84 KB, patch)
2014-07-18 11:02 UTC, Bastien Nocera
committed Details | Review
background: Make placeholder the same size as thumbnails (2.05 KB, patch)
2014-07-18 11:02 UTC, Bastien Nocera
committed Details | Review
background: Copy all the manually added backgrounds (3.39 KB, patch)
2014-07-18 11:58 UTC, Bastien Nocera
none Details | Review
background: Copy all the manually added backgrounds (5.71 KB, patch)
2014-07-18 15:34 UTC, Bastien Nocera
committed Details | Review
background: Create a placeholder for manually added items (1018 bytes, patch)
2014-07-18 15:34 UTC, Bastien Nocera
committed Details | Review
background: Fix crash when adding the second color (1.12 KB, patch)
2014-11-04 17:05 UTC, Debarshi Ray
none Details | Review
background: Fix crash when adding the second color (1.12 KB, patch)
2014-11-04 17:22 UTC, Debarshi Ray
committed Details | Review

Description Bastien Nocera 2012-11-30 14:45:31 UTC
We use to support dnd'ing pictures on the icon views, we should do that again.
Comment 1 Matthias Clasen 2012-11-30 15:50:54 UTC
If we go for easter eggs, we can also allow dropping colors into the color tab.
Comment 2 Matthias Clasen 2012-12-04 04:45:44 UTC
Created attachment 230619 [details] [review]
implement dnd
Comment 3 Bastien Nocera 2012-12-06 16:27:37 UTC
Review of attachment 230619 [details] [review]:

The old code copied the URIs to the local disk before setting it (which meant dnd'ing from a web browser worked).

Probably just need to revive the old code. Good idea about the colors though.
Comment 4 William Jon McCann 2013-01-08 19:21:52 UTC
We should make sure it works exactly like the code used to add wallpapers in Nautilus.
Comment 5 Bastien Nocera 2013-09-05 17:38:12 UTC
*** Bug 707001 has been marked as a duplicate of this bug. ***
Comment 6 joachim.backes 2013-12-10 05:31:09 UTC
(In reply to comment #4)
> We should make sure it works exactly like the code used to add wallpapers in
> Nautilus.

I have a similar issue:

I want to define additional plain colors in gnome3/Fedora20 for usage as
desktop background, but I do not find a way to do that (only 15
colors available). No GUI for that :-(
Comment 7 Bastien Nocera 2014-04-14 15:25:28 UTC
Created attachment 274280 [details] [review]
background: Re-add drag'n'drop support

Inside the chooser dialogue itself.
Comment 8 Bastien Nocera 2014-04-14 15:25:34 UTC
Created attachment 274281 [details] [review]
background: Allow dropping colours as well
Comment 9 Bastien Nocera 2014-04-14 15:25:41 UTC
Created attachment 274282 [details] [review]
background: Remember added colours
Comment 10 Bastien Nocera 2014-04-14 15:25:46 UTC
Created attachment 274283 [details] [review]
background: Copy all the manually added backgrounds

Except the ones already in the Pictures directory.
Comment 11 Bastien Nocera 2014-04-14 15:30:16 UTC
Still need to add support for dnd in the main panel, rather than in the chooser dialog alone.
Comment 12 Debarshi Ray 2014-04-14 16:58:12 UTC
Review of attachment 274280 [details] [review]:

::: panels/background/cc-background-chooser-dialog.c
@@ +279,3 @@
+  store = bg_source_get_liststore (BG_SOURCE (chooser->priv->pictures_source));
+  g_signal_connect (G_OBJECT (store), "row-inserted",
+                    G_CALLBACK (row_inserted), chooser);

Can we use a different name for the callback instead of 'row_inserted'? There is a priv->row_inserted_id which is used to track a callback that listens for the same signal on the same object, but for a different purpose. It can get confusing.

Can we tag the callback in some way so that we know that our callback was invoked as a result of a drag-n-dropped image being added and not something else? See the other signal connection mentioned above, which tracks if the model is empty or not. We don't want this to be invoked if someone just dropped a few file into a directory or something similarly unrelated.

@@ +281,3 @@
+                    G_CALLBACK (row_inserted), chooser);
+
+  if (bg_pictures_source_add (chooser->priv->pictures_source, uri) == FALSE)

I wonder how useful the return value of bg_pictures_source_add is. Currently it is atleast better than nothing, but if you consider that it does a synchronous g_file_query_info call, then things become a messy if you want to enforce 'async-correctness'. Maybe we could just treat it as a fire and forget operation in future?
Comment 13 Debarshi Ray 2014-04-14 17:32:54 UTC
Review of attachment 274281 [details] [review]:

::: panels/background/cc-background-chooser-dialog.c
@@ +302,3 @@
+  /* And select the newly added item */
+  gtk_icon_view_select_path (GTK_ICON_VIEW (chooser->priv->icon_view), path);
+}

color_row_inserted is identical to row_inserted. Maybe we could somehow parametrize this? What about a function that does the main work and it takes the button, source and callback as arguments?

@@ +355,3 @@
+  if (bg_colors_source_add (chooser->priv->colors_source, &rgba) == FALSE)
+    {
+      g_signal_handlers_disconnect_by_func (G_OBJECT (store), G_CALLBACK (row_inserted), chooser);

Typo alert: it should be color_row_inserted, not row_inserted.
Comment 14 Bastien Nocera 2014-07-18 09:35:04 UTC
Created attachment 281062 [details] [review]
background: Prevent monitor_pictures_model() running multiple times
Comment 15 Bastien Nocera 2014-07-18 09:35:11 UTC
Created attachment 281063 [details] [review]
background: Re-add drag'n'drop support

Inside the chooser dialogue itself.
Comment 16 Bastien Nocera 2014-07-18 09:35:18 UTC
Created attachment 281064 [details] [review]
background: Allow dropping colours as well
Comment 17 Bastien Nocera 2014-07-18 09:35:25 UTC
Created attachment 281065 [details] [review]
background: Remember added colours
Comment 18 Bastien Nocera 2014-07-18 09:35:32 UTC
Created attachment 281066 [details] [review]
background: Copy all the manually added backgrounds

Except the ones already in the Pictures directory.
Comment 19 Bastien Nocera 2014-07-18 10:04:18 UTC
Comment on attachment 281066 [details] [review]
background: Copy all the manually added backgrounds

That's broken...
Comment 20 Bastien Nocera 2014-07-18 11:02:09 UTC
Created attachment 281079 [details] [review]
background: Copy all the manually added backgrounds

Except the ones already in the Pictures directory.
Comment 21 Bastien Nocera 2014-07-18 11:02:16 UTC
Created attachment 281080 [details] [review]
background: Split up creation of loading icon
Comment 22 Bastien Nocera 2014-07-18 11:02:22 UTC
Created attachment 281081 [details] [review]
background: Make placeholder the same size as thumbnails

Otherwise they look tiny and compacted.
Comment 23 Bastien Nocera 2014-07-18 11:58:39 UTC
Created attachment 281087 [details] [review]
background: Copy all the manually added backgrounds

Except the ones already in the Pictures directory.
Comment 24 Bastien Nocera 2014-07-18 15:34:10 UTC
Created attachment 281106 [details] [review]
background: Copy all the manually added backgrounds

Except the ones already in the Pictures directory
Comment 25 Bastien Nocera 2014-07-18 15:34:16 UTC
Created attachment 281107 [details] [review]
background: Create a placeholder for manually added items

When adding things that might be screenshots, always create a
placeholder if the image was added manually.
Comment 26 Bastien Nocera 2014-07-18 16:29:18 UTC
Attachment 281062 [details] pushed as e1fab88 - background: Prevent monitor_pictures_model() running multiple times
Attachment 281063 [details] pushed as ccf7dc7 - background: Re-add drag'n'drop support
Attachment 281064 [details] pushed as 8115ba4 - background: Allow dropping colours as well
Attachment 281065 [details] pushed as ebbda7a - background: Remember added colours
Attachment 281080 [details] pushed as c3fc128 - background: Split up creation of loading icon
Attachment 281081 [details] pushed as cf26e6c - background: Make placeholder the same size as thumbnails
Attachment 281106 [details] pushed as 41be6ee - background: Copy all the manually added backgrounds
Attachment 281107 [details] pushed as 65d4ba1 - background: Create a placeholder for manually added items
Comment 27 Debarshi Ray 2014-11-04 16:52:49 UTC
Review of attachment 281065 [details] [review]:

::: panels/background/bg-colors-source.c
@@ +209,3 @@
+    colors = g_key_file_get_string_list (keyfile, "Colors", "custom-colors", &len, NULL);
+
+  if (len == 0 && colors != NULL)

Is this needed? Won't colors be NULL if len is 0 or are there are some cases in which g_key_file_get_string_list can cause this?

@@ +223,3 @@
+  else
+    {
+      colors[len] = c;

Due to this colors will not be a NULL terminated string array anymore, which will lead to a crash in the g_strfreev later in the file.
Comment 28 Debarshi Ray 2014-11-04 17:05:48 UTC
Created attachment 289983 [details] [review]
background: Fix crash when adding the second color
Comment 29 Debarshi Ray 2014-11-04 17:22:41 UTC
Created attachment 289984 [details] [review]
background: Fix crash when adding the second color

Fix an off-by-one error in the previous version of the patch.
Comment 30 Rui Matos 2014-11-11 14:13:36 UTC
Review of attachment 289984 [details] [review]:

Looks fine
Comment 31 Debarshi Ray 2014-11-11 14:17:39 UTC
Comment on attachment 289984 [details] [review]
background: Fix crash when adding the second color

Thanks for the review!