* - Need to rewrite GDBusAuth and rework GDBusAuthMechanism. In particular
* the mechanism VFuncs need to be able to set an error.
*
- * - The GDBusProxy::g-properties-changed signal currently looks like this
- *
- * void user_function (GDBusProxy *proxy,
- * GHashTable *changed_properties,
- * gpointer user_data);
- *
- * which is problematic because some people frown upon GHashTable
- * usage in public API (in particular some of the JS people). Maybe we
- * need to rework it, maybe it doesn't matter since GDBusProxy is
- * a low-level API and, for C code, we expect code generators to
- * spit out subclasses that automatically hook up to this signal
- * and does g_object_notify() anyway? Hmm...
- *
* - probably want a G_DBUS_NONCE_TCP_TMPDIR environment variable
* to specify where the nonce is stored. This will allow people to use
* G_DBUS_NONCE_TCP_TMPDIR=/mnt/secure.company.server/dbus-nonce-dir
/**
* GDBusProxy::g-properties-changed:
* @proxy: The #GDBusProxy emitting the signal.
- * @changed_properties: A #GHashTable containing the properties that changed.
+ * @changed_properties: A #GVariant containing the properties that changed.
*
* Emitted when one or more D-Bus properties on @proxy changes. The cached properties
* are already replaced when this signal fires.
g_cclosure_marshal_VOID__BOXED,
G_TYPE_NONE,
1,
- G_TYPE_HASH_TABLE);
+ G_TYPE_VARIANT);
/**
* GDBusProxy::g-signal:
const gchar *interface_name_for_signal;
GVariantIter *iter;
GVariant *item;
- GHashTable *changed_properties;
+ GVariant *changed_properties;
+ GVariantBuilder *builder;
error = NULL;
iter = NULL;
if (g_strcmp0 (interface_name_for_signal, proxy->priv->interface_name) != 0)
goto out;
- changed_properties = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- (GDestroyNotify) g_variant_unref);
-
+ builder = g_variant_builder_new (G_VARIANT_TYPE_ARRAY);
while ((item = g_variant_iter_next_value (iter)))
{
const gchar *key;
g_strdup (key),
value); /* steals value */
- g_hash_table_insert (changed_properties,
- g_strdup (key),
- g_variant_ref (value));
+ g_variant_builder_add (builder,
+ "{sv}",
+ g_strdup (key),
+ g_variant_ref (value));
}
-
+ changed_properties = g_variant_builder_end (builder);
/* emit signal */
g_signal_emit (proxy, signals[PROPERTIES_CHANGED_SIGNAL], 0, changed_properties);
- g_hash_table_unref (changed_properties);
+ g_variant_unref (changed_properties);
out:
if (iter != NULL)
/*< public >*/
/* Signals */
void (*g_properties_changed) (GDBusProxy *proxy,
- GHashTable *changed_properties);
+ GVariant *changed_properties);
void (*g_signal) (GDBusProxy *proxy,
const gchar *sender_name,
const gchar *signal_name,
static void
on_properties_changed (GDBusProxy *proxy,
- GHashTable *changed_properties,
+ GVariant *changed_properties,
gpointer user_data)
{
- GHashTableIter iter;
- const gchar *key;
- GVariant *value;
+ GVariantIter *iter;
+ GVariant *item;
g_print (" *** Properties Changed:\n");
- g_hash_table_iter_init (&iter, changed_properties);
- while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
+ g_variant_get (changed_properties,
+ "a{sv}",
+ &iter);
+ while ((item = g_variant_iter_next_value (iter)))
{
+ const gchar *key;
+ GVariant *value;
gchar *value_str;
+
+ g_variant_get (item,
+ "{sv}",
+ &key,
+ &value);
+
value_str = g_variant_print (value, TRUE);
g_print (" %s -> %s\n", key, value_str);
g_free (value_str);