From 528e353cee8bfa9900ca7e21a6cce9cc746337f8 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Fri, 28 May 2004 17:54:40 +0000 Subject: [PATCH] idle is a C module, not a C++ one --- common/{idle.cpp => idle.c} | 18 +++++++++++------- plugins/gtkgui/gtkgui.py | 4 ++-- setup.py | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) rename common/{idle.cpp => idle.c} (83%) diff --git a/common/idle.cpp b/common/idle.c similarity index 83% rename from common/idle.cpp rename to common/idle.c index 6cf5f970f..6d13b810d 100644 --- a/common/idle.cpp +++ b/common/idle.c @@ -6,21 +6,23 @@ #include -static PyObject * idle_init(PyObject *self, PyObject *args) { +static PyObject * idle_init(PyObject *self, PyObject *args) +{ gtk_init (NULL, NULL); Py_INCREF(Py_None); return Py_None; } -static PyObject * idle_getIdleSec(PyObject *self, PyObject *args) { +static PyObject * idle_getIdleSec(PyObject *self, PyObject *args) +{ static XScreenSaverInfo *mit_info = NULL; int idle_time, event_base, error_base; gtk_init (NULL, NULL); - if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) { - if (mit_info == NULL) { + if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) + { + if (mit_info == NULL) mit_info = XScreenSaverAllocInfo(); - } XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); idle_time = (mit_info->idle) / 1000; } @@ -29,13 +31,15 @@ static PyObject * idle_getIdleSec(PyObject *self, PyObject *args) { return Py_BuildValue("i", idle_time); } -static PyObject * idle_close(PyObject *self, PyObject *args) { +static PyObject * idle_close(PyObject *self, PyObject *args) +{ gtk_main_quit (); Py_INCREF(Py_None); return Py_None; } -static PyMethodDef idleMethods[] = { +static PyMethodDef idleMethods[] = +{ {"init", idle_init, METH_VARARGS, "init gtk"}, {"getIdleSec", idle_getIdleSec, METH_VARARGS, "Give the idle time in secondes"}, {"close", idle_close, METH_VARARGS, "close gtk"}, diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 44fb108db..65098cd6a 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -648,13 +648,13 @@ class roster_Window: acct_iter = model.get_iter((path[0])) account = model.get_value(acct_iter, 3) menu = gtk.Menu() - item = gtk.MenuItem(_(u"Log on")) + item = gtk.MenuItem(_("Log on")) if self.contacts[account][jid][0].show != 'offline': item.set_sensitive(FALSE) menu.append(item) item.connect("activate", self.on_agent_logging, jid, 'available', account) - item = gtk.MenuItem(_(u"Log off")) + item = gtk.MenuItem(_("Log off")) if self.contacts[account][jid][0].show == 'offline': item.set_sensitive(FALSE) menu.append(item) diff --git a/setup.py b/setup.py index ecf4c94c0..fa447858f 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from distutils.core import setup, Extension module1 = Extension( 'idle', - sources = ['common/idle.cpp'], + sources = ['common/idle.c'], # extra_compile_args = ['-W'], libraries = ['gtk-x11-2.0','gdk-x11-2.0','glib-2.0','X11','Xext','Xss','atk-1.0'], library_dirs = ['/usr/X11R6/lib'],