Blame SOURCES/rb-3.4.2-bug-fixes.patch

eb09e9
From 36a648db0af05be579190d98c96cfb6b7bcc6ebd Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Mon, 9 Oct 2017 13:11:47 +0200
eb09e9
Subject: [PATCH 01/12] fmradio: Fix build with GStreamer master
eb09e9
eb09e9
The plugin description is not supposed to be a string constant, but an
eb09e9
unescaped string, to be concatenated with function names.
eb09e9
eb09e9
This used to be acceptable (though would have warned), but breaks with
eb09e9
the GStreamer 1.13 development branch.
eb09e9
eb09e9
rb-fm-radio-gst-src.c:181:6: error: pasting ""rbsilencesrc"" and "_get_desc" does not give a valid preprocessing token
eb09e9
      "rbsilencesrc",
eb09e9
      ^
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=788706
eb09e9
---
eb09e9
 plugins/fmradio/rb-fm-radio-gst-src.c | 2 +-
eb09e9
 1 file changed, 1 insertion(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/plugins/fmradio/rb-fm-radio-gst-src.c b/plugins/fmradio/rb-fm-radio-gst-src.c
eb09e9
index 09d709c28..88abdaf35 100644
eb09e9
--- a/plugins/fmradio/rb-fm-radio-gst-src.c
eb09e9
+++ b/plugins/fmradio/rb-fm-radio-gst-src.c
eb09e9
@@ -178,7 +178,7 @@ plugin_init (GstPlugin *plugin)
eb09e9
 
eb09e9
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
eb09e9
 		   GST_VERSION_MINOR,
eb09e9
-		   "rbsilencesrc",
eb09e9
+		   rbsilencesrc,
eb09e9
 		   "element to output silence",
eb09e9
 		   plugin_init,
eb09e9
 		   VERSION,
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 355e3c40efe47f6f90d12afb6590caf85db62487 Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Mon, 24 Apr 2017 16:21:41 +0200
eb09e9
Subject: [PATCH 02/12] mmkeys: media-player-keys: Fix usage to match API
eb09e9
 documentation
eb09e9
eb09e9
See https://bugzilla.gnome.org/show_bug.cgi?id=781326
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=781664
eb09e9
---
eb09e9
 plugins/mmkeys/rb-mmkeys-plugin.c | 2 +-
eb09e9
 1 file changed, 1 insertion(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/plugins/mmkeys/rb-mmkeys-plugin.c b/plugins/mmkeys/rb-mmkeys-plugin.c
eb09e9
index 46431584f..058b82f0e 100644
eb09e9
--- a/plugins/mmkeys/rb-mmkeys-plugin.c
eb09e9
+++ b/plugins/mmkeys/rb-mmkeys-plugin.c
eb09e9
@@ -385,7 +385,7 @@ impl_activate (PeasActivatable *pplugin)
eb09e9
 		plugin->proxy = g_dbus_proxy_new_sync (bus,
eb09e9
 						       G_DBUS_PROXY_FLAGS_NONE,
eb09e9
 						       NULL,
eb09e9
-						       "org.gnome.SettingsDaemon",
eb09e9
+						       "org.gnome.SettingsDaemon.MediaKeys",
eb09e9
 						       "/org/gnome/SettingsDaemon/MediaKeys",
eb09e9
 						       "org.gnome.SettingsDaemon.MediaKeys",
eb09e9
 						       NULL,
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 19d604093667139c6660d9452b4037a761bf75e0 Mon Sep 17 00:00:00 2001
eb09e9
From: gkrithi8 <gkrithi8@gmail.com>
eb09e9
Date: Thu, 26 Oct 2017 02:27:38 +0530
eb09e9
Subject: [PATCH 03/12] brasero-disc-recorder: Fix invalid object reference
eb09e9
 warnings
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=789494
eb09e9
---
eb09e9
 plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c | 2 +-
eb09e9
 1 file changed, 1 insertion(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
eb09e9
index 8608e84fd..a89d87a70 100644
eb09e9
--- a/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
eb09e9
+++ b/plugins/brasero-disc-recorder/rb-disc-recorder-plugin.c
eb09e9
@@ -558,7 +558,7 @@ update_source (RBDiscRecorderPlugin *pi,
eb09e9
 	RBDisplayPage *selected_page;
eb09e9
 	const char *page_type;
eb09e9
 
eb09e9
-	if (pi->selected_page != NULL && RB_IS_SOURCE (pi->selected_page)) {
eb09e9
+	if (pi->selected_page != NULL && RB_IS_PLAYLIST_SOURCE (pi->selected_page)) {
eb09e9
 		RhythmDBQueryModel *model;
eb09e9
 
eb09e9
 		g_object_get (pi->selected_page, "query-model", &model, NULL);
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 00970203e760f9ae43c31087706bd31b2b395dcb Mon Sep 17 00:00:00 2001
eb09e9
From: gkrithi8 <gkrithi8@gmail.com>
eb09e9
Date: Mon, 30 Oct 2017 02:25:09 +0530
eb09e9
Subject: [PATCH 04/12] song-info: fix the signal name used for entry deletion
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=789632
eb09e9
---
eb09e9
 widgets/rb-song-info.c | 3 ++-
eb09e9
 1 file changed, 2 insertions(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/widgets/rb-song-info.c b/widgets/rb-song-info.c
eb09e9
index 54810e0b7..202f3d36e 100644
eb09e9
--- a/widgets/rb-song-info.c
eb09e9
+++ b/widgets/rb-song-info.c
eb09e9
@@ -733,6 +733,7 @@ rb_song_info_set_source_internal (RBSongInfo *song_info,
eb09e9
 
eb09e9
 	g_object_get (G_OBJECT (song_info->priv->query_model), "db", &song_info->priv->db, NULL);
eb09e9
 
eb09e9
+	rb_song_info_query_model_changed_cb (G_OBJECT (song_info->priv->source), NULL, song_info);
eb09e9
 	rb_song_info_base_query_model_changed_cb (G_OBJECT (song_info->priv->source), NULL, song_info);
eb09e9
 }
eb09e9
 
eb09e9
@@ -1514,7 +1515,7 @@ rb_song_info_query_model_changed_cb (GObject *source,
eb09e9
 				 "row-changed", G_CALLBACK (rb_song_info_query_model_inserted_cb),
eb09e9
 				 song_info, 0);
eb09e9
 	g_signal_connect_object (G_OBJECT (song_info->priv->query_model),
eb09e9
-				 "entry-deleted", G_CALLBACK (rb_song_info_query_model_deleted_cb),
eb09e9
+				 "post-entry-delete", G_CALLBACK (rb_song_info_query_model_deleted_cb),
eb09e9
 				 song_info, 0);
eb09e9
 	g_signal_connect_object (G_OBJECT (song_info->priv->query_model),
eb09e9
 				 "rows-reordered", G_CALLBACK (rb_song_info_query_model_reordered_cb),
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 223bafcc98a33262d70adc325f3393ac8f4b3ecc Mon Sep 17 00:00:00 2001
eb09e9
From: gkrithi8 <gkrithi8@gmail.com>
eb09e9
Date: Tue, 31 Oct 2017 17:06:58 +0530
eb09e9
Subject: [PATCH 05/12] shell: remove extra pixbuf unref
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=789706
eb09e9
---
eb09e9
 shell/rb-shell.c | 1 -
eb09e9
 1 file changed, 1 deletion(-)
eb09e9
eb09e9
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
eb09e9
index 7ae022795..734b90dcb 100644
eb09e9
--- a/shell/rb-shell.c
eb09e9
+++ b/shell/rb-shell.c
eb09e9
@@ -375,7 +375,6 @@ load_external_art_cb (RBExtDB *store, GValue *value, RBShell *shell)
eb09e9
 
eb09e9
 	pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
eb09e9
 	if (accept_art_pixbuf (pixbuf) == FALSE) {
eb09e9
-		g_object_unref (pixbuf);
eb09e9
 		g_object_unref (loader);
eb09e9
 		return NULL;
eb09e9
 	}
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 2604eeb2338a4da7a95f9b6d46223323c864ddf2 Mon Sep 17 00:00:00 2001
eb09e9
From: gkrithi8 <gkrithi8@gmail.com>
eb09e9
Date: Mon, 27 Nov 2017 13:31:39 +0530
eb09e9
Subject: [PATCH 06/12] ext-db: fix crash when store request processing fails
eb09e9
eb09e9
https://bugzilla.gnome.org/show_bug.cgi?id=727670
eb09e9
---
eb09e9
 metadata/rb-ext-db.c | 6 +++++-
eb09e9
 1 file changed, 5 insertions(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/metadata/rb-ext-db.c b/metadata/rb-ext-db.c
eb09e9
index 3e241e609..7d8e01573 100644
eb09e9
--- a/metadata/rb-ext-db.c
eb09e9
+++ b/metadata/rb-ext-db.c
eb09e9
@@ -954,7 +954,11 @@ do_store_request (GSimpleAsyncResult *result, GObject *object, GCancellable *can
eb09e9
 		 */
eb09e9
 		g_signal_emit (store, signals[STORE], 0, req->value, &req->data);
eb09e9
 
eb09e9
-		rb_debug ("stored value into encoded data of type %s", G_VALUE_TYPE_NAME (req->data));
eb09e9
+		if (req->data != NULL) {
eb09e9
+			rb_debug ("stored value into encoded data of type %s", G_VALUE_TYPE_NAME (req->data));
eb09e9
+		} else {
eb09e9
+			rb_debug ("failed to store value");
eb09e9
+		}
eb09e9
 	} else {
eb09e9
 		/* indicates we actually didn't get anything, as opposed to communication errors etc.
eb09e9
 		 * providers just shouldn't call rb_ext_db_store_* in that case.
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From a6f696f195b3c0aba63267c250ee15ccb058a8a9 Mon Sep 17 00:00:00 2001
eb09e9
From: Jonathan Matthew <jonathan@d14n.org>
eb09e9
Date: Tue, 30 Jan 2018 08:20:31 +1000
eb09e9
Subject: [PATCH 07/12] xfade: schedule stream reap after EOS
eb09e9
eb09e9
This stops streams hanging around in pending-remove state until
eb09e9
the stream after the following stream starts,
eb09e9
---
eb09e9
 backends/gstreamer/rb-player-gst-xfade.c | 1 +
eb09e9
 1 file changed, 1 insertion(+)
eb09e9
eb09e9
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
eb09e9
index d553397ce..420cf7f65 100644
eb09e9
--- a/backends/gstreamer/rb-player-gst-xfade.c
eb09e9
+++ b/backends/gstreamer/rb-player-gst-xfade.c
eb09e9
@@ -1831,6 +1831,7 @@ rb_player_gst_xfade_bus_cb (GstBus *bus, GstMessage *message, RBPlayerGstXFade *
eb09e9
 				 * message on the stream thread and now.
eb09e9
 				 */
eb09e9
 				start_waiting_eos_streams (player);
eb09e9
+				schedule_stream_reap (player);
eb09e9
 			} else {
eb09e9
 				/* no need to emit EOS here, we already know what to do next */
eb09e9
 				rb_debug ("got EOS message for stream %s in REUSING state", stream->uri);
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From f984934cfcbda9253bf26460163a546d8da69a01 Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Wed, 6 Jun 2018 10:48:52 +0200
eb09e9
Subject: [PATCH 08/12] daap: Fix build warning
eb09e9
MIME-Version: 1.0
eb09e9
Content-Type: text/plain; charset=UTF-8
eb09e9
Content-Transfer-Encoding: 8bit
eb09e9
eb09e9
Replace strncpy with memcpy to avoid adding a NUL-byte in the string.
eb09e9
eb09e9
rhythmbox/plugins/daap/rb-daap-src.c: In function ‘rb_daap_src_change_state’:
eb09e9
rhythmbox/plugins/daap/rb-daap-src.c:286:4: error: ‘strncpy’ output truncated before terminating nul copying 4 bytes from a string of the same length [-Werror=stringop-truncation]
eb09e9
    strncpy (httpuri, http, 4);
eb09e9
    ^~~~~~~~~~~~~~~~~~~~~~~~~~
eb09e9
---
eb09e9
 plugins/daap/rb-daap-src.c | 2 +-
eb09e9
 1 file changed, 1 insertion(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/plugins/daap/rb-daap-src.c b/plugins/daap/rb-daap-src.c
eb09e9
index 99a55caf4..002ac6a00 100644
eb09e9
--- a/plugins/daap/rb-daap-src.c
eb09e9
+++ b/plugins/daap/rb-daap-src.c
eb09e9
@@ -283,7 +283,7 @@ rb_daap_src_change_state (GstElement *element, GstStateChange transition)
eb09e9
 
eb09e9
 			/* Set daap://... URI as http:// on souphttpsrc to ready connection. */
eb09e9
 			httpuri = g_strdup (src->daap_uri);
eb09e9
-			strncpy (httpuri, http, 4);
eb09e9
+			memcpy (httpuri, http, 4);
eb09e9
 
eb09e9
 			g_object_set (src->souphttpsrc, "location", httpuri, NULL);
eb09e9
 			g_free (httpuri);
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From a73dbae82e3b3a782d36261fa2676cce1f589e45 Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Wed, 6 Jun 2018 11:34:52 +0200
eb09e9
Subject: [PATCH 09/12] build: Remove -Wcast-align warning
eb09e9
eb09e9
It generates a false positive error message when trying to compile on
eb09e9
ARM:
eb09e9
/usr/include/gstreamer-1.0/gst/gstbuffer.h: In function 'gst_buffer_ref':
eb09e9
/usr/include/gstreamer-1.0/gst/gstbuffer.h:429:10: error: cast increases required alignment of target type [-Werror=cast-align]
eb09e9
   return (GstBuffer *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (buf));
eb09e9
          ^
eb09e9
eb09e9
See https://bugzilla.gnome.org/show_bug.cgi?id=767255
eb09e9
---
eb09e9
 configure.ac | 2 +-
eb09e9
 1 file changed, 1 insertion(+), 1 deletion(-)
eb09e9
eb09e9
diff --git a/configure.ac b/configure.ac
eb09e9
index 746dfb49e..7124db904 100644
eb09e9
--- a/configure.ac
eb09e9
+++ b/configure.ac
eb09e9
@@ -469,7 +469,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
eb09e9
 	-Wunused-label -Wunused-value \
eb09e9
 	-Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes \
eb09e9
 	-Wnested-externs -Wpointer-arith \
eb09e9
-	-Wcast-align -Wformat-security -Wall \
eb09e9
+	-Wformat-security -Wall \
eb09e9
 	-Werror -Wno-deprecated-declarations -std=gnu89"
eb09e9
 
eb09e9
 	if echo "$CFLAGS" | grep -q -- '-O' && echo "$CFLAGS" | grep -q -v -- '-O0'; then
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 9871ddcce16cae60535523ab8c229319927f6d75 Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Fri, 8 Jun 2018 16:09:05 +0200
eb09e9
Subject: [PATCH 10/12] artsearch: Fix TypeError when returning results
eb09e9
eb09e9
eg. Traceback (most recent call last):
eb09e9
  File "/usr/lib64/rhythmbox/plugins/artsearch/local.py", line 136, in _enum_children_cb
eb09e9
    self.callback(self.callback_args)
eb09e9
TypeError: Argument 1 does not allow None as a value
eb09e9
---
eb09e9
 plugins/artsearch/embedded.py | 2 +-
eb09e9
 plugins/artsearch/lastfm.py   | 2 +-
eb09e9
 plugins/artsearch/local.py    | 2 +-
eb09e9
 3 files changed, 3 insertions(+), 3 deletions(-)
eb09e9
eb09e9
diff --git a/plugins/artsearch/embedded.py b/plugins/artsearch/embedded.py
eb09e9
index 206df547f..646da0a24 100644
eb09e9
--- a/plugins/artsearch/embedded.py
eb09e9
+++ b/plugins/artsearch/embedded.py
eb09e9
@@ -56,7 +56,7 @@ class EmbeddedSearch(object):
eb09e9
 			return
eb09e9
 
eb09e9
 
eb09e9
-	def search (self, key, last_time, store, callback, args):
eb09e9
+	def search (self, key, last_time, store, callback, *args):
eb09e9
 		location = key.get_info("location")
eb09e9
 		if location is None:
eb09e9
 			print("not searching, we don't have a location")
eb09e9
diff --git a/plugins/artsearch/lastfm.py b/plugins/artsearch/lastfm.py
eb09e9
index ff1966eae..2169ebab2 100644
eb09e9
--- a/plugins/artsearch/lastfm.py
eb09e9
+++ b/plugins/artsearch/lastfm.py
eb09e9
@@ -145,7 +145,7 @@ class LastFMSearch (object):
eb09e9
 		l.get_url(url, self.album_info_cb)
eb09e9
 
eb09e9
 
eb09e9
-	def search(self, key, last_time, store, callback, args):
eb09e9
+	def search(self, key, last_time, store, callback, *args):
eb09e9
 		if last_time > (time.time() - REPEAT_SEARCH_PERIOD):
eb09e9
 			print("we already tried this one")
eb09e9
 			callback (args)
eb09e9
diff --git a/plugins/artsearch/local.py b/plugins/artsearch/local.py
eb09e9
index 58214037e..4d28bf0e8 100644
eb09e9
--- a/plugins/artsearch/local.py
eb09e9
+++ b/plugins/artsearch/local.py
eb09e9
@@ -136,7 +136,7 @@ class LocalSearch:
eb09e9
 			self.callback(self.callback_args)
eb09e9
 
eb09e9
 
eb09e9
-	def search (self, key, last_time, store, callback, args):
eb09e9
+	def search (self, key, last_time, store, callback, *args):
eb09e9
 		# ignore last_time
eb09e9
 
eb09e9
 		location = key.get_info("location")
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 68fb588544a094a27127fe50c95e18019065b793 Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Fri, 8 Jun 2018 16:10:00 +0200
eb09e9
Subject: [PATCH 11/12] artsearch: Ignore unsupported scheme
eb09e9
eb09e9
When trying to play an HTTP stream, the local artsearch backend would
eb09e9
throw an error. We can safely ignore it though.
eb09e9
eb09e9
Traceback (most recent call last):
eb09e9
  File "/usr/lib64/rhythmbox/plugins/artsearch/local.py", line 129, in _enum_children_cb
eb09e9
    enumfiles = parent.enumerate_children_finish(result)
eb09e9
GLib.Error: g-io-error-quark: Operation not supported by backend (15)
eb09e9
---
eb09e9
 plugins/artsearch/local.py | 6 ++++--
eb09e9
 1 file changed, 4 insertions(+), 2 deletions(-)
eb09e9
eb09e9
diff --git a/plugins/artsearch/local.py b/plugins/artsearch/local.py
eb09e9
index 4d28bf0e8..074795a76 100644
eb09e9
--- a/plugins/artsearch/local.py
eb09e9
+++ b/plugins/artsearch/local.py
eb09e9
@@ -130,10 +130,12 @@ class LocalSearch:
eb09e9
 			enumfiles.next_files_async(ITEMS_PER_NOTIFICATION, GLib.PRIORITY_DEFAULT, None, self._enum_dir_cb, [])
eb09e9
 		except Exception as e:
eb09e9
 			print("okay, probably done: %s" % e)
eb09e9
-			if not isinstance(e, GLib.GError):
eb09e9
+			if e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_SUPPORTED):
eb09e9
+				self.callback(self.callback_args)
eb09e9
+			elif not isinstance(e, GLib.GError):
eb09e9
 				import sys
eb09e9
 				sys.excepthook(*sys.exc_info())
eb09e9
-			self.callback(self.callback_args)
eb09e9
+				self.callback(self.callback_args)
eb09e9
 
eb09e9
 
eb09e9
 	def search (self, key, last_time, store, callback, *args):
eb09e9
-- 
eb09e9
2.17.0
eb09e9
eb09e9
eb09e9
From 0994e76b65d0533bd148cab5631362202602b28f Mon Sep 17 00:00:00 2001
eb09e9
From: Bastien Nocera <hadess@hadess.net>
eb09e9
Date: Tue, 12 Jun 2018 15:16:29 +0200
eb09e9
Subject: [PATCH 12/12] sources: Fix state of initial import not reflecting
eb09e9
 reality
eb09e9
eb09e9
When rhythmbox is started with an empty "locations" setting, it will
eb09e9
rewrite the setting with the user's music folder as the only location.
eb09e9
This will start an import job from the setting's "changed" signal. But
eb09e9
we already start another import job from the "load-complete" signal of
eb09e9
the database.
eb09e9
eb09e9
Make sure only the load-complete signal triggers an import when setting
eb09e9
the "locations" setting is empty on startup.
eb09e9
---
eb09e9
 sources/rb-library-source.c | 29 +++++++++++++----------------
eb09e9
 1 file changed, 13 insertions(+), 16 deletions(-)
eb09e9
eb09e9
diff --git a/sources/rb-library-source.c b/sources/rb-library-source.c
eb09e9
index 15ba523d2..378a3e006 100644
eb09e9
--- a/sources/rb-library-source.c
eb09e9
+++ b/sources/rb-library-source.c
eb09e9
@@ -284,6 +284,10 @@ db_load_complete_cb (RhythmDB *db, RBLibrarySource *source)
eb09e9
 	if (source->priv->do_initial_import) {
eb09e9
 		const char *music_dir;
eb09e9
 		char *music_dir_uri;
eb09e9
+		const char *set_locations[2];
eb09e9
+
eb09e9
+		g_signal_handlers_block_by_func (source->priv->db_settings,
eb09e9
+						 G_CALLBACK (db_settings_changed_cb), source);
eb09e9
 		
eb09e9
 		music_dir = rb_music_dir ();
eb09e9
 		music_dir_uri = g_filename_to_uri (music_dir, NULL, NULL);
eb09e9
@@ -293,6 +297,13 @@ db_load_complete_cb (RhythmDB *db, RBLibrarySource *source)
eb09e9
 			g_mkdir_with_parents (music_dir, 0700);
eb09e9
 		}
eb09e9
 
eb09e9
+		set_locations[0] = music_dir_uri;
eb09e9
+		set_locations[1] = NULL;
eb09e9
+		g_settings_set_strv (source->priv->db_settings, "locations", set_locations);
eb09e9
+
eb09e9
+		g_signal_handlers_unblock_by_func (source->priv->db_settings,
eb09e9
+						   G_CALLBACK (db_settings_changed_cb), source);
eb09e9
+
eb09e9
 		/* import anything that's already in there */
eb09e9
 		job = maybe_create_import_job (source);
eb09e9
 		rhythmdb_import_job_add_uri (job, music_dir_uri);
eb09e9
@@ -344,22 +355,8 @@ rb_library_source_constructed (GObject *object)
eb09e9
 
eb09e9
 	/* Set up the default library location if there's no library location set */
eb09e9
 	locations = g_settings_get_strv (source->priv->db_settings, "locations");
eb09e9
-	if (g_strv_length (locations) == 0) {
eb09e9
-		char *music_dir_uri;
eb09e9
-
eb09e9
-		music_dir_uri = g_filename_to_uri (rb_music_dir (), NULL, NULL);
eb09e9
-		if (music_dir_uri != NULL) {
eb09e9
-			const char *set_locations[2];
eb09e9
-
eb09e9
-			set_locations[0] = music_dir_uri;
eb09e9
-			set_locations[1] = NULL;
eb09e9
-			g_settings_set_strv (source->priv->db_settings, "locations", set_locations);
eb09e9
-
eb09e9
-			source->priv->do_initial_import = TRUE;
eb09e9
-
eb09e9
-			g_free (music_dir_uri);
eb09e9
-		}
eb09e9
-	}
eb09e9
+	if (g_strv_length (locations) == 0)
eb09e9
+		source->priv->do_initial_import = TRUE;
eb09e9
 	g_strfreev (locations);
eb09e9
 
eb09e9
 	songs = rb_source_get_entry_view (RB_SOURCE (source));
eb09e9
-- 
eb09e9
2.17.0
eb09e9