static void ensure_credentials_cb (GoaProvider *provider, GAsyncResult *res, gpointer user_data) { EnsureData *data = user_data; gint expires_in; GError *error; error= NULL; if (!goa_provider_ensure_credentials_finish (provider, &expires_in, res, &error)) { /* Set AttentionNeeded only if the error is an authorization error */ if (is_authorization_error (error)) { GoaAccount *account; account = goa_object_peek_account (data->object); if (!goa_account_get_attention_needed (account)) { goa_account_set_attention_needed (account, TRUE); g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account)); g_message ("%s: Setting AttentionNeeded to TRUE because EnsureCredentials() failed with: %s (%s, %d)", g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)), error->message, g_quark_to_string (error->domain), error->code); } } g_dbus_method_invocation_return_gerror (data->invocation, error); g_error_free (error); } else { GoaAccount *account; account = goa_object_peek_account (data->object); /* Clear AttentionNeeded flag if set */ if (goa_account_get_attention_needed (account)) { goa_account_set_attention_needed (account, FALSE); g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (account)); g_message ("%s: Setting AttentionNeeded to FALSE because EnsureCredentials() succeded\n", g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object))); } goa_account_complete_ensure_credentials (goa_object_peek_account (data->object), data->invocation, expires_in); } ensure_data_unref (data); }
static gboolean on_handle_request_property_mods (TestFrobber *object, GDBusMethodInvocation *invocation, gpointer user_data) { test_frobber_set_y (object, test_frobber_get_y (object) + 1); test_frobber_set_i (object, test_frobber_get_i (object) + 1); g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (object)); test_frobber_complete_request_multi_property_mods (object, invocation); return TRUE; }
/** * g_dbus_object_skeleton_flush: * @object: A #GDBusObjectSkeleton. * * This method simply calls g_dbus_interface_skeleton_flush() on all * interfaces belonging to @object. See that method for when flushing * is useful. * * Since: 2.30 */ void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object) { GList *to_flush, *l; g_mutex_lock (object->priv->lock); to_flush = g_hash_table_get_values (object->priv->map_name_to_iface); g_list_foreach (to_flush, (GFunc) g_object_ref, NULL); g_mutex_unlock (object->priv->lock); for (l = to_flush; l != NULL; l = l->next) g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (l->data)); g_list_foreach (to_flush, (GFunc) g_object_unref, NULL); g_list_free (to_flush); }
static gboolean on_handle_property_cancellation (TestFrobber *object, GDBusMethodInvocation *invocation, gpointer user_data) { guint n; n = test_frobber_get_n (object); /* This queues up a PropertiesChange event */ test_frobber_set_n (object, n + 1); /* this modifies the queued up event */ test_frobber_set_n (object, n); /* this flushes all PropertiesChanges event (sends the D-Bus message right * away, if any - there should not be any) */ g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (object)); /* this makes us return the reply D-Bus method */ test_frobber_complete_property_cancellation (object, invocation); return TRUE; }