[claws-mail-cvs-commit] composewindowtype.c

Holger Berndt <[email protected]> Thu, 20 Aug 2009 22:30:14 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /srv/cvs/claws-mail/plugins/python/src
In directory ran:/tmp/cvs-serv8132/src

Modified Files:
      Tag: gtk2
	composewindowtype.c python_plugin.c 
Log Message:
2009-08-20 [holger]	0.1cvs11

	* configure.ac
	* src/python_plugin.c
		Bump required Claws Mail version to 3.7.19
	* src/composewindowtype.c
		Add interface for attaching files to a compose window 

Index: python_plugin.c
===================================================================
RCS file: /srv/cvs/claws-mail/plugins/python/src/Attic/python_plugin.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- python_plugin.c	9 Aug 2009 14:43:39 -0000	1.1.2.1
+++ python_plugin.c	20 Aug 2009 22:30:12 -0000	1.1.2.2
@@ -274,7 +274,7 @@
   bind_textdomain_codeset(TEXTDOMAIN, "UTF-8");
 
   /* Version check */
-  if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,7,1,44),
+  if(!check_plugin_version(MAKE_NUMERIC_VERSION(3,7,2,19),
 			   VERSION_NUMERIC, _("Python"), error))
     return -1;
 

Index: composewindowtype.c
===================================================================
RCS file: /srv/cvs/claws-mail/plugins/python/src/Attic/composewindowtype.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- composewindowtype.c	9 Aug 2009 14:43:38 -0000	1.1.2.1
+++ composewindowtype.c	20 Aug 2009 22:30:12 -0000	1.1.2.2
@@ -177,11 +177,47 @@
   return Py_None;
 }
 
+static PyObject* ComposeWindow_attach(clawsmail_ComposeWindowObject *self, PyObject *args)
+{
+  PyObject *olist;
+  Py_ssize_t size, iEl;
+  GList *list = NULL;
+
+  if(!PyArg_ParseTuple(args, "O!", &PyList_Type, &olist))
+    return NULL;
+
+  size = PyList_Size(olist);
+  for(iEl = 0; iEl < size; iEl++) {
+    PyObject *element = PyList_GET_ITEM(olist, iEl);
+    char *ss;
+
+    if(!element)
+      continue;
+
+    Py_INCREF(element);
+    if(!PyArg_Parse(element, "s", &ss)) {
+      Py_DECREF(element);
+      if(list)
+        g_list_free(list);
+      return NULL;
+    }
+    Py_DECREF(element);
+    list = g_list_prepend(list, ss);
+  }
+
+  compose_attach_from_list(self->compose, list, FALSE);
+  g_list_free(list);
+
+  Py_INCREF(Py_None);
+  return Py_None;
+}
+
 static PyMethodDef ComposeWindow_methods[] = {
     {"set_subject", (PyCFunction)ComposeWindow_set_subject, METH_VARARGS, "Set subject to text."},
     {"add_To",  (PyCFunction)ComposeWindow_add_To,  METH_VARARGS, "Append another To header."},
     {"add_Cc",  (PyCFunction)ComposeWindow_add_Cc,  METH_VARARGS, "Append another Cc header."},
     {"add_Bcc", (PyCFunction)ComposeWindow_add_Bcc, METH_VARARGS, "Append another Bcc header."},
+    {"attach",  (PyCFunction)ComposeWindow_attach, METH_VARARGS, "Attach a list of files."},
     {NULL}
 };