[gnome-menus] [python] Add bindings for get_generic_name() and get_display_name()
- From: Vincent Untz <vuntz src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-menus] [python] Add bindings for get_generic_name() and get_display_name()
- Date: Mon, 7 Sep 2009 17:23:13 +0000 (UTC)
commit 22b78e8b3cbc5d68638a1729728b682a4ce1d10b
Author: Vincent Untz <vuntz gnome org>
Date: Mon Sep 7 19:21:12 2009 +0200
[python] Add bindings for get_generic_name() and get_display_name()
python/gmenu.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 60 insertions(+), 0 deletions(-)
---
diff --git a/python/gmenu.c b/python/gmenu.c
index cccd311..a69fdc0 100644
--- a/python/gmenu.c
+++ b/python/gmenu.c
@@ -630,6 +630,56 @@ pygmenu_tree_entry_get_name (PyObject *self,
}
static PyObject *
+pygmenu_tree_entry_get_generic_name (PyObject *self,
+ PyObject *args)
+{
+ PyGMenuTreeEntry *entry;
+ const char *generic_name;
+
+ if (args != NULL)
+ {
+ if (!PyArg_ParseTuple (args, ":gmenu.Entry.get_generic_name"))
+ return NULL;
+ }
+
+ entry = (PyGMenuTreeEntry *) self;
+
+ generic_name = gmenu_tree_entry_get_generic_name (GMENU_TREE_ENTRY (entry->item));
+ if (generic_name == NULL)
+ {
+ Py_INCREF (Py_None);
+ return Py_None;
+ }
+
+ return PyString_FromString (generic_name);
+}
+
+static PyObject *
+pygmenu_tree_entry_get_display_name (PyObject *self,
+ PyObject *args)
+{
+ PyGMenuTreeEntry *entry;
+ const char *display_name;
+
+ if (args != NULL)
+ {
+ if (!PyArg_ParseTuple (args, ":gmenu.Entry.get_display_name"))
+ return NULL;
+ }
+
+ entry = (PyGMenuTreeEntry *) self;
+
+ display_name = gmenu_tree_entry_get_display_name (GMENU_TREE_ENTRY (entry->item));
+ if (display_name == NULL)
+ {
+ Py_INCREF (Py_None);
+ return Py_None;
+ }
+
+ return PyString_FromString (display_name);
+}
+
+static PyObject *
pygmenu_tree_entry_get_comment (PyObject *self,
PyObject *args)
{
@@ -860,6 +910,14 @@ pygmenu_tree_entry_getattro (PyGMenuTreeEntry *self,
{
return pygmenu_tree_entry_get_name ((PyObject *) self, NULL);
}
+ else if (!strcmp (attr, "generic_name"))
+ {
+ return pygmenu_tree_entry_get_display_name ((PyObject *) self, NULL);
+ }
+ else if (!strcmp (attr, "display_name"))
+ {
+ return pygmenu_tree_entry_get_generic_name ((PyObject *) self, NULL);
+ }
else if (!strcmp (attr, "comment"))
{
return pygmenu_tree_entry_get_comment ((PyObject *) self, NULL);
@@ -900,6 +958,8 @@ pygmenu_tree_entry_getattro (PyGMenuTreeEntry *self,
static struct PyMethodDef pygmenu_tree_entry_methods[] =
{
{ "get_name", pygmenu_tree_entry_get_name, METH_VARARGS },
+ { "get_generic_name", pygmenu_tree_entry_get_generic_name, METH_VARARGS },
+ { "get_display_name", pygmenu_tree_entry_get_display_name, METH_VARARGS },
{ "get_comment", pygmenu_tree_entry_get_comment, METH_VARARGS },
{ "get_icon", pygmenu_tree_entry_get_icon, METH_VARARGS },
{ "get_exec", pygmenu_tree_entry_get_exec, METH_VARARGS },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]