Use a variant type for the hint dictionary values. This let's us actually use various data types in D-BUS 0.3x.
This commit is contained in:
parent
bf6d0d7d0b
commit
e09f929373
|
@ -1,3 +1,10 @@
|
||||||
|
Mon Jul 25 22:47:02 PDT 2005 Christian Hammond <chipx86@gnupdate.org>
|
||||||
|
|
||||||
|
* libnotify/notify.c:
|
||||||
|
* tests/test-xy.c:
|
||||||
|
- Use a variant type for the hint dictionary values. This let's us
|
||||||
|
actually use various data types in D-BUS 0.3x.
|
||||||
|
|
||||||
Thu Jul 28 01:54:27 PDT 2005 Christian Hammond <chipx86@chipx86.com>
|
Thu Jul 28 01:54:27 PDT 2005 Christian Hammond <chipx86@chipx86.com>
|
||||||
|
|
||||||
* docs/notification-spec.xml:
|
* docs/notification-spec.xml:
|
||||||
|
|
|
@ -815,7 +815,7 @@ hint_foreach_func(const gchar *key, NotifyHintData *hint,
|
||||||
DBusMessageIter *iter)
|
DBusMessageIter *iter)
|
||||||
{
|
{
|
||||||
#if NOTIFY_CHECK_DBUS_VERSION(0, 30)
|
#if NOTIFY_CHECK_DBUS_VERSION(0, 30)
|
||||||
DBusMessageIter entry_iter;
|
DBusMessageIter entry_iter, value_iter;
|
||||||
|
|
||||||
dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY, NULL,
|
dbus_message_iter_open_container(iter, DBUS_TYPE_DICT_ENTRY, NULL,
|
||||||
&entry_iter);
|
&entry_iter);
|
||||||
|
@ -824,26 +824,42 @@ hint_foreach_func(const gchar *key, NotifyHintData *hint,
|
||||||
switch (hint->type)
|
switch (hint->type)
|
||||||
{
|
{
|
||||||
case HINT_TYPE_STRING:
|
case HINT_TYPE_STRING:
|
||||||
dbus_message_iter_append_basic(&entry_iter, DBUS_TYPE_STRING,
|
dbus_message_iter_open_container(&entry_iter, DBUS_TYPE_VARIANT,
|
||||||
|
DBUS_TYPE_STRING_AS_STRING,
|
||||||
|
&value_iter);
|
||||||
|
dbus_message_iter_append_basic(&value_iter, DBUS_TYPE_STRING,
|
||||||
&hint->u.string);
|
&hint->u.string);
|
||||||
|
dbus_message_iter_close_container(&entry_iter, &value_iter);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HINT_TYPE_INT:
|
case HINT_TYPE_INT:
|
||||||
dbus_message_iter_append_basic(&entry_iter, DBUS_TYPE_INT32,
|
dbus_message_iter_open_container(&entry_iter, DBUS_TYPE_VARIANT,
|
||||||
|
DBUS_TYPE_INT32_AS_STRING,
|
||||||
|
&value_iter);
|
||||||
|
dbus_message_iter_append_basic(&value_iter, DBUS_TYPE_INT32,
|
||||||
&hint->u.integer);
|
&hint->u.integer);
|
||||||
|
dbus_message_iter_close_container(&entry_iter, &value_iter);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HINT_TYPE_BOOL:
|
case HINT_TYPE_BOOL:
|
||||||
dbus_message_iter_append_basic(&entry_iter, DBUS_TYPE_BOOLEAN,
|
dbus_message_iter_open_container(&entry_iter, DBUS_TYPE_VARIANT,
|
||||||
|
DBUS_TYPE_BOOLEAN_AS_STRING,
|
||||||
|
&value_iter);
|
||||||
|
dbus_message_iter_append_basic(&value_iter, DBUS_TYPE_BOOLEAN,
|
||||||
&hint->u.boolean);
|
&hint->u.boolean);
|
||||||
|
dbus_message_iter_close_container(&entry_iter, &value_iter);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
/* Better than nothing... */
|
/* Better than nothing... */
|
||||||
char *empty = "";
|
char *empty = "";
|
||||||
dbus_message_iter_append_basic(&entry_iter, DBUS_TYPE_STRING,
|
dbus_message_iter_open_container(&entry_iter, DBUS_TYPE_VARIANT,
|
||||||
|
DBUS_TYPE_STRING_AS_STRING,
|
||||||
|
&value_iter);
|
||||||
|
dbus_message_iter_append_basic(&value_iter, DBUS_TYPE_STRING,
|
||||||
&empty);
|
&empty);
|
||||||
|
dbus_message_iter_close_container(&entry_iter, &value_iter);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -916,9 +932,8 @@ notify_send_notification_varg(NotifyHandle *replaces, const char *type,
|
||||||
}
|
}
|
||||||
else if (icon->raw_data)
|
else if (icon->raw_data)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
#if !NOTIFY_CHECK_DBUS_VERSION(0, 30)
|
#if !NOTIFY_CHECK_DBUS_VERSION(0, 30)
|
||||||
|
int i;
|
||||||
dbus_message_iter_append_array(&iter, &array_iter, DBUS_TYPE_ARRAY);
|
dbus_message_iter_append_array(&iter, &array_iter, DBUS_TYPE_ARRAY);
|
||||||
|
|
||||||
for (i = 0; i < icon->frames; i++)
|
for (i = 0; i < icon->frames; i++)
|
||||||
|
@ -1009,7 +1024,7 @@ notify_send_notification_varg(NotifyHandle *replaces, const char *type,
|
||||||
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
|
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
|
||||||
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
|
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
|
||||||
DBUS_TYPE_STRING_AS_STRING
|
DBUS_TYPE_STRING_AS_STRING
|
||||||
DBUS_TYPE_STRING_AS_STRING
|
DBUS_TYPE_VARIANT_AS_STRING
|
||||||
DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
|
DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
|
||||||
&dict_iter);
|
&dict_iter);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
GHashTable *hints;
|
NotifyHints *hints;
|
||||||
|
|
||||||
notify_init("XY");
|
notify_init("XY");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue