Get the tray icon to sort of work.
This commit is contained in:
parent
0d2caab8a1
commit
5e503f77d1
@ -26,6 +26,7 @@ EXTRA_DIST = _sugar.override _sugar.defs
|
||||
.defs.c:
|
||||
(cd $(srcdir)\
|
||||
&& $(PYGTK_CODEGEN) \
|
||||
--register $(PYGTK_DEFSDIR)/gdk-types.defs \
|
||||
--register $(PYGTK_DEFSDIR)/gtk-types.defs \
|
||||
--register $(GNOMEPYTHONEXTRAS_DEFSDIR)/gtkmozembed.defs \
|
||||
--override $*.override \
|
||||
|
@ -23,6 +23,8 @@ static PyTypeObject *_PyGtkEntry_Type;
|
||||
#define PyGtkEntry_Type (*_PyGtkEntry_Type)
|
||||
static PyTypeObject *_PyGtkMozEmbed_Type;
|
||||
#define PyGtkMozEmbed_Type (*_PyGtkMozEmbed_Type)
|
||||
static PyTypeObject *_PyGdkScreen_Type;
|
||||
#define PyGdkScreen_Type (*_PyGdkScreen_Type)
|
||||
|
||||
|
||||
/* ---------- forward type declarations ---------- */
|
||||
@ -31,7 +33,7 @@ PyTypeObject G_GNUC_INTERNAL PySugarBrowser_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarKeyGrabber_Type;
|
||||
PyTypeObject G_GNUC_INTERNAL PySugarTrayManager_Type;
|
||||
|
||||
#line 35 "_sugar.c"
|
||||
#line 37 "_sugar.c"
|
||||
|
||||
|
||||
|
||||
@ -223,24 +225,20 @@ PyTypeObject G_GNUC_INTERNAL PySugarKeyGrabber_Type = {
|
||||
|
||||
/* ----------- SugarTrayManager ----------- */
|
||||
|
||||
static int
|
||||
_wrap_sugar_tray_manager_new(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
static PyObject *
|
||||
_wrap_sugar_tray_manager_manage_screen(PyGObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char* kwlist[] = { NULL };
|
||||
static char *kwlist[] = { "screen", NULL };
|
||||
PyGObject *screen;
|
||||
int ret;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
":gecko.TrayManager.__init__",
|
||||
kwlist))
|
||||
return -1;
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:SugarTrayManager.manage_screen", kwlist, &PyGdkScreen_Type, &screen))
|
||||
return NULL;
|
||||
|
||||
ret = sugar_tray_manager_manage_screen(SUGAR_TRAY_MANAGER(self->obj), GDK_SCREEN(screen->obj));
|
||||
|
||||
return PyBool_FromLong(ret);
|
||||
|
||||
pygobject_constructv(self, 0, NULL);
|
||||
if (!self->obj) {
|
||||
PyErr_SetString(
|
||||
PyExc_RuntimeError,
|
||||
"could not create gecko.TrayManager object");
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
@ -273,6 +271,8 @@ _wrap_sugar_tray_manager_get_orientation(PyGObject *self)
|
||||
}
|
||||
|
||||
static const PyMethodDef _PySugarTrayManager_methods[] = {
|
||||
{ "manage_screen", (PyCFunction)_wrap_sugar_tray_manager_manage_screen, METH_VARARGS|METH_KEYWORDS,
|
||||
NULL },
|
||||
{ "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,
|
||||
@ -318,7 +318,7 @@ PyTypeObject G_GNUC_INTERNAL PySugarTrayManager_Type = {
|
||||
(descrgetfunc)0, /* tp_descr_get */
|
||||
(descrsetfunc)0, /* tp_descr_set */
|
||||
offsetof(PyGObject, inst_dict), /* tp_dictoffset */
|
||||
(initproc)_wrap_sugar_tray_manager_new, /* tp_init */
|
||||
(initproc)0, /* tp_init */
|
||||
(allocfunc)0, /* tp_alloc */
|
||||
(newfunc)0, /* tp_new */
|
||||
(freefunc)0, /* tp_free */
|
||||
@ -339,9 +339,27 @@ _wrap_sugar_browser_startup(PyObject *self)
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
_wrap_sugar_tray_manager_check_running(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = { "screen", NULL };
|
||||
PyGObject *screen;
|
||||
int ret;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O!:tray_manager_check_running", kwlist, &PyGdkScreen_Type, &screen))
|
||||
return NULL;
|
||||
|
||||
ret = sugar_tray_manager_check_running(GDK_SCREEN(screen->obj));
|
||||
|
||||
return PyBool_FromLong(ret);
|
||||
|
||||
}
|
||||
|
||||
const PyMethodDef py_sugar_functions[] = {
|
||||
{ "startup_browser", (PyCFunction)_wrap_sugar_browser_startup, METH_NOARGS,
|
||||
NULL },
|
||||
{ "tray_manager_check_running", (PyCFunction)_wrap_sugar_tray_manager_check_running, METH_VARARGS|METH_KEYWORDS,
|
||||
NULL },
|
||||
{ NULL, NULL, 0, NULL }
|
||||
};
|
||||
|
||||
@ -387,9 +405,21 @@ py_sugar_register_classes(PyObject *d)
|
||||
"could not import gtk");
|
||||
return ;
|
||||
}
|
||||
if ((module = PyImport_ImportModule("gtk.gdk")) != NULL) {
|
||||
_PyGdkScreen_Type = (PyTypeObject *)PyObject_GetAttrString(module, "Screen");
|
||||
if (_PyGdkScreen_Type == NULL) {
|
||||
PyErr_SetString(PyExc_ImportError,
|
||||
"cannot import name Screen from gtk.gdk");
|
||||
return ;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_ImportError,
|
||||
"could not import gtk.gdk");
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
#line 393 "_sugar.c"
|
||||
#line 423 "_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));
|
||||
|
@ -21,6 +21,13 @@
|
||||
(gtype-id "SUGAR_TYPE_KEY_GRABBER")
|
||||
)
|
||||
|
||||
(define-object TrayManager
|
||||
(in-module "Sugar")
|
||||
(parent "GObject")
|
||||
(c-name "SugarTrayManager")
|
||||
(gtype-id "SUGAR_TYPE_TRAY_MANAGER")
|
||||
)
|
||||
|
||||
;; Enumerations and flags ...
|
||||
|
||||
|
||||
@ -69,19 +76,6 @@
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; -*- 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
|
||||
|
@ -12,9 +12,13 @@ headers
|
||||
%%
|
||||
modulename gecko
|
||||
%%
|
||||
ignore
|
||||
sugar_tray_manager_new
|
||||
%%
|
||||
import gobject.GObject as PyGObject_Type
|
||||
import gtk.Entry as PyGtkEntry_Type
|
||||
import gtkmozembed.MozEmbed as PyGtkMozEmbed_Type
|
||||
import gtk.gdk.Screen as PyGdkScreen_Type
|
||||
%%
|
||||
ignore-glob
|
||||
*_get_type
|
||||
|
@ -23,6 +23,7 @@ from view.frame.ActivitiesBox import ActivitiesBox
|
||||
from view.frame.ZoomBox import ZoomBox
|
||||
from view.frame.FriendsBox import FriendsBox
|
||||
from view.frame.PanelWindow import PanelWindow
|
||||
from view.frame.notificationtray import NotificationTray
|
||||
from sugar.graphics.timeline import Timeline
|
||||
from sugar.graphics.menushell import MenuShell
|
||||
from sugar.graphics.grid import Grid
|
||||
@ -152,6 +153,15 @@ class Frame:
|
||||
[x, y] = grid.point(1, 0)
|
||||
top_panel.move(box, x, y)
|
||||
|
||||
tray = NotificationTray()
|
||||
box = hippo.CanvasWidget()
|
||||
box.props.widget = tray
|
||||
|
||||
top_panel.append(box, hippo.PACK_FIXED)
|
||||
|
||||
[x, y] = grid.point(5, 0)
|
||||
top_panel.move(box, x, y)
|
||||
|
||||
bottom_panel = self._create_panel(grid, 0, 11, 16, 1)
|
||||
|
||||
box = ActivitiesBox(self._shell)
|
||||
|
Loading…
Reference in New Issue
Block a user