[rhythmbox] ext-db: also support raw values in GBytes form
- From: Jonathan Matthew <jmatthew src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rhythmbox] ext-db: also support raw values in GBytes form
- Date: Mon, 18 Nov 2019 22:23:56 +0000 (UTC)
commit 6996a1e136d685c0a693eed0c597ebd3b81a1a47
Author: Jonathan Matthew <jonathan d14n org>
Date: Mon Nov 18 22:23:45 2019 +1000
ext-db: also support raw values in GBytes form
This is convenient for passing in from python plugins, it turns out.
metadata/rb-ext-db.c | 6 ++++++
shell/rb-shell.c | 3 +++
2 files changed, 9 insertions(+)
---
diff --git a/metadata/rb-ext-db.c b/metadata/rb-ext-db.c
index 7d8e01573..2307bca60 100644
--- a/metadata/rb-ext-db.c
+++ b/metadata/rb-ext-db.c
@@ -983,6 +983,12 @@ do_store_request (GSimpleAsyncResult *result, GObject *object, GCancellable *can
GString *str = g_value_get_boxed (req->data);
file_data = (const char *)str->str;
file_data_size = str->len;
+ } else if (G_VALUE_HOLDS (req->data, G_TYPE_BYTES)) {
+ GBytes *bytes = g_value_get_boxed (req->data);
+ gsize nbytes;
+
+ file_data = g_bytes_get_data (bytes, &nbytes);
+ file_data_size = nbytes;
} else {
/* warning? */
rb_debug ("don't know how to save data of type %s", G_VALUE_TYPE_NAME (req->data));
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index 99fc9c9b8..9d72c4e94 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -349,6 +349,9 @@ load_external_art_cb (RBExtDB *store, GValue *value, RBShell *shell)
GByteArray *bytes = g_value_get_boxed (value);
data = (const char *)bytes->data;
data_size = bytes->len;
+ } else if (G_VALUE_HOLDS (value, G_TYPE_BYTES)) {
+ GBytes *bytes = g_value_get_boxed (value);
+ data = g_bytes_get_data (bytes, &data_size);
} else {
rb_debug ("unable to load pixbufs from values of type %s", G_VALUE_TYPE_NAME (value));
return NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]