[libdmapsharing] Change {DAAP, DPAP}Record's hash and thumbnail properties into a boxed type
- From: W. Michael Petullo <wmpetullo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdmapsharing] Change {DAAP, DPAP}Record's hash and thumbnail properties into a boxed type
- Date: Mon, 13 Nov 2017 18:44:53 +0000 (UTC)
commit 1973bfe8d1e0139e20488343552185a211f68381
Author: W. Michael Petullo <mike flyn org>
Date: Mon Nov 13 13:44:42 2017 -0500
Change {DAAP,DPAP}Record's hash and thumbnail properties into a boxed type
Signed-off-by: W. Michael Petullo <mike flyn org>
libdmapsharing/daap-record.c | 3 ++-
libdmapsharing/dpap-record.c | 6 ++++--
libdmapsharing/test-daap-record.c | 7 ++-----
libdmapsharing/test-dpap-record.c | 7 ++-----
tests/test-dmap-client-python | 1 +
tests/testpython.py | 2 +-
vala/libdmapsharing-3.2.vapi | 4 ++--
7 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/libdmapsharing/daap-record.c b/libdmapsharing/daap-record.c
index 173ee00..d55d62f 100644
--- a/libdmapsharing/daap-record.c
+++ b/libdmapsharing/daap-record.c
@@ -36,10 +36,11 @@ daap_record_default_init (DAAPRecordInterface * iface)
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
- g_param_spec_pointer
+ g_param_spec_boxed
("hash",
"Hash of media file contents",
"Hash of media file contents",
+ G_TYPE_ARRAY,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
diff --git a/libdmapsharing/dpap-record.c b/libdmapsharing/dpap-record.c
index cf2535d..391fd58 100644
--- a/libdmapsharing/dpap-record.c
+++ b/libdmapsharing/dpap-record.c
@@ -36,10 +36,11 @@ dpap_record_default_init (DPAPRecordInterface * iface)
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
- g_param_spec_pointer
+ g_param_spec_boxed
("hash",
"Hash of media file contents",
"Hash of media file contents",
+ G_TYPE_ARRAY,
G_PARAM_READWRITE));
/* iTunes does not require to this to match the datatype for the image
@@ -77,10 +78,11 @@ dpap_record_default_init (DPAPRecordInterface * iface)
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
- g_param_spec_pointer
+ g_param_spec_boxed
("thumbnail",
"Photo thumbnail",
"Photo thumbnail",
+ G_TYPE_ARRAY,
G_PARAM_READWRITE));
g_object_interface_install_property (iface,
diff --git a/libdmapsharing/test-daap-record.c b/libdmapsharing/test-daap-record.c
index 8abc6e6..1e897d7 100644
--- a/libdmapsharing/test-daap-record.c
+++ b/libdmapsharing/test-daap-record.c
@@ -155,10 +155,7 @@ test_daap_record_set_property (GObject *object,
record->priv->mediakind = g_value_get_enum (value);
break;
case PROP_HASH:
- if (record->priv->hash) {
- g_byte_array_unref (record->priv->hash);
- }
- record->priv->hash = g_byte_array_ref (g_value_get_pointer (value));
+ record->priv->hash = g_value_get_boxed (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -236,7 +233,7 @@ test_daap_record_get_property (GObject *object,
g_value_set_enum (value, record->priv->mediakind);
break;
case PROP_HASH:
- g_value_set_pointer (value, record->priv->hash);
+ g_value_set_boxed (value, record->priv->hash);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/libdmapsharing/test-dpap-record.c b/libdmapsharing/test-dpap-record.c
index 2fc2cf1..c571b01 100644
--- a/libdmapsharing/test-dpap-record.c
+++ b/libdmapsharing/test-dpap-record.c
@@ -90,10 +90,7 @@ test_dpap_record_set_property (GObject *object,
record->priv->format = g_value_dup_string (value);
break;
case PROP_THUMBNAIL:
- if (record->priv->thumbnail) {
- g_byte_array_unref (record->priv->thumbnail);
- }
- record->priv->thumbnail = g_byte_array_ref (g_value_get_pointer (value));
+ record->priv->thumbnail = g_value_get_boxed (value);
break;
case PROP_COMMENTS:
g_free (record->priv->comments);
@@ -143,7 +140,7 @@ test_dpap_record_get_property (GObject *object,
g_value_set_string (value, record->priv->format);
break;
case PROP_THUMBNAIL:
- g_value_set_pointer (value, record->priv->thumbnail);
+ g_value_set_boxed (value, record->priv->thumbnail);
break;
case PROP_COMMENTS:
g_value_set_string (value, record->priv->comments);
diff --git a/tests/test-dmap-client-python b/tests/test-dmap-client-python
index f88b908..b60e6dc 100755
--- a/tests/test-dmap-client-python
+++ b/tests/test-dmap-client-python
@@ -47,6 +47,7 @@ class TestDMAPClient(GObject.GObject):
print(' has_video:', record.has_video)
print(' mediakind:', record.mediakind)
print(' songalbumid:', record.songalbumid)
+ print(' hash:', record.hash)
def authenticate_cb(self, connection, name, session, msg, auth, retrying):
username = connection.get_property('username')
diff --git a/tests/testpython.py b/tests/testpython.py
index 2898a42..360ea91 100644
--- a/tests/testpython.py
+++ b/tests/testpython.py
@@ -52,7 +52,7 @@ class PyDAAPRecord(GObject.GObject, DAAP.Record, DMAP.Record):
has_video = GObject.property(type=GObject.TYPE_BOOLEAN, default=0)
mediakind = GObject.property(type=DMAP.MediaKind, default=DMAP.MediaKind.MUSIC)
songalbumid = GObject.property(type=GObject.TYPE_INT64, default=0)
- hash = GObject.property(type=GLib.ByteArray, default=None)
+ hash = GObject.property(type=GLib.Array, default=None)
def __init__(self):
super(PyDAAPRecord, self).__init__()
diff --git a/vala/libdmapsharing-3.2.vapi b/vala/libdmapsharing-3.2.vapi
index aa6cd21..bbc8bb4 100644
--- a/vala/libdmapsharing-3.2.vapi
+++ b/vala/libdmapsharing-3.2.vapi
@@ -337,7 +337,7 @@ namespace DAAP {
[NoAccessorMethod]
public bool has_video { get; set; }
[NoAccessorMethod]
- public void* hash { get; set; }
+ public GLib.Array hash { owned get; set; }
[NoAccessorMethod]
public string location { owned get; set; }
[NoAccessorMethod]
@@ -986,7 +986,7 @@ namespace DACP {
[NoAccessorMethod]
public bool has_video { get; set; }
[NoAccessorMethod]
- public void* hash { get; set; }
+ public GLib.Array hash { owned get; set; }
[NoAccessorMethod]
public string location { owned get; set; }
[NoAccessorMethod]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]