Web lists-archives.com

gdbus: Problems getting cached properties immediately after receiving 'g-name-owner'




Hi

I use gdbus-codegen to create proxy classes for my dbus objects. I
create a proxy using:

  m_proxy = dbus_foo_proxy_new_for_bus_sync(
      G_BUS_TYPE_SESSION,
      G_DBUS_PROXY_FLAGS_NONE,
      busName,
      objectPath,
      NULL,
      &error);

And connect to the signal:

  g_signal_connect(
      m_proxy,
      "notify::g-name-owner",
      G_CALLBACK(OnNameOwnerChanged),
      this);

When I the name is owned, I get a signal and immediately try to read all
cached properties:

  void OnNameOwnerChanged(
      GObject *    gobject,
      GParamSpec * pspec,
      gpointer     user_data)
  {
    GVariant * variant = g_dbus_proxy_get_cached_property(
        G_DBUS_PROXY(pThis->m_proxy),
        "bar");
    if (variant)
    {
      doMagic(variant);
      g_variant_unref(variant);
    }
  }

However, the variant returned from g_dbus_proxy_get_cached_property is
NULL. I read in glib source file gdbusproxy.c, on_name_owner_changed()
that when glib receives the underlying org.freedesktop.DBus
NameOwnerChanged signal, it will first issue a
org.freedesktop.DBus.Properties GetAll method call before it will emit
the g-name-owner signal, in on_name_owner_changed_get_all_cb().

What can be the reason the properties are not available when I receive
the g-name-owner signal?

(cross posted on
http://stackoverflow.com/questions/34198495/gdbus-problems-getting-cached-properties-immediately-after-receiving-g-name-ow)

Anders
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list