[PATCH BlueZ 2/4] player: Check if values really changed before emitting signals

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

---
 profiles/audio/player.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/profiles/audio/player.c b/profiles/audio/player.c
index ece33cc..e08e373 100644
--- a/profiles/audio/player.c
+++ b/profiles/audio/player.c
@@ -938,6 +938,9 @@ void media_player_set_metadata(struct media_player *mp, const char *key,
 
 void media_player_set_type(struct media_player *mp, const char *type)
 {
+	if (g_strcmp0(mp->type, type) == 0)
+		return;
+
 	DBG("%s", type);
 
 	mp->type = g_strdup(type);
@@ -949,6 +952,9 @@ void media_player_set_type(struct media_player *mp, const char *type)
 
 void media_player_set_subtype(struct media_player *mp, const char *subtype)
 {
+	if (g_strcmp0(mp->subtype, subtype) == 0)
+		return;
+
 	DBG("%s", subtype);
 
 	mp->subtype = g_strdup(subtype);
@@ -960,6 +966,9 @@ void media_player_set_subtype(struct media_player *mp, const char *subtype)
 
 void media_player_set_name(struct media_player *mp, const char *name)
 {
+	if (g_strcmp0(mp->name, name) == 0)
+		return;
+
 	DBG("%s", name);
 
 	mp->name = g_strdup(name);
@@ -971,6 +980,9 @@ void media_player_set_name(struct media_player *mp, const char *name)
 
 void media_player_set_browsable(struct media_player *mp, bool enabled)
 {
+	if (mp->browsable == enabled)
+		return;
+
 	DBG("%s", enabled ? "true" : "false");
 
 	mp->browsable = enabled;
@@ -982,6 +994,9 @@ void media_player_set_browsable(struct media_player *mp, bool enabled)
 
 void media_player_set_searchable(struct media_player *mp, bool enabled)
 {
+	if (mp->browsable == enabled)
+		return;
+
 	DBG("%s", enabled ? "true" : "false");
 
 	mp->searchable = enabled;
@@ -1262,6 +1277,10 @@ int media_player_create_folder(struct media_player *mp, const char *name,
 {
 	struct media_item *item;
 
+	item = media_player_find_folder(mp, name);
+	if (item != NULL)
+		return 0;
+
 	item = media_player_create_item(mp, name,
 					PLAYER_ITEM_TYPE_FOLDER);
 	if (item == NULL)
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux