[Galago-commits] r2773 - in trunk/notify-python: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Tue Apr 25 22:28:06 PDT 2006
Author: chipx86
Date: 2006-04-25 22:28:01 -0700 (Tue, 25 Apr 2006)
New Revision: 2773
Modified:
trunk/notify-python/ChangeLog
trunk/notify-python/src/pynotify.override
Log:
Fix add_action() to actually work.
Modified: trunk/notify-python/ChangeLog
===================================================================
--- trunk/notify-python/ChangeLog 2006-04-25 09:06:44 UTC (rev 2772)
+++ trunk/notify-python/ChangeLog 2006-04-26 05:28:01 UTC (rev 2773)
@@ -1,3 +1,8 @@
+Tue Apr 25 22:25:42 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/pynotify.override:
+ - Fix add_action() to actually work.
+
Tue Apr 25 02:06:08 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* src/pynotify.override:
Modified: trunk/notify-python/src/pynotify.override
===================================================================
--- trunk/notify-python/src/pynotify.override 2006-04-25 09:06:44 UTC (rev 2772)
+++ trunk/notify-python/src/pynotify.override 2006-04-26 05:28:01 UTC (rev 2773)
@@ -109,12 +109,10 @@
if (data->user_data == Py_None)
{
- printf("Case 1\n");
args = Py_BuildValue("Os", data->notification, action);
}
else
{
- printf("Case 2\n");
args = Py_BuildValue("OsO", data->notification, action,
data->user_data);
}
@@ -144,8 +142,10 @@
_wrap_notify_notification_add_action(PyGObject *self, PyObject *args,
PyObject *kwargs)
{
+ static char *kwlist[] = { "action", "label", "callback",
+ "user_data", NULL };
ActionCbData *action_cb_data;
- PyObject *first, *callback, *user_data;
+ PyObject *callback, *user_data = Py_None;
char *action;
char *label;
size_t len;
@@ -160,37 +160,20 @@
return NULL;
}
- first = PySequence_GetSlice(args, 0, 3);
-
- if (!PyArg_ParseTuple(first, "ssO:NotifyNotification.add_action",
- &action, &label, &callback))
+ if (!PyArg_ParseTupleAndKeywords(args, kwargs,
+ "ssO|O:NotifyNotification.add_action",
+ kwlist,
+ &action, &label, &callback, &user_data))
{
- Py_DECREF(first);
return NULL;
}
- Py_DECREF(first);
-
if (!PyCallable_Check(callback))
{
PyErr_SetString(PyExc_TypeError, "third argument must be callable");
return NULL;
}
- first = PySequence_GetSlice(args, 3, len);
-
- if (first == NULL)
- return NULL;
-
- if (!PyArg_ParseTuple(first, "O:NotifyNotification.add_action",
- &user_data))
- {
- Py_INCREF(Py_None);
- user_data = Py_None;
- }
-
- Py_DECREF(first);
-
action_cb_data = g_new0(ActionCbData, 1);
action_cb_data->callback = callback;
action_cb_data->user_data = user_data;
More information about the galago-commits
mailing list