/** * g_async_initable_new_finish: * @initable: the #GAsyncInitable from the callback * @res: the #GAsyncResult from the callback * @error: return location for errors, or %NULL to ignore * * Finishes the async construction for the various g_async_initable_new * calls, returning the created object or %NULL on error. * * Returns: (transfer full): a newly created #GObject, or %NULL on error. * Free with g_object_unref(). * * Since: 2.22 */ GObject * g_async_initable_new_finish (GAsyncInitable *initable, GAsyncResult *res, GError **error) { if (g_async_initable_init_finish (initable, res, error)) return g_object_ref (initable); else return NULL; }
static VALUE asyncinitable_init_finish(VALUE self, VALUE result) { GError *error = NULL; if (!g_async_initable_init_finish(_SELF(self), RVAL2GASYNCRESULT(result), &error)) rbgio_raise_error(error); return self; }
static void content_ready (GObject *object, GAsyncResult *res, gpointer user_data) { TfCallChannel *self = TF_CALL_CHANNEL (user_data); TfCallContent *content = TF_CALL_CONTENT (object); if (g_async_initable_init_finish (G_ASYNC_INITABLE (object), res, NULL)) { g_signal_emit (self, signals[SIGNAL_CONTENT_ADDED], 0, content); } else { g_ptr_array_remove_fast (self->contents, content); } g_object_unref (self); }
static void ide_file_settings__init_cb (GObject *object, GAsyncResult *result, gpointer user_data) { g_autoptr(IdeFileSettings) self = user_data; IdeFileSettingsPrivate *priv = ide_file_settings_get_instance_private (self); GAsyncInitable *initable = (GAsyncInitable *)object; g_autoptr(GError) error = NULL; g_assert (IDE_IS_FILE_SETTINGS (self)); g_assert (G_IS_ASYNC_INITABLE (initable)); if (!g_async_initable_init_finish (initable, result, &error)) g_warning ("%s", error->message); if (--priv->unsettled_count == 0) g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_SETTLED]); }
static void on_bss_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) { NMSupplicantInterface *self; NMSupplicantInterfacePrivate *priv; gs_free_error GError *error = NULL; gs_strfreev char **properties = NULL; gs_unref_variant GVariant *props = NULL; GVariantBuilder builder; char **iter; if (!g_async_initable_init_finish (G_ASYNC_INITABLE (proxy), result, &error)) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { nm_log_dbg (LOGD_SUPPLICANT, "Failed to acquire BSS proxy: (%s)", error->message); g_hash_table_remove (NM_SUPPLICANT_INTERFACE_GET_PRIVATE (user_data)->bss_proxies, g_dbus_proxy_get_object_path (proxy)); } return; } self = NM_SUPPLICANT_INTERFACE (user_data); priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); iter = properties = g_dbus_proxy_get_cached_property_names (proxy); while (iter && *iter) { GVariant *copy = g_dbus_proxy_get_cached_property (proxy, *iter); g_variant_builder_add (&builder, "{sv}", *iter++, copy); g_variant_unref (copy); } props = g_variant_builder_end (&builder); g_signal_emit (self, signals[NEW_BSS], 0, g_dbus_proxy_get_object_path (proxy), g_variant_ref_sink (props)); }
static void on_iface_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data) { NMSupplicantInterface *self; NMSupplicantInterfacePrivate *priv; gs_free_error GError *error = NULL; if (!g_async_initable_init_finish (G_ASYNC_INITABLE (proxy), result, &error)) { if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { nm_log_warn (LOGD_SUPPLICANT, "Failed to acquire wpa_supplicant interface proxy: (%s)", error->message); set_state (NM_SUPPLICANT_INTERFACE (user_data), NM_SUPPLICANT_INTERFACE_STATE_DOWN); } return; } self = NM_SUPPLICANT_INTERFACE (user_data); priv = NM_SUPPLICANT_INTERFACE_GET_PRIVATE (self); _nm_dbus_signal_connect (priv->iface_proxy, "ScanDone", G_VARIANT_TYPE ("(b)"), G_CALLBACK (wpas_iface_scan_done), self); _nm_dbus_signal_connect (priv->iface_proxy, "BSSAdded", G_VARIANT_TYPE ("(oa{sv})"), G_CALLBACK (wpas_iface_bss_added), self); _nm_dbus_signal_connect (priv->iface_proxy, "BSSRemoved", G_VARIANT_TYPE ("(o)"), G_CALLBACK (wpas_iface_bss_removed), self); _nm_dbus_signal_connect (priv->iface_proxy, "NetworkRequest", G_VARIANT_TYPE ("(oss)"), G_CALLBACK (wpas_iface_network_request), self); /* Scan result aging parameters */ g_dbus_proxy_call (priv->iface_proxy, "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", WPAS_DBUS_IFACE_INTERFACE, "BSSExpireAge", g_variant_new_uint32 (250)), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, NULL, NULL); g_dbus_proxy_call (priv->iface_proxy, "org.freedesktop.DBus.Properties.Set", g_variant_new ("(ssv)", WPAS_DBUS_IFACE_INTERFACE, "BSSExpireCount", g_variant_new_uint32 (2)), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, NULL, NULL); /* Check whether NetworkReply and AP mode are supported */ priv->ready_count = 1; g_dbus_proxy_call (priv->iface_proxy, "NetworkReply", g_variant_new ("(oss)", "/fff", "foobar", "foobar"), G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, (GAsyncReadyCallback) iface_check_netreply_cb, self); if (priv->ap_support == AP_SUPPORT_UNKNOWN) { /* If the global supplicant capabilities property is not present, we can * fall back to checking whether the ProbeRequest method is supported. If * neither of these works we have no way of determining if AP mode is * supported or not. hostap 1.0 and earlier don't support either of these. */ priv->ready_count++; g_dbus_proxy_call (priv->iface_proxy, DBUS_INTERFACE_INTROSPECTABLE ".Introspect", NULL, G_DBUS_CALL_FLAGS_NONE, -1, priv->init_cancellable, (GAsyncReadyCallback) iface_check_ap_mode_cb, self); } }