Add untested loginHelper implementation
authorMike Gorse <mgorse@boston.site>
Thu, 3 Jul 2008 21:34:46 +0000 (17:34 -0400)
committerMike Gorse <mgorse@boston.site>
Thu, 3 Jul 2008 21:34:46 +0000 (17:34 -0400)
Makefile.am
configure.ac
login-helper/Makefile.am [new file with mode: 0644]
login-helper/login-helper.c [new file with mode: 0644]
login-helper/login-helper.h [new file with mode: 0644]
xml/org.freedesktop.atspi.LoginHelper.xml

index 2c07f8f..fed5187 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS=xml tools droute spi-common atk-adaptor registryd dbind cspi tests po
+SUBDIRS=xml tools droute spi-common atk-adaptor registryd dbind cspi login-helper tests po
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libspi-1.0.pc cspi-1.0.pc
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libspi-1.0.pc cspi-1.0.pc
index 15a9fec..7110dc2 100644 (file)
@@ -33,6 +33,16 @@ AM_DISABLE_STATIC
 AM_PROG_LIBTOOL
 PKG_PROG_PKG_CONFIG
 
 AM_PROG_LIBTOOL
 PKG_PROG_PKG_CONFIG
 
+GETTEXT_PACKAGE="${PACKAGE}"
+AC_SUBST(GETTEXT_PACKAGE)
+dnl internationalization support; uncomment if translatable strings are reintroduced
+AM_GLIB_GNU_GETTEXT
+
+# AM_GLIB_GNU_GETTEXT above subst. $DATADIRNAME
+# this is the directory where the *.{mo,gmo} files are installed
+localedir='${prefix}/${DATADIRNAME}/locale'
+AC_SUBST(localedir)
+
 AC_CONFIG_HEADERS([config.h])
 
 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
 AC_CONFIG_HEADERS([config.h])
 
 PKG_CHECK_MODULES(DBUS, [dbus-1 >= 1.0])
