tray-manager with bindings, adapted from gnome-panel
This commit is contained in:
parent
781988589a
commit
0d2caab8a1
4
.gitignore
vendored
4
.gitignore
vendored
@ -48,3 +48,7 @@ libtool
|
||||
ltmain.sh
|
||||
m4/intltool.m4
|
||||
lib/src/_sugar.c
|
||||
lib/src/sugar-marshal.c
|
||||
lib/src/sugar-marshal.h
|
||||
lib/src/stamp-sugar-marshal.c
|
||||
lib/src/stamp-sugar-marshal.h
|
||||
|
@ -16,6 +16,8 @@ AM_MAINTAINER_MODE
|
||||
AC_DISABLE_STATIC
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
|
||||
|
||||
AM_PATH_PYTHON
|
||||
AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
|
||||
|
||||
|
@ -11,8 +11,9 @@
|
||||
#include "sugar-browser.h"
|
||||
#include "sugar-key-grabber.h"
|
||||
#include "sugar-address-entry.h"
|
||||
#include "sugar-tray-manager.h"
|
||||
|
||||
#line 16 "_sugar.c"
|
||||
#line 17 "_sugar.c"
|
||||
|
||||
|
||||
/* ---------- types from other modules ---------- */
|
||||
@ -28,8 +29,9 @@ static PyTypeObject *_PyGtkMozEmbed_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarAddressEntry_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarBrowser_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarKeyGrabber_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarTrayManager_Type;
|
||||
|
||||
#line 33 "_sugar.c"
|
||||
#line 35 "_sugar.c"
|
||||
|
||||
|
||||
|
||||
@ -219,6 +221,112 @@ PyTypeObject G_GNUC_INTERNAL PySugarKeyGrabber_Type = {
|
||||
|
||||
|
||||
|
||||
/* ----------- SugarTrayManager ----------- */
|
||||
|
||||
static int
|
||||
_wrap_sugar_tray_manager_new(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char* kwlist[] = { NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
":gecko.TrayManager.__init__",
|
||||
kwlist))
|
||||
return -1;
|
||||
|
||||
pygobject_constructv(self, 0, NULL);
|
||||
if (!self->obj) {
|
||||
PyErr_SetString(
|
||||
PyExc_RuntimeError,
|
||||
"could not create gecko.TrayManager object");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wrap_sugar_tray_manager_set_orientation(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "orientation", NULL };
|
||||
GtkOrientation orientation;
|
||||
PyObject *py_orientation = NULL;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:SugarTrayManager.set_orientation", kwlist, &py_orientation))
|
||||
return NULL;
|
||||
if (pyg_enum_get_value(GTK_TYPE_ORIENTATION, py_orientation, (gpointer)&orientation))
|
||||
return NULL;
|
||||
|
||||
sugar_tray_manager_set_orientation(SUGAR_TRAY_MANAGER(self->obj), orientation);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wrap_sugar_tray_manager_get_orientation(PyGObject *self)
|
||||
{
|
||||
gint ret;
|
||||
|
||||
|
||||
ret = sugar_tray_manager_get_orientation(SUGAR_TRAY_MANAGER(self->obj));
|
||||
|
||||
return pyg_enum_from_gtype(GTK_TYPE_ORIENTATION, ret);
|
||||
}
|
||||
|
||||
static const PyMethodDef _PySugarTrayManager_methods[] = {
|
||||
{ "set_orientation", (PyCFunction)_wrap_sugar_tray_manager_set_orientation, METH_VARARGS|METH_KEYWORDS,
|
||||
NULL },
|
||||
{ "get_orientation", (PyCFunction)_wrap_sugar_tray_manager_get_orientation, METH_NOARGS,
|
||||
NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarTrayManager_Type = {
|
||||
PyObject_HEAD_INIT(NULL)
|
||||
0, /* ob_size */
|
||||
"gecko.TrayManager", /* tp_name */
|
||||
sizeof(PyGObject), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
/* methods */
|
||||
(destructor)0, /* tp_dealloc */
|
||||
(printfunc)0, /* tp_print */
|
||||
(getattrfunc)0, /* tp_getattr */
|
||||
(setattrfunc)0, /* tp_setattr */
|
||||
(cmpfunc)0, /* tp_compare */
|
||||
(reprfunc)0, /* tp_repr */
|
||||
(PyNumberMethods*)0, /* tp_as_number */
|
||||
(PySequenceMethods*)0, /* tp_as_sequence */
|
||||
(PyMappingMethods*)0, /* tp_as_mapping */
|
||||
(hashfunc)0, /* tp_hash */
|
||||
(ternaryfunc)0, /* tp_call */
|
||||
(reprfunc)0, /* tp_str */
|
||||
(getattrofunc)0, /* tp_getattro */
|
||||
(setattrofunc)0, /* tp_setattro */
|
||||
(PyBufferProcs*)0, /* tp_as_buffer */
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
|
||||
NULL, /* Documentation string */
|
||||
(traverseproc)0, /* tp_traverse */
|
||||
(inquiry)0, /* tp_clear */
|
||||
(richcmpfunc)0, /* tp_richcompare */
|
||||
offsetof(PyGObject, weakreflist), /* tp_weaklistoffset */
|
||||
(getiterfunc)0, /* tp_iter */
|
||||
(iternextfunc)0, /* tp_iternext */
|
||||
(struct PyMethodDef*)_PySugarTrayManager_methods, /* tp_methods */
|
||||
(struct PyMemberDef*)0, /* tp_members */
|
||||
(struct PyGetSetDef*)0, /* tp_getset */
|
||||
NULL, /* tp_base */
|
||||
NULL, /* tp_dict */
|
||||
(descrgetfunc)0, /* tp_descr_get */
|
||||
(descrsetfunc)0, /* tp_descr_set */
|
||||
offsetof(PyGObject, inst_dict), /* tp_dictoffset */
|
||||
(initproc)_wrap_sugar_tray_manager_new, /* tp_init */
|
||||
(allocfunc)0, /* tp_alloc */
|
||||
(newfunc)0, /* tp_new */
|
||||
(freefunc)0, /* tp_free */
|
||||
(inquiry)0 /* tp_is_gc */
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* ----------- functions ----------- */
|
||||
|
||||
static PyObject *
|
||||
@ -281,9 +389,11 @@ py_sugar_register_classes(PyObject *d)
|
||||
}
|
||||
|
||||
|
||||
#line 285 "_sugar.c"
|
||||
#line 393 "_sugar.c"
|
||||
pygobject_register_class(d, "SugarAddressEntry", SUGAR_TYPE_ADDRESS_ENTRY, &PySugarAddressEntry_Type, Py_BuildValue("(O)", &PyGtkEntry_Type));
|
||||
pygobject_register_class(d, "SugarBrowser", SUGAR_TYPE_BROWSER, &PySugarBrowser_Type, Py_BuildValue("(O)", &PyGtkMozEmbed_Type));
|
||||
pygobject_register_class(d, "SugarKeyGrabber", SUGAR_TYPE_KEY_GRABBER, &PySugarKeyGrabber_Type, Py_BuildValue("(O)", &PyGObject_Type));
|
||||
pyg_set_object_has_new_constructor(SUGAR_TYPE_KEY_GRABBER);
|
||||
pygobject_register_class(d, "SugarTrayManager", SUGAR_TYPE_TRAY_MANAGER, &PySugarTrayManager_Type, Py_BuildValue("(O)", &PyGObject_Type));
|
||||
pyg_set_object_has_new_constructor(SUGAR_TYPE_TRAY_MANAGER);
|
||||
}
|
||||
|
@ -70,3 +70,70 @@
|
||||
)
|
||||
|
||||
|
||||
;; -*- scheme -*-
|
||||
; object definitions ...
|
||||
(define-object TrayManager
|
||||
(in-module "Sugar")
|
||||
(parent "GObject")
|
||||
(c-name "SugarTrayManager")
|
||||
(gtype-id "SUGAR_TYPE_TRAY_MANAGER")
|
||||
)
|
||||
|
||||
;; Enumerations and flags ...
|
||||
|
||||
|
||||
;; From sugar-tray-manager.h
|
||||
|
||||
(define-function tray_manager_get_type
|
||||
(c-name "sugar_tray_manager_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function tray_manager_check_running
|
||||
(c-name "sugar_tray_manager_check_running")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GdkScreen*" "screen")
|
||||
)
|
||||
)
|
||||
|
||||
(define-function tray_manager_new
|
||||
(c-name "sugar_tray_manager_new")
|
||||
(is-constructor-of "SugarTrayManager")
|
||||
(return-type "SugarTrayManager*")
|
||||
)
|
||||
|
||||
(define-method manage_screen
|
||||
(of-object "SugarTrayManager")
|
||||
(c-name "sugar_tray_manager_manage_screen")
|
||||
(return-type "gboolean")
|
||||
(parameters
|
||||
'("GdkScreen*" "screen")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_child_title
|
||||
(of-object "SugarTrayManager")
|
||||
(c-name "sugar_tray_manager_get_child_title")
|
||||
(return-type "char*")
|
||||
(parameters
|
||||
'("SugarTrayManagerChild*" "child")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method set_orientation
|
||||
(of-object "SugarTrayManager")
|
||||
(c-name "sugar_tray_manager_set_orientation")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
'("GtkOrientation" "orientation")
|
||||
)
|
||||
)
|
||||
|
||||
(define-method get_orientation
|
||||
(of-object "SugarTrayManager")
|
||||
(c-name "sugar_tray_manager_get_orientation")
|
||||
(return-type "GtkOrientation")
|
||||
)
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ headers
|
||||
#include "sugar-browser.h"
|
||||
#include "sugar-key-grabber.h"
|
||||
#include "sugar-address-entry.h"
|
||||
#include "sugar-tray-manager.h"
|
||||
|
||||
%%
|
||||
modulename gecko
|
||||
|
@ -7,6 +7,7 @@ noinst_LTLIBRARIES = libsugarprivate.la
|
||||
libsugarprivate_la_LIBADD = $(GECKO_LIBS)
|
||||
|
||||
libsugarprivate_la_SOURCES = \
|
||||
$(BUILT_SOURCES) \
|
||||
eggaccelerators.h \
|
||||
eggaccelerators.c \
|
||||
sugar-browser.h \
|
||||
@ -14,4 +15,30 @@ libsugarprivate_la_SOURCES = \
|
||||
sugar-address-entry.h \
|
||||
sugar-address-entry.c \
|
||||
sugar-key-grabber.h \
|
||||
sugar-key-grabber.c
|
||||
sugar-key-grabber.c \
|
||||
sugar-tray-manager.c \
|
||||
sugar-tray-manager.h
|
||||
|
||||
BUILT_SOURCES = \
|
||||
sugar-marshal.c \
|
||||
sugar-marshal.h
|
||||
|
||||
stamp_files = \
|
||||
stamp-sugar-marshal.c \
|
||||
stamp-sugar-marshal.h
|
||||
|
||||
sugar-marshal.c: stamp-sugar-marshal.c
|
||||
@true
|
||||
stamp-sugar-marshal.c: sugar-marshal.list
|
||||
$(GLIB_GENMARSHAL) --prefix=sugar_marshal $(srcdir)/sugar-marshal.list --header --body > sugar-marshal.c \
|
||||
&& echo timestamp > $(@F)
|
||||
|
||||
sugar-marshal.h: stamp-sugar-marshal.h
|
||||
@true
|
||||
stamp-sugar-marshal.h: sugar-marshal.list
|
||||
$(GLIB_GENMARSHAL) --prefix=sugar_marshal $(srcdir)/sugar-marshal.list --header > sugar-marshal.h \
|
||||
&& echo timestamp > $(@F)
|
||||
|
||||
CLEANFILES = $(stamp_files)
|
||||
DISTCLEANFILES = $(stamp_files)
|
||||
MAINTAINERCLEANFILES = $(stamp_files)
|
||||
|
Loading…
Reference in New Issue
Block a user