forgot to add local backend impl
authorDavid Zeuthen <davidz@redhat.com>
Wed, 3 Dec 2008 19:01:12 +0000 (14:01 -0500)
committerDavid Zeuthen <davidz@redhat.com>
Wed, 3 Dec 2008 19:01:12 +0000 (14:01 -0500)
src/polkitbackend/polkitbackendlocal.c [new file with mode: 0644]
src/polkitbackend/polkitbackendlocal.h [new file with mode: 0644]

diff --git a/src/polkitbackend/polkitbackendlocal.c b/src/polkitbackend/polkitbackendlocal.c
new file mode 100644 (file)
index 0000000..044cc15
--- /dev/null
@@ -0,0 +1,109 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#include "config.h"
+#include <polkit/polkit.h>
+#include "polkitbackendlocal.h"
+
+/* TODO: locking */
+
+typedef struct
+{
+        guint foo;
+} PolkitBackendLocalPrivate;
+
+static void authority_iface_init (PolkitAuthorityIface *authority_iface,
+                                  gpointer              iface_data);
+
+G_DEFINE_TYPE_WITH_CODE (PolkitBackendLocal, polkit_backend_local, G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (POLKIT_TYPE_AUTHORITY,
+                                                authority_iface_init)
+                         );
+
+#define POLKIT_BACKEND_LOCAL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), POLKIT_TYPE_BACKEND_LOCAL, PolkitBackendLocalPrivate))
+
+static void
+polkit_backend_local_finalize (GObject *object)
+{
+        PolkitBackendLocal *backend;
+        PolkitBackendLocalPrivate *priv;
+
+        backend = POLKIT_BACKEND_LOCAL (object);
+        priv = POLKIT_BACKEND_LOCAL_GET_PRIVATE (backend);
+
+        G_OBJECT_CLASS (polkit_backend_local_parent_class)->finalize (object);
+}
+
+static void
+polkit_backend_local_class_init (PolkitBackendLocalClass *klass)
+{
+        GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+        gobject_class->finalize = polkit_backend_local_finalize;
+
+        g_type_class_add_private (klass, sizeof (PolkitBackendLocalPrivate));
+}
+
+
+static void
+polkit_backend_local_init (PolkitBackendLocal *backend)
+{
+        PolkitBackendLocalPrivate *priv;
+
+        priv = POLKIT_BACKEND_LOCAL_GET_PRIVATE (backend);
+}
+
+PolkitBackendLocal *
+polkit_backend_local_new (void)
+{
+        PolkitBackendLocal *backend;
+
+        backend = POLKIT_BACKEND_LOCAL (g_object_new (POLKIT_TYPE_BACKEND_LOCAL,
+                                                      NULL));
+
+        return backend;
+}
+
+static void
+authority_iface_handle_say_hello (PolkitAuthority *instance,
+                                  const gchar *message,
+                                  EggDBusMethodInvocation *method_invocation)
+{
+        gchar *result;
+
+        result = g_strdup_printf ("You said '%s' to the AUTHORITY!", message);
+
+        polkit_authority_handle_say_hello_finish (instance,
+                                                  result,
+                                                  method_invocation);
+
+        g_free (result);
+}
+
+
+static void
+authority_iface_init (PolkitAuthorityIface *authority_iface,
+                      gpointer              iface_data)
+{
+        authority_iface->handle_say_hello = authority_iface_handle_say_hello;
+}
diff --git a/src/polkitbackend/polkitbackendlocal.h b/src/polkitbackend/polkitbackendlocal.h
new file mode 100644 (file)
index 0000000..50332e1
--- /dev/null
@@ -0,0 +1,75 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz@redhat.com>
+ */
+
+#if !defined (_POLKIT_BACKEND_COMPILATION) && !defined(_POLKIT_BACKEND_INSIDE_POLKIT_BACKEND_H)
+#error "Only <polkitbackend/polkitbackend.h> can be included directly, this file may disappear or change contents."
+#endif
+
+#include <glib-object.h>
+
+#ifndef __POLKIT_BACKEND_LOCAL_H
+#define __POLKIT_BACKEND_LOCAL_H
+
+G_BEGIN_DECLS
+
+#define POLKIT_TYPE_BACKEND_LOCAL         (polkit_backend_local_get_type ())
+#define POLKIT_BACKEND_LOCAL(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), POLKIT_TYPE_BACKEND_LOCAL, PolkitBackendLocal))
+#define POLKIT_BACKEND_LOCAL_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), POLKIT_TYPE_BACKEND_LOCAL, PolkitBackendLocalClass))
+#define POLKIT_BACKEND_LOCAL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), POLKIT_TYPE_BACKEND_LOCAL,PolkitBackendLocalClass))
+#define POLKIT_IS_BACKEND_LOCAL(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), POLKIT_TYPE_BACKEND_LOCAL))
+#define POLKIT_IS_BACKEND_LOCAL_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), POLKIT_TYPE_BACKEND_LOCAL))
+
+typedef struct _PolkitBackendLocal         PolkitBackendLocal;
+typedef struct _PolkitBackendLocalClass    PolkitBackendLocalClass;
+
+struct _PolkitBackendLocal
+{
+        GObject parent_instance;
+};
+
+struct _PolkitBackendLocalClass
+{
+        GObjectClass parent_class;
+
+        /*< public >*/
+
+        /*< private >*/
+        /* Padding for future expansion */
+        void (*_polkit_reserved1) (void);
+        void (*_polkit_reserved2) (void);
+        void (*_polkit_reserved3) (void);
+        void (*_polkit_reserved4) (void);
+        void (*_polkit_reserved5) (void);
+        void (*_polkit_reserved6) (void);
+        void (*_polkit_reserved7) (void);
+        void (*_polkit_reserved8) (void);
+};
+
+GType               polkit_backend_local_get_type (void) G_GNUC_CONST;
+
+PolkitBackendLocal *polkit_backend_local_new      (void);
+
+G_END_DECLS
+
+#endif /* __POLKIT_BACKEND_LOCAL_H */
+