mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
Update an example to the latest auth observer api
This commit is contained in:
parent
371a3373bb
commit
7c0196f026
@ -51,12 +51,18 @@
|
|||||||
* GCredentials *credentials,
|
* GCredentials *credentials,
|
||||||
* gpointer user_data)
|
* gpointer user_data)
|
||||||
* {
|
* {
|
||||||
|
* GCredentials *me;
|
||||||
* gboolean deny;
|
* gboolean deny;
|
||||||
|
*
|
||||||
* deny = TRUE;
|
* deny = TRUE;
|
||||||
|
* me = g_credentials_new ();
|
||||||
|
*
|
||||||
* if (credentials != NULL &&
|
* if (credentials != NULL &&
|
||||||
* g_credentials_has_unix_user (credentials) &&
|
* !g_credentials_is_same_user (credentials, me))
|
||||||
* g_credentials_get_unix_user (credentials) == getuid ())
|
|
||||||
* deny = FALSE;
|
* deny = FALSE;
|
||||||
|
*
|
||||||
|
* g_object_unref (me);
|
||||||
|
*
|
||||||
* return deny;
|
* return deny;
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
@ -114,10 +120,7 @@ G_DEFINE_TYPE (GDBusAuthObserver, g_dbus_auth_observer, G_TYPE_OBJECT);
|
|||||||
static void
|
static void
|
||||||
g_dbus_auth_observer_finalize (GObject *object)
|
g_dbus_auth_observer_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
//GDBusAuthObserver *observer = G_DBUS_AUTH_OBSERVER (object);
|
G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize (object);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize != NULL)
|
|
||||||
G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize (object);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -133,7 +136,7 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
|
|||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->finalize = g_dbus_auth_observer_finalize;
|
gobject_class->finalize = g_dbus_auth_observer_finalize;
|
||||||
|
|
||||||
klass->deny_authenticated_peer = g_dbus_auth_observer_deny_authenticated_peer_real;
|
klass->deny_authenticated_peer = g_dbus_auth_observer_deny_authenticated_peer_real;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@
|
|||||||
*
|
*
|
||||||
* - GDBusProxy subclass example
|
* - GDBusProxy subclass example
|
||||||
*
|
*
|
||||||
* - Update GDBusAuthObserver (is_same_user(), s/deny/authorize/)
|
* - Update GDBusAuthObserver (s/deny/authorize/)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user