summaryrefslogtreecommitdiffstats
path: root/gnome-map/timezonemapmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'gnome-map/timezonemapmodule.c')
-rw-r--r--gnome-map/timezonemapmodule.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/gnome-map/timezonemapmodule.c b/gnome-map/timezonemapmodule.c
index 997e7b49d..716fcfafa 100644
--- a/gnome-map/timezonemapmodule.c
+++ b/gnome-map/timezonemapmodule.c
@@ -743,15 +743,18 @@ main (int argc, char **argv)
#endif
-static PyMethodDef tzObjectMethods[] = {
- { NULL },
-};
-
typedef struct tzObject_t {
PyObject_HEAD;
MapData * mapdata;
} tzObject;
+static PyObject * setcurrent (tzObject * o, PyObject * args);
+
+static PyMethodDef tzObjectMethods[] = {
+ { "setcurrent", (PyCFunction) setcurrent, METH_VARARGS, NULL },
+ { NULL }
+};
+
/* typedef struct tzObject_t tzObject; */
static PyObject * tzGetAttr(tzObject * o, char * name);
@@ -774,6 +777,27 @@ static PyTypeObject tzType = {
0, /* tp_as_mapping */
};
+
+static PyObject * setcurrent (tzObject * o, PyObject * args) {
+ char * loc;
+ int index;
+
+ if (!PyArg_ParseTuple(args, "s", &loc))
+ return NULL;
+
+ index = find_location (o->mapdata->Locations, loc);
+
+ if (index == -1)
+ return NULL;
+
+ set_selection (o->mapdata, index, TRUE);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+
+
static PyObject * tzGetAttr(tzObject * o, char * name) {
if (!strncmp (name, "map", 3)) {
return PyGtk_New((GtkObject *) o->mapdata->map->canvas);