On Wed, 2013-03-13 at 17:32 -0400, José Alburquerque wrote:
> On Sat, 2013-03-09 at 02:15 +0100, Yoann LE BARS wrote:
> > Hello everybody out there!
> >
> > No, actually, what I have done does not work.
> >
> > I have tried and make my code cleaner, including concerning messages it
> > send. To achieve this, I have changed the enumeration this way:
> >
> > enum TypeConnexion {FREEDESKTOP, GNOME, NONE};
> >
> > Then, I have changed initialisation of the proxy to this:
> >
> > proxy =
> > Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SESSION,
> > "org.freedesktop.PowerManagement",
> > "org/freedesktop/PowerManagement",
> > "org.freedesktop.PowerManagement");
> > if (proxy) {
> > connectionType = FREEDESKTOP;
> > }
> > else {
> > std::ostringstream message;
> > message << "No Freedesktop type D-Bus connection available, "
> > << "trying Gnome type.\n";
> > g_message(message.str().c_str());
> >
> > proxy =
> > Gio::DBus::Proxy::create_for_bus_sync(Gio::DBus::BUS_TYPE_SESSION,
> > "org.gnome.SessionManager",
> > "/org/gnome/SessionManager",
> > "org.gnome.SessionManager");
> > if (proxy) {
> > connectionType = GNOME;
> > }
> > else {
> > g_message("No D-Bus connection available.");
> > connectionType = NONE;
> > }
> > }
> >
> > Running it on Gnome 3, what I expect is failure while attempting to
> > connect to ["org.freedesktop.PowerManagement",
> > "org/freedesktop/PowerManagement", "org.freedesktop.PowerManagement"] ,
> > then outputting this message:
> >
> > 'No Freedesktop type D-Bus connection available, trying Gnome type.'
> >
> > Then, the proxy should connect to ["org.gnome.SessionManager",
> > "/org/gnome/SessionManager", "org.gnome.SessionManager"] with success,
> > "connectionType" is set to "GNOME" and this is it.
> >
> > Here is the output I get:
> >
> > (tutoriel4:8403): GLib-GIO-CRITICAL **:
> > g_dbus_connection_signal_subscribe: assertion `object_path == NULL ||
> > g_variant_is_object_path (object_path)' failed
> >
> > (tutoriel4:8403): GLib-GIO-CRITICAL **:
> > g_dbus_connection_signal_subscribe: assertion `object_path == NULL ||
> > g_variant_is_object_path (object_path)' failed
> >
> > (tutoriel4:8403): GLib-GIO-CRITICAL **:
> > g_dbus_connection_call_sync_internal: assertion `object_path != NULL &&
> > g_variant_is_object_path (object_path)' failed
> >
> > (tutoriel4:8403): GLib-GIO-CRITICAL **:
> > g_dbus_connection_call_sync_internal: assertion `object_path != NULL &&
> > g_variant_is_object_path (object_path)' failed
>
> These warnings lead me to believe that there is a problem with how the
> strings are being passed to the C API. I'll have to look into it.
Actually, the warnings come from missing a leading '/' in the object
paths used. It doesn't look there is a problem passing strings to the C
API. Sorry.
>
> >
> > I have tried and switch into full-screen mode (which implies to inhibit
> > screen-saver), then back to windowed mode (which implies to uninhibit
> > screen-saver).
> >
> > I expected the first two messages: these are the result of attempting
> > to connect to an un-existing bus. But, clearly then the chosen
> > alternative is "if (proxy)" and connectionType is set to "FREEDESKTOP".
> > As a consequence, it then try and send request in Freedesktop mode,
> > which fails (the two last messages).
> >
> > It seems to me that "proxy" is set whether connection succeeded or not.
> > This is the reason previously I had to use "if (!proxy)" to obtain the
> > desired results, but it was an error.
> >
> > So it is all back to this question: does anyone know a way to determine
> > which connection is available?
> >
> > Regards.
> >
> > Yoann
> > _______________________________________________
> > gtkmm-list mailing list
> > [email protected]
> > https://mail.gnome.org/mailman/listinfo/gtkmm-list
>
--
José
--
José
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list