Skip to content

Commit

Permalink
dbus message fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksiy-Yakovenko committed Dec 29, 2023
1 parent 27b8cbd commit 51d16d8
Showing 1 changed file with 33 additions and 21 deletions.
54 changes: 33 additions & 21 deletions plugins/notify/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,42 +348,54 @@ show_notification (DB_playItem_t *track, char *image_filename, dbus_uint32_t rep

{

// image data needs to be inserted here, under image-data key
// NOTE: it's not guaranteed that image-data hint is supported by all notification daemons
DBusMessageIter dict_entry_sub;
dbus_message_iter_open_container (&sub, DBUS_TYPE_DICT_ENTRY, 0, &dict_entry_sub);

const char v_image_data[] = "image-data";
dbus_message_iter_append_basic (&sub, DBUS_TYPE_STRING, &v_image_data);
{

DBusMessageIter value_sub;
// image data needs to be inserted here, under image-data key
// NOTE: it's not guaranteed that image-data hint is supported by all notification daemons

dbus_message_iter_open_container (&sub, DBUS_TYPE_VARIANT, "(iiibiiay)", &value_sub);
const char v_image_data[] = "image-data";
dbus_message_iter_append_basic (&dict_entry_sub, DBUS_TYPE_STRING, &v_image_data);

{
DBusMessageIter value_sub;

DBusMessageIter image_sub;
dbus_message_iter_open_container (&value_sub, DBUS_TYPE_STRUCT, NULL, &image_sub);
dbus_message_iter_open_container (&dict_entry_sub, DBUS_TYPE_VARIANT, "(iiibiiay)", &value_sub);

{

DBusMessageIter data_sub;
DBusMessageIter image_sub;
dbus_message_iter_open_container (&value_sub, DBUS_TYPE_STRUCT, NULL, &image_sub);

{

dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.width);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.height);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.stride);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_BOOLEAN, &image_data.has_alpha);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.bits_per_sample);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.channels);
DBusMessageIter data_sub;

dbus_message_iter_open_container (&image_sub, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE_AS_STRING, &data_sub);
{ dbus_message_iter_append_fixed_array (&data_sub, DBUS_TYPE_BYTE, &image_data.bytes, 16); }
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.width);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.height);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.stride);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_BOOLEAN, &image_data.has_alpha);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.bits_per_sample);
dbus_message_iter_append_basic (&image_sub, DBUS_TYPE_INT32, &image_data.channels);

dbus_message_iter_open_container (
&image_sub,
DBUS_TYPE_ARRAY,
DBUS_TYPE_BYTE_AS_STRING,
&data_sub);
{ dbus_message_iter_append_fixed_array (&data_sub, DBUS_TYPE_BYTE, &image_data.bytes, 16); }

dbus_message_iter_close_container (&image_sub, &data_sub);
}

dbus_message_iter_close_container (&image_sub, &data_sub);
dbus_message_iter_close_container (&value_sub, &image_sub);
}

dbus_message_iter_close_container (&value_sub, &image_sub);
dbus_message_iter_close_container (&dict_entry_sub, &value_sub);
}

dbus_message_iter_close_container (&sub, &value_sub);
dbus_message_iter_close_container (&sub, &dict_entry_sub);
}

dbus_message_iter_close_container (&iter, &sub);
Expand Down

0 comments on commit 51d16d8

Please sign in to comment.