[Galago-commits] r2776 - in trunk/notify-python: . src tests
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Tue Apr 25 23:24:28 PDT 2006
Author: chipx86
Date: 2006-04-25 23:24:25 -0700 (Tue, 25 Apr 2006)
New Revision: 2776
Modified:
trunk/notify-python/ChangeLog
trunk/notify-python/src/pynotify.override
trunk/notify-python/tests/test-xy-stress.py
trunk/notify-python/tests/test-xy.py
Log:
Added a Notification.set_hint() method, which takes a variety of types.
Modified: trunk/notify-python/ChangeLog
===================================================================
--- trunk/notify-python/ChangeLog 2006-04-26 05:53:38 UTC (rev 2775)
+++ trunk/notify-python/ChangeLog 2006-04-26 06:24:25 UTC (rev 2776)
@@ -1,3 +1,11 @@
+Tue Apr 25 23:23:55 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/pynotify.override:
+ * tests/test-xy.py:
+ * tests/test-xy-stress.py:
+ - Added a Notification.set_hint() method, which takes a variety of
+ types.
+
Tue Apr 25 22:53:24 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* tests/Makefile.am:
Modified: trunk/notify-python/src/pynotify.override
===================================================================
--- trunk/notify-python/src/pynotify.override 2006-04-26 05:53:38 UTC (rev 2775)
+++ trunk/notify-python/src/pynotify.override 2006-04-26 06:24:25 UTC (rev 2776)
@@ -228,4 +228,56 @@
return dict;
}
+%%
+define NotifyNotification.set_hint kwargs
+static PyObject *
+_wrap_notify_notification_set_hint(PyGObject *self, PyObject *args,
+ PyObject *kwargs)
+{
+ static char *kwlist[] = { "name", "value", NULL };
+ char *name;
+ PyObject *value;
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "sO:NotifyNotification.set_hint",
+ kwlist, &name, &value))
+ {
+ return NULL;
+ }
+
+ if (PyString_Check(value))
+ {
+ notify_notification_set_hint_string(NOTIFY_NOTIFICATION(self->obj),
+ name, PyString_AsString(value));
+ }
+ else if (PyBool_Check(value))
+ {
+ notify_notification_set_hint_int32(NOTIFY_NOTIFICATION(self->obj),
+ name,
+ PyObject_IsTrue(value) ? 1 : 0);
+ }
+ else if (PyInt_Check(value))
+ {
+ notify_notification_set_hint_int32(NOTIFY_NOTIFICATION(self->obj),
+ name, PyInt_AsLong(value));
+ }
+ else if (PyLong_Check(value))
+ {
+ notify_notification_set_hint_int32(NOTIFY_NOTIFICATION(self->obj),
+ name, PyLong_AsLong(value));
+ }
+ else if (PyFloat_Check(value))
+ {
+ notify_notification_set_hint_double(NOTIFY_NOTIFICATION(self->obj),
+ name, PyFloat_AsDouble(value));
+ }
+ else
+ {
+ /* TODO: Display an error */
+ return NULL;
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
// vim: ft=c
Modified: trunk/notify-python/tests/test-xy-stress.py
===================================================================
--- trunk/notify-python/tests/test-xy-stress.py 2006-04-26 05:53:38 UTC (rev 2775)
+++ trunk/notify-python/tests/test-xy-stress.py 2006-04-26 06:24:25 UTC (rev 2776)
@@ -18,8 +18,8 @@
def emit_notification(x, y):
n = pynotify.Notification("X, Y Test",
"This notification should point to %d, %d." % (x, y))
- n.set_hint_int32("x", x)
- n.set_hint_int32("y", y)
+ n.set_hint("x", x)
+ n.set_hint("y", y)
n.connect('closed', handle_closed)
n.show()
Modified: trunk/notify-python/tests/test-xy.py
===================================================================
--- trunk/notify-python/tests/test-xy.py 2006-04-26 05:53:38 UTC (rev 2775)
+++ trunk/notify-python/tests/test-xy.py 2006-04-26 06:24:25 UTC (rev 2776)
@@ -11,8 +11,8 @@
n = pynotify.Notification("X, Y Test",
"This notification should point to 150, 10")
- n.set_hint_int32("x", 150)
- n.set_hint_int32("y", 10)
+ n.set_hint("x", 150)
+ n.set_hint("y", 10)
if not n.show():
print "Failed to send notification"
More information about the galago-commits
mailing list