43
43
* evidence that the user is one of the requested identities.
45
45
* To register a #PolkitAgentListener with the PolicyKit daemon, use
46
* polkit_agent_listener_register().
46
* polkit_agent_listener_register() or
47
* polkit_agent_listener_register_with_options().
104
107
if (server->interface_info != NULL)
105
108
g_dbus_interface_info_unref (server->interface_info);
110
if (server->registration_options != NULL)
111
g_variant_unref (server->registration_options);
107
113
if (server->listener != NULL)
108
114
g_object_unref (server->listener);
143
149
locale = "en_US.UTF-8";
145
151
local_error = NULL;
146
if (!polkit_authority_register_authentication_agent_sync (server->authority,
152
if (!polkit_authority_register_authentication_agent_with_options_sync (server->authority,
156
server->registration_options,
153
160
g_warning ("Unable to register authentication agent: %s", local_error->message);
154
161
g_propagate_error (error, local_error);
363
* polkit_agent_listener_register:
370
* polkit_agent_listener_register_with_options:
364
371
* @listener: A #PolkitAgentListener.
365
372
* @flags: A set of flags from the #PolkitAgentRegisterFlags enumeration.
366
373
* @subject: The subject to become an authentication agent for, typically a #PolkitUnixSession object.
367
374
* @object_path: The D-Bus object path to use for the authentication agent or %NULL for the default object path.
375
* @options: (allow-none): A #GVariant with options or %NULL.
368
376
* @cancellable: A #GCancellable or %NULL.
369
377
* @error: Return location for error.
371
* Registers @listener with the PolicyKit daemon as an authentication
372
* agent for @subject. This is implemented by registering a D-Bus
373
* object at @object_path on the unique name assigned by the system
376
* Whenever the PolicyKit daemon needs to authenticate a processes
377
* that is related to @subject, the methods
378
* polkit_agent_listener_initiate_authentication() and
379
* polkit_agent_listener_initiate_authentication_finish() will be
380
* invoked on @listener.
382
* Note that registration of an authentication agent can fail; for
383
* example another authentication agent may already be registered for
386
* Note that the calling thread is blocked until a reply is received.
379
* Like polkit_agent_listener_register() but takes options to influence registration. See the
380
* <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgentWithOptions">RegisterAuthenticationAgentWithOptions()</link> D-Bus method for details.
388
382
* Returns: (transfer full): %NULL if @error is set, otherwise a
389
383
* registration handle that can be used with
390
384
* polkit_agent_listener_unregister().
393
polkit_agent_listener_register (PolkitAgentListener *listener,
394
PolkitAgentRegisterFlags flags,
395
PolkitSubject *subject,
396
const gchar *object_path,
397
GCancellable *cancellable,
387
polkit_agent_listener_register_with_options (PolkitAgentListener *listener,
388
PolkitAgentRegisterFlags flags,
389
PolkitSubject *subject,
390
const gchar *object_path,
392
GCancellable *cancellable,
401
396
GDBusNodeInfo *node_info;
426
421
server->listener = g_object_ref (listener);
423
server->registration_options = options != NULL ? g_variant_ref_sink (options) : NULL;
428
425
if (flags & POLKIT_AGENT_REGISTER_FLAGS_RUN_IN_THREAD)
430
427
server->thread = g_thread_create (server_thread_func,
472
* polkit_agent_listener_register:
473
* @listener: A #PolkitAgentListener.
474
* @flags: A set of flags from the #PolkitAgentRegisterFlags enumeration.
475
* @subject: The subject to become an authentication agent for, typically a #PolkitUnixSession object.
476
* @object_path: The D-Bus object path to use for the authentication agent or %NULL for the default object path.
477
* @cancellable: A #GCancellable or %NULL.
478
* @error: Return location for error.
480
* Registers @listener with the PolicyKit daemon as an authentication
481
* agent for @subject. This is implemented by registering a D-Bus
482
* object at @object_path on the unique name assigned by the system
485
* Whenever the PolicyKit daemon needs to authenticate a processes
486
* that is related to @subject, the methods
487
* polkit_agent_listener_initiate_authentication() and
488
* polkit_agent_listener_initiate_authentication_finish() will be
489
* invoked on @listener.
491
* Note that registration of an authentication agent can fail; for
492
* example another authentication agent may already be registered for
495
* Note that the calling thread is blocked until a reply is received.
497
* Returns: (transfer full): %NULL if @error is set, otherwise a
498
* registration handle that can be used with
499
* polkit_agent_listener_unregister().
502
polkit_agent_listener_register (PolkitAgentListener *listener,
503
PolkitAgentRegisterFlags flags,
504
PolkitSubject *subject,
505
const gchar *object_path,
506
GCancellable *cancellable,
509
return polkit_agent_listener_register_with_options (listener, flags, subject, object_path, NULL, cancellable, error);
475
513
* polkit_agent_listener_unregister:
476
514
* @registration_handle: A handle obtained from polkit_agent_listener_register().