[Commits] composewindowtype.c 1.1.2.13 1.1.2.14

holger at claws-mail.org holger at claws-mail.org
Sun Feb 19 16:51:09 CET 2012


Update of /home/claws-mail/plugins/python/src
In directory srv:/tmp/cvs-serv4699/src

Modified Files:
      Tag: gtk2
	composewindowtype.c 
Log Message:
2012-02-19 [holger]	0.9cvs1

	* src/composewindowtype.c
		Add replyinfo to compose object.
		Implements enhancement request #2608 

Index: composewindowtype.c
===================================================================
RCS file: /home/claws-mail/plugins/python/src/Attic/composewindowtype.c,v
retrieving revision 1.1.2.13
retrieving revision 1.1.2.14
diff -u -d -r1.1.2.13 -r1.1.2.14
--- composewindowtype.c	15 Jan 2010 09:19:30 -0000	1.1.2.13
+++ composewindowtype.c	19 Feb 2012 15:51:07 -0000	1.1.2.14
@@ -24,6 +24,7 @@
 
 #include "clawsmailmodule.h"
 #include "foldertype.h"
+#include "messageinfotype.h"
 
 #include "mainwindow.h"
 #include "account.h"
@@ -35,6 +36,7 @@
     PyObject_HEAD
     PyObject *ui_manager;
     PyObject *text;
+    PyObject *replyinfo;
     Compose *compose;
 } clawsmail_ComposeWindowObject;
 
@@ -42,31 +44,32 @@
 {
   Py_XDECREF(self->ui_manager);
   Py_XDECREF(self->text);
+  Py_XDECREF(self->replyinfo);
   self->ob_type->tp_free((PyObject*)self);
 }
 
-#define WRAP_GOBJECT_IN_MEMBER_VAR(ptr, var) \
-  do {                                       \
-    var = get_gobj_from_address(ptr);        \
-    if(var) {                                \
-      tmp = self->var;                       \
-      Py_INCREF(var);                        \
-      self->var = var;                       \
-      Py_XDECREF(tmp);                       \
-      tmp = NULL;                            \
-    }                                        \
-  } while(0)
-
+static void store_py_object(PyObject **target, PyObject *obj)
+{
+  Py_XDECREF(*target);
+  if(obj)
+  {
+    Py_INCREF(obj);
+    *target = obj;
+  }
+  else {
+    Py_INCREF(Py_None);
+    *target = Py_None;
+  }
+}
 
 static void composewindow_set_compose(clawsmail_ComposeWindowObject *self, Compose *compose)
 {
-  PyObject *ui_manager = NULL;
-  PyObject *tmp = NULL;
-  PyObject *text = NULL;
-
   self->compose = compose;
-  WRAP_GOBJECT_IN_MEMBER_VAR(compose->ui_manager, ui_manager);
-  WRAP_GOBJECT_IN_MEMBER_VAR(compose->text, text);
+
+  store_py_object(&(self->ui_manager), get_gobj_from_address(compose->ui_manager));
+  store_py_object(&(self->text), get_gobj_from_address(compose->text));
+
+  store_py_object(&(self->replyinfo), clawsmail_messageinfo_new(compose->replyinfo));
 }
 
 static int ComposeWindow_init(clawsmail_ComposeWindowObject *self, PyObject *args, PyObject *kwds)
@@ -450,6 +453,9 @@
     {"text", T_OBJECT_EX, offsetof(clawsmail_ComposeWindowObject, text), 0,
      "text - the gtk.TextView widget of the message body"},
 
+    {"replyinfo", T_OBJECT_EX, offsetof(clawsmail_ComposeWindowObject, replyinfo), 0,
+     "replyinfo - The MessageInfo object of the message that is being replied to, or None"},
+
     {NULL}
 };
 



More information about the Commits mailing list