aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/misc/e-signature-editor.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-08-07 05:48:45 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-08-07 08:00:49 +0800
commit052e89dd423b5ba2f394f55c2fcc48102e7b9bc3 (patch)
tree1e619c123276e604996423df38a2bffafd28b633 /widgets/misc/e-signature-editor.c
parent6a2b0904893199ceb5b291405721845fd17a08db (diff)
downloadgsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar.gz
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar.bz2
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar.lz
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar.xz
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.tar.zst
gsoc2013-evolution-052e89dd423b5ba2f394f55c2fcc48102e7b9bc3.zip
Seal up ESignature and add GObject properties.
Diffstat (limited to 'widgets/misc/e-signature-editor.c')
-rw-r--r--widgets/misc/e-signature-editor.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/widgets/misc/e-signature-editor.c b/widgets/misc/e-signature-editor.c
index 53cb34906b..699216784f 100644
--- a/widgets/misc/e-signature-editor.c
+++ b/widgets/misc/e-signature-editor.c
@@ -124,19 +124,23 @@ action_save_and_close_cb (GtkAction *action,
html = gtkhtml_editor_get_html_mode (GTKHTML_EDITOR (editor));
if (editor->priv->signature == NULL) {
+ gchar *new_filename;
+
signature = e_signature_new ();
- signature->name = g_strdup (_("Unnamed"));
- signature->script = FALSE;
- signature->html = html;
+ e_signature_set_name (signature, _("Unnamed"));
+ e_signature_set_is_script (signature, FALSE);
+ e_signature_set_is_html (signature, html);
/* FIXME Pass a GError and deal with it. */
- signature->filename = e_create_signature_file (NULL);
+ new_filename = e_create_signature_file (NULL);
+ e_signature_set_filename (signature, new_filename);
+ g_free (new_filename);
} else {
signature = g_object_ref (editor->priv->signature);
- signature->html = html;
+ e_signature_set_is_html (signature, html);
}
- filename = signature->filename;
+ filename = e_signature_get_filename (signature);
gtkhtml_editor_save (GTKHTML_EDITOR (editor), filename, html, &error);
if (error != NULL) {
@@ -167,7 +171,7 @@ action_save_and_close_cb (GtkAction *action,
* XXX ESignatureList misuses const. */
same_name = (ESignature *) e_signature_list_find (
signature_list, E_SIGNATURE_FIND_NAME, signature_name);
- if (same_name != NULL && strcmp (signature->uid, same_name->uid) != 0) {
+ if (same_name != NULL && !e_signature_is_equal (signature, same_name)) {
e_error_run (
GTK_WINDOW (editor),
"mail:signature-already-exists",
@@ -177,8 +181,8 @@ action_save_and_close_cb (GtkAction *action,
return;
}
- g_free (signature->name);
- signature->name = signature_name;
+ e_signature_set_name (signature, signature_name);
+ g_free (signature_name);
if (editor->priv->signature != NULL)
e_signature_list_change (signature_list, signature);
@@ -428,6 +432,7 @@ e_signature_editor_set_signature (ESignatureEditor *editor,
{
const gchar *filename;
const gchar *signature_name;
+ gboolean is_html;
gchar *contents;
gsize length;
GError *error = NULL;
@@ -449,9 +454,10 @@ e_signature_editor_set_signature (ESignatureEditor *editor,
/* Load signature content. */
- filename = signature->filename;
+ filename = e_signature_get_filename (signature);
+ is_html = e_signature_get_is_html (signature);
- if (signature->html)
+ if (is_html)
g_file_get_contents (filename, &contents, &length, &error);
else {
gchar *data;
@@ -467,7 +473,7 @@ e_signature_editor_set_signature (ESignatureEditor *editor,
if (error == NULL) {
gtkhtml_editor_set_html_mode (
- GTKHTML_EDITOR (editor), signature->html);
+ GTKHTML_EDITOR (editor), is_html);
gtkhtml_editor_set_text_html (
GTKHTML_EDITOR (editor), contents, length);
g_free (contents);
@@ -478,7 +484,7 @@ e_signature_editor_set_signature (ESignatureEditor *editor,
exit:
if (signature != NULL)
- signature_name = signature->name;
+ signature_name = e_signature_get_name (signature);
else
signature_name = _("Unnamed");