[Commits] composewindowtype.c 1.1.2.15 1.1.2.16 gettext.h 1.1.2.1 1.1.2.2
holger at claws-mail.org
holger at claws-mail.org
Wed Aug 8 23:50:56 CEST 2012
Update of /home/claws-mail/plugins/python/src
In directory srv:/tmp/cvs-serv6167/src
Modified Files:
Tag: gtk2
composewindowtype.c gettext.h
Log Message:
2012-08-08 [holger] 0.10cvs3
* src/composewindowtype.c
Add a set_modified() function to the ComposeWindow class
* src/gettext.h
Introduce D_()
Index: composewindowtype.c
===================================================================
RCS file: /home/claws-mail/plugins/python/src/Attic/composewindowtype.c,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -d -r1.1.2.15 -r1.1.2.16
--- composewindowtype.c 10 Jul 2012 13:36:54 -0000 1.1.2.15
+++ composewindowtype.c 8 Aug 2012 21:50:54 -0000 1.1.2.16
@@ -28,9 +28,12 @@
#include "mainwindow.h"
#include "account.h"
#include "folder.h"
+#include "gettext.h"
#include <structmember.h>
+#include <string.h>
+
typedef struct {
PyObject_HEAD
PyObject *ui_manager;
@@ -371,6 +374,44 @@
return Py_None;
}
+static PyObject* ComposeWindow_set_modified(clawsmail_ComposeWindowObject *self, PyObject *args)
+{
+ char modified = 0;
+ gboolean old_modified;
+
+ if(!PyArg_ParseTuple(args, "b", &modified))
+ return NULL;
+
+ old_modified = self->compose->modified;
+
+ self->compose->modified = (modified != 0);
+
+ /* If the modified state changed, rewrite window title.
+ * This partly duplicates functionality in compose.c::compose_set_title().
+ * While it's nice to not have to modify Claws Mail for this to work,
+ * it would be cleaner to export that function in Claws Mail. */
+ if((strcmp(gtk_window_get_title(GTK_WINDOW(self->compose->window)), D_("claws-mail", "Compose message")) != 0) &&
+ (old_modified != self->compose->modified)) {
+ gchar *str;
+ gchar *edited;
+ gchar *subject;
+
+ edited = self->compose->modified ? D_("claws-mail", " [Edited]") : "";
+ subject = gtk_editable_get_chars(GTK_EDITABLE(self->compose->subject_entry), 0, -1);
+ if(subject && strlen(subject))
+ str = g_strdup_printf(D_("claws-mail", "%s - Compose message%s"),
+ subject, edited);
+ else
+ str = g_strdup_printf(D_("claws-mail", "[no subject] - Compose message%s"), edited);
+ gtk_window_set_title(GTK_WINDOW(self->compose->window), str);
+ g_free(str);
+ g_free(subject);
+ }
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
static PyMethodDef ComposeWindow_methods[] = {
{"set_subject", (PyCFunction)ComposeWindow_set_subject, METH_VARARGS,
"set_subject(text) - set subject to text\n"
@@ -392,7 +433,7 @@
"get_from - get From header entry\n"
"\n"
"Get a string of the current From header entry."},
-
+
{"add_To", (PyCFunction)ComposeWindow_add_To, METH_VARARGS,
"add_To(text) - append another To header with text\n"
"\n"
@@ -442,6 +483,18 @@
"a Folder, a string of the folder identifier (e.g. #mh/foo/bar), or\n"
"None is which case the message will not be saved at all."},
+ {"set_modified", (PyCFunction)ComposeWindow_set_modified, METH_VARARGS,
+ "set_modified(bool) - set or unset modification marker of compose window\n"
+ "\n"
+ "Set or unset the modification marker of the compose window. This marker determines\n"
+ "for example whether you get a confirmation dialog when closing the compose window\n"
+ "or not.\n"
+ "In the usual case, Claws Mail keeps track of the modification status itself.\n"
+ "However, there are cases when it might be desirable to overwrite the marker,\n"
+ "for example because a compose_any script modifies the body or subject which\n"
+ "can be regarded compose window preprocessing and should not trigger a confirmation\n"
+ "dialog on close like a manual edit."},
+
{NULL}
};
Index: gettext.h
===================================================================
RCS file: /home/claws-mail/plugins/python/src/Attic/gettext.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- gettext.h 9 Aug 2009 14:43:38 -0000 1.1.2.1
+++ gettext.h 8 Aug 2012 21:50:54 -0000 1.1.2.2
@@ -26,6 +26,7 @@
# include <libintl.h>
#define _(str) dgettext(TEXTDOMAIN, str)
+#define D_(domain, str) dgettext(domain, str)
#else
@@ -68,7 +69,7 @@
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
#define _(str) str
-
+#define D_(domain, str) str
#endif
/* A pseudo function call that serves as a marker for the automated
More information about the Commits
mailing list