2007-07-27 20:15:31 +02:00
|
|
|
/* -*- Mode: C; c-basic-offset: 4 -*- */
|
|
|
|
%%
|
|
|
|
headers
|
|
|
|
#include <Python.h>
|
|
|
|
|
|
|
|
#include "pygobject.h"
|
|
|
|
#include "sugar-address-entry.h"
|
2008-09-10 18:29:19 +02:00
|
|
|
#include "sugar-grid.h"
|
2007-07-27 20:15:31 +02:00
|
|
|
#include "sugar-key-grabber.h"
|
|
|
|
#include "sugar-menu.h"
|
2007-08-20 13:03:17 +02:00
|
|
|
#include "sexy-icon-entry.h"
|
2008-06-06 21:39:50 +02:00
|
|
|
#include "gsm-session.h"
|
2008-08-12 01:53:28 +02:00
|
|
|
#include "gsm-xsmp.h"
|
2008-09-13 13:45:47 +02:00
|
|
|
#include "acme-volume-alsa.h"
|
2008-06-06 19:13:10 +02:00
|
|
|
|
|
|
|
#include "eggsmclient.h"
|
|
|
|
#include "eggsmclient-private.h"
|
2007-07-27 20:15:31 +02:00
|
|
|
|
|
|
|
#include <pygtk/pygtk.h>
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
%%
|
2008-04-18 20:23:45 +02:00
|
|
|
modulename sugar._sugarext
|
2007-07-27 20:15:31 +02:00
|
|
|
%%
|
|
|
|
import gobject.GObject as PyGObject_Type
|
2008-08-31 14:40:03 +02:00
|
|
|
import gtk.Widget as PyGtkWidget_Type
|
2007-07-27 20:15:31 +02:00
|
|
|
import gtk.Entry as PyGtkEntry_Type
|
|
|
|
import gtk.Menu as PyGtkMenu_Type
|
2007-08-08 03:07:00 +02:00
|
|
|
import gtk.Container as PyGtkContainer_Type
|
2007-07-27 20:15:31 +02:00
|
|
|
import gtk.gdk.Window as PyGdkWindow_Type
|
2007-08-20 13:03:17 +02:00
|
|
|
import gtk.Image as PyGtkImage_Type
|
2007-07-27 20:15:31 +02:00
|
|
|
%%
|
|
|
|
ignore-glob
|
|
|
|
*_get_type
|
|
|
|
_*
|
|
|
|
%%
|
2008-08-24 14:31:46 +02:00
|
|
|
override sugar_key_grabber_grab_keys kwargs
|
|
|
|
static PyObject *
|
|
|
|
_wrap_sugar_key_grabber_grab_keys(PyGObject *self, PyObject *args, PyObject *kwargs)
|
|
|
|
{
|
|
|
|
static char *kwlist[] = { "key", NULL };
|
|
|
|
PyObject *py_keys;
|
|
|
|
char **keys;
|
|
|
|
int i, len;
|
|
|
|
|
|
|
|
if (!PyArg_ParseTupleAndKeywords(args,kwargs,
|
|
|
|
"O:SugarKeyGrabber.grab_keys",
|
|
|
|
kwlist, &py_keys))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (!PySequence_Check(py_keys) || (len = PySequence_Size(py_keys)) < 0) {
|
|
|
|
PyErr_SetString(PyExc_ValueError,
|
|
|
|
"keys should be a sequence of strings");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
keys = g_new(char*, len + 1);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
PyObject *item = PySequence_GetItem(py_keys, i);
|
|
|
|
if (!item) {
|
|
|
|
g_free(keys);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!PyString_Check(item)) {
|
|
|
|
PyErr_SetString(PyExc_TypeError, "key must be a string");
|
|
|
|
g_free(keys);
|
|
|
|
Py_DECREF(item);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
keys[i] = PyString_AsString(item);
|
|
|
|
Py_DECREF(item);
|
|
|
|
}
|
|
|
|
keys[len] = NULL;
|
|
|
|
|
|
|
|
sugar_key_grabber_grab_keys (SUGAR_KEY_GRABBER(self->obj), (const char**) keys);
|
|
|
|
|
|
|
|
Py_INCREF(Py_None);
|
|
|
|
return Py_None;
|
|
|
|
}
|
|
|
|
|
|
|
|
%%
|