+ const static GDBusInterfaceVTable vtable = {
+ g_application_impl_method_call,
+ g_application_impl_get_property,
+ NULL /* set_property */
+ };
+ GApplicationClass *app_class = G_APPLICATION_GET_CLASS (impl->app);
+ GVariant *reply;
+ guint32 rval;
+
+ if (org_gtk_Application == NULL)
+ {
+ GError *error = NULL;
+ GDBusNodeInfo *info;
+
+ info = g_dbus_node_info_new_for_xml (org_gtk_Application_xml, &error);
+ if G_UNLIKELY (info == NULL)
+ g_error ("%s", error->message);
+ org_gtk_Application = g_dbus_node_info_lookup_interface (info, "org.gtk.Application");
+ g_assert (org_gtk_Application != NULL);
+ g_dbus_interface_info_ref (org_gtk_Application);
+ g_dbus_node_info_unref (info);
+
+ info = g_dbus_node_info_new_for_xml (org_freedesktop_Application_xml, &error);
+ if G_UNLIKELY (info == NULL)
+ g_error ("%s", error->message);
+ org_freedesktop_Application = g_dbus_node_info_lookup_interface (info, "org.freedesktop.Application");
+ g_assert (org_freedesktop_Application != NULL);
+ g_dbus_interface_info_ref (org_freedesktop_Application);
+ g_dbus_node_info_unref (info);
+ }
+
+ /* We could possibly have been D-Bus activated as a result of incoming
+ * requests on either the application or actiongroup interfaces.
+ * Because of how GDBus dispatches messages, we need to ensure that
+ * both of those things are registered before we attempt to request
+ * our name.
+ *
+ * The action group need not be populated yet, as long as it happens
+ * before we return to the mainloop. The reason for that is because
+ * GDBus does the check to make sure the object exists from the worker
+ * thread but doesn't actually dispatch the action invocation until we
+ * hit the mainloop in this thread. There is also no danger of
+ * receiving 'activate' or 'open' signals until after 'startup' runs,
+ * for the same reason.
+ */
+ impl->object_id = g_dbus_connection_register_object (impl->session_bus, impl->object_path,
+ org_gtk_Application, &vtable, impl, NULL, error);
+
+ if (impl->object_id == 0)
+ return FALSE;
+
+ impl->fdo_object_id = g_dbus_connection_register_object (impl->session_bus, impl->object_path,
+ org_freedesktop_Application, &vtable, impl, NULL, error);
+
+ if (impl->fdo_object_id == 0)
+ return FALSE;
+
+ impl->actions_id = g_dbus_connection_export_action_group (impl->session_bus, impl->object_path,
+ impl->exported_actions, error);
+
+ if (impl->actions_id == 0)
+ return FALSE;
+
+ if (!app_class->dbus_register (impl->app,
+ impl->session_bus,
+ impl->object_path,
+ error))
+ return FALSE;
+
+ if (impl->bus_name == NULL)