@@ -162,6 +172,11 @@ LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^cspi]].*"'
 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
 
 AC_CONFIG_FILES([Makefile
 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
 
 AC_CONFIG_FILES([Makefile
+                po/Makefile.in
+                libspi-1.0.pc
+                libspi-1.0-uninstalled.pc
+                cspi-1.0.pc
+                cspi-1.0-uninstalled.pc
                 xml/Makefile
                 tests/Makefile
                 tools/Makefile
                 xml/Makefile
                 tests/Makefile
                 tools/Makefile
@@ -169,6 +184,7 @@ AC_CONFIG_FILES([Makefile
                 spi-common/Makefile
                 registryd/Makefile
                 atk-adaptor/Makefile
                 spi-common/Makefile
                 registryd/Makefile
                 atk-adaptor/Makefile
+                login-helper/Makefile
                 tests/dummyatk/Makefile
                 tests/clients/Makefile
                 tests/apps/Makefile
                 tests/dummyatk/Makefile
                 tests/clients/Makefile
                 tests/apps/Makefile
diff --git a/login-helper/Makefile.am b/login-helper/Makefile.am
new file mode 100644 (file)
index 0000000..d314072
--- /dev/null
@@ -0,0 +1,22 @@
+lib_LTLIBRARIES = libloginhelper.la
+
+LDADD = $(X_LIBS) $(LOGIN_HELPER_LIBS) 
+
+INCLUDES = -I$(top_srcdir)          \
+           -I$(top_builddir)        \
+          $(WARN_CFLAGS)       \
+           $(DBUS_GLIB_CFLAGS)
+
+libloginhelperincludedir = $(includedir)/at-spi-1.0/login-helper
+
+libloginhelper_la_LDFLAGS = -no-undefined
+libloginhelper_la_LIBADD = \
+       $(top_builddir)/spi-common/libspicommon.la \
+       $(top_builddir)/droute/libdroute.la \
+       $(X_LIBS)
+
+libloginhelperinclude_HEADERS = \
+       login-helper.h                  
+
+libloginhelper_la_SOURCES =            \
+       login-helper.c
diff --git a/login-helper/login-helper.c b/login-helper/login-helper.c
new file mode 100644 (file)
index 0000000..20fa9b0
--- /dev/null
@@ -0,0 +1,163 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * LoginHelper interface 
+ * Copyright 2004 Sun Microsystems Inc.,
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+/* login-helper.c: minimal implementation of Accessibility_LoginHelper.idl */
+#include <config.h>
+#include "login-helper.h"
+#include "spi-common/spi-dbus.h"
+#include "droute/droute.h"
+
+/* Our parent Gtk object type */
+#define PARENT_TYPE G_TYPE_OBJECT
+
+/* A pointer to our parent object class */
+static GObjectClass *g_object_parent_class;
+
+static void
+login_helper_finalize (GObject *object)
+{
+  (G_OBJECT_CLASS (g_object_parent_class))->finalize (object);
+}
+
+static gboolean
+login_helper_set_safe (LoginHelper *helper, gboolean safe)
+{
+  LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
+  
+  if (klass->set_safe)
+    return (* klass->set_safe)(helper, safe);
+  else
+    return FALSE;
+}
+
+static DBusMessage *
+impl_set_safe (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  LoginHelper *helper = user_data;
+
+  DBusError error;
+  dbus_bool_t safe;
+  dbus_bool_t rv;
+  DBusMessage *reply;
+
+  dbus_error_init (&error);
+  if (!dbus_message_get_args
+      (message, &error, DBUS_TYPE_BOOLEAN, &safe, DBUS_TYPE_INVALID))
+    {
+      return SPI_DBUS_RETURN_ERROR (message, &error);
+    }
+  rv = login_helper_set_safe (helper, safe);
+  reply = dbus_message_new_method_return (message);
+  if (reply)
+    {
+      dbus_message_append_args (reply, DBUS_TYPE_BOOLEAN, &rv, DBUS_TYPE_INVALID);
+    }
+  return reply;
+}
+
+static LoginHelperDeviceReqFlags
+login_helper_get_device_reqs (LoginHelper *helper)
+{
+  LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
+  
+  if (klass->get_device_reqs)
+    return  (* klass->get_device_reqs)(helper);
+  else
+    return 0;
+}
+
+static DBusMessage *
+impl_get_device_reqs (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  LoginHelper *helper = user_data;
+  dbus_uint32_t flags = 0;
+  DBusMessage *reply;
+
+  flags = login_helper_get_device_reqs (helper);
+
+  reply = dbus_message_new_method_return (message);
+  if (reply)
+    {
+      dbus_message_append_args (reply, DBUS_TYPE_UINT32, &flags, DBUS_TYPE_INVALID);
+    }
+  return reply;
+}
+
+static Window*
+login_helper_get_raise_windows (LoginHelper *helper)
+{
+  LoginHelperClass *klass = LOGIN_HELPER_GET_CLASS (helper);
+  
+  if (klass->get_raise_windows)
+    return (* klass->get_raise_windows)(helper);
+  else
+    return NULL;
+}
+
+static DBusMessage *
+impl_get_raise_windows (DBusConnection *bus, DBusMessage *message, void *user_data)
+{
+  LoginHelper *helper = user_data;
+  unsigned long *wids;
+  gint count = 0;
+  DBusMessage *reply;
+  DBusMessageIter iter, iter_array;
+
+  wids = login_helper_get_raise_windows (helper);
+  reply = dbus_message_new_method_return (message);
+  if (!reply) return NULL;
+  dbus_message_iter_init_append (message, &iter);
+  if (dbus_message_iter_open_container (&iter, DBUS_TYPE_ARRAY, "i", &iter_array) && wids)
+  {
+    while (*wids)
+    {
+      // TODO: figure out if this will break on 64-bit systems
+      dbus_int32_t id = *wids++;
+      dbus_message_iter_append_basic (&iter_array, DBUS_TYPE_INT32, &id);
+    }
+    dbus_message_iter_close_container (&iter, &iter_array);
+  }
+  if (wids) g_free (wids);
+  return reply;
+}
+
+static void
+login_helper_class_init (LoginHelperClass *klass)
+{
+  GObjectClass * object_class = (GObjectClass *) klass;
+
+  g_object_parent_class = g_type_class_peek_parent (klass);
+
+  object_class->finalize = login_helper_finalize;
+  
+}
+
+static void
+login_helper_init (LoginHelper *object)
+{
+}
+
+G_DEFINE_TYPE (LoginHelper,
+                      login_helper,
+                      PARENT_TYPE)
+
diff --git a/login-helper/login-helper.h b/login-helper/login-helper.h
new file mode 100644 (file)
index 0000000..a81c378
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * LoginHelper
+ *
+ * Copyright 2004 Sun Microsystems Inc.,
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library 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.
+ */
+
+#ifndef LOGIN_HELPER_H_
+#define LOGIN_HELPER_H_
+
+#include <glib.h>
+#include <glib-object.h>
+//#include <login-helper/Accessibility_LoginHelper.h>
+#include <X11/X.h>
+
+G_BEGIN_DECLS
+
+typedef struct _LoginHelper LoginHelper;
+typedef struct _LoginHelperClass LoginHelperClass;
+
+#define LOGIN_HELPER_TYPE        (login_helper_get_type ())
+#define LOGIN_HELPER(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), LOGIN_HELPER_TYPE, LoginHelper))
+#define LOGIN_HELPER_CLASS(k)    (G_TYPE_CHECK_CLASS_CAST((k), LOGIN_HELPER_TYPE, LoginHelperClass))
+#define LOGIN_HELPER_GET_CLASS(o)    (G_TYPE_INSTANCE_GET_CLASS((o), LOGIN_HELPER_TYPE, LoginHelperClass))
+#define IS_LOGIN_HELPER(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), LOGIN_HELPER_TYPE))
+#define IS_LOGIN_HELPER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), LOGIN_HELPER_TYPE))
+
+struct _LoginHelper {
+  GObject      parent;
+
+};
+
+typedef unsigned long LoginHelperDeviceReqFlags;
+
+#define LOGIN_HELPER_GUI_EVENTS 1
+#define LOGIN_HELPER_CORE_KEYBOARD 2
+#define LOGIN_HELPER_CORE_POINTER 4
+#define LOGIN_HELPER_EXT_INPUT 8
+#define LOGIN_HELPER_POST_WINDOWS 16
+#define LOGIN_HELPER_AUDIO_OUT 32
+#define LOGIN_HELPER_AUDIO_IN 64
+#define LOGIN_HELPER_NETWORK 128
+#define LOGIN_HELPER_LOCALHOST 256 
+#define LOGIN_HELPER_SERIAL_OUT 512
+#define LOGIN_HELPER_SERIAL_IN 1024
+#define LOGIN_HELPER_LAST_DEFINED 2048
+
+struct _LoginHelperClass {
+  GObjectClass parent_class;
+
+  gboolean (*set_safe) (LoginHelper *helper, gboolean safe);
+  LoginHelperDeviceReqFlags (*get_device_reqs) (LoginHelper *helper);
+  Window*  (*get_raise_windows) (LoginHelper *helper); 
+};
+
+GType        login_helper_get_type (void) G_GNUC_CONST;
+LoginHelper *login_helper_new      (void);
+
+G_END_DECLS
+
+#endif /* LOGIN_HELPER_H */
index 21d199b..3c26904 100644 (file)
         events will include 
         Accessibility_LoginHelper_CORE_KEYBOARD in this list.    </p>
     </tp:docstring>
         events will include 
         Accessibility_LoginHelper_CORE_KEYBOARD in this list.    </p>
     </tp:docstring>
-    <arg direction="out" type="au" tp:type="DeviceReqList">
+    <arg direction="out" type="u" tp:type="DeviceReqList">
     <tp:docstring>
       A sequence of ::LoginHelper_DeviceReq indicatingthe device I/O required in order to facilitate end-user access to the system.
     </tp:docstring>
     <tp:docstring>
       A sequence of ::LoginHelper_DeviceReq indicatingthe device I/O required in order to facilitate end-user access to the system.
     </tp:docstring>
 
       <p>Get a list of window IDs that need raising on login.     </p>
     </tp:docstring>
 
       <p>Get a list of window IDs that need raising on login.     </p>
     </tp:docstring>
-    <arg direction="out" type="a(i)" tp:type="WindowList">
+    <arg direction="out" type="ai" tp:type="WindowList">
     <tp:docstring>
       a sequence containing window IDS for toplevels whichneed to be raised/made visible during user authentication, inorder for the ::LoginHelper to facilitate end-user access to the system.
     </tp:docstring>
     <tp:docstring>
       a sequence containing window IDS for toplevels whichneed to be raised/made visible during user authentication, inorder for the ::LoginHelper to facilitate end-user access to the system.
     </tp:docstring>