aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-13 02:35:51 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-13 02:35:51 +0800
commitb35e87b9e0379c6db3d1755ca55a8edeee33cdb5 (patch)
treeda8ad4fd45540d61575080bfbfb890087cfc9ea2 /mail
parent8d1a4eb49d1503d5fd1c016ca709bf42dd705959 (diff)
downloadgsoc2013-evolution-b35e87b9e0379c6db3d1755ca55a8edeee33cdb5.tar.gz
gsoc2013-evolution-b35e87b9e0379c6db3d1755ca55a8edeee33cdb5.tar.zst
gsoc2013-evolution-b35e87b9e0379c6db3d1755ca55a8edeee33cdb5.zip
Various small fixes leading up to a real fix.
2003-03-12 Jeffrey Stedfast <fejj@ximian.com> * mail-signature-editor.c: Various small fixes leading up to a real fix. svn path=/trunk/; revision=20265
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog4
-rw-r--r--mail/mail-ops.c8
-rw-r--r--mail/mail-signature-editor.c55
3 files changed, 41 insertions, 26 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 7d3d3d2f4d..260a02a9af 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-12 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-signature-editor.c: Various small fixes leading up to a real fix.
+
2003-03-11 Jeffrey Stedfast <fejj@ximian.com>
* mail-accounts.c (account_add_clicked): Use
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 11bf3d8b0e..135f410afe 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -717,7 +717,7 @@ send_queue_send(struct _mail_msg *mm)
uids = camel_folder_get_uids (m->queue);
if (uids == NULL || uids->len == 0)
return;
-
+
if (m->cancel)
camel_operation_register (m->cancel);
@@ -743,17 +743,17 @@ send_queue_send(struct _mail_msg *mm)
camel_folder_set_message_flags (m->queue, uids->pdata[i], CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
}
-
+
if (camel_exception_is_set (&mm->ex))
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Failed on message %d of %d"), i+1, uids->len);
else
report_status (m, CAMEL_FILTER_STATUS_END, 100, _("Complete."));
-
+
if (m->driver) {
camel_object_unref((CamelObject *)m->driver);
m->driver = NULL;
}
-
+
camel_folder_free_uids (m->queue, uids);
if (!camel_exception_is_set (&mm->ex))
diff --git a/mail/mail-signature-editor.c b/mail/mail-signature-editor.c
index e3a689bbc1..6333ab16d0 100644
--- a/mail/mail-signature-editor.c
+++ b/mail/mail-signature-editor.c
@@ -71,36 +71,32 @@ destroy_editor (ESignatureEditor *editor)
static void
menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev)
{
- const char *err;
+ char *err;
/* errno is set if the rename() fails in menu_file_save_cb */
- err = ev->_major != CORBA_NO_EXCEPTION ? bonobo_exception_get_text (ev) : g_strerror (errno);
-
- e_notice (GTK_WINDOW (uic), GTK_MESSAGE_ERROR,
- _("Could not save signature file: %s"), err);
+ err = ev->_major != CORBA_NO_EXCEPTION ? bonobo_exception_get_text (ev) : g_strdup (g_strerror (errno));
+ e_notice (NULL, GTK_MESSAGE_ERROR, _("Could not save signature file: %s"), err);
g_warning ("Exception while saving signature: %s", err);
+
+ g_free (err);
}
static void
-menu_file_save_cb (BonoboUIComponent *uic,
- void *data,
- const char *path)
+menu_file_save_cb (BonoboUIComponent *uic, void *user_data, const char *path)
{
- ESignatureEditor *editor;
+ ESignatureEditor *editor = user_data;
CORBA_Environment ev;
char *filename, *base;
char *dirname;
- editor = E_SIGNATURE_EDITOR (data);
-
d(printf ("editor->sig->filename = %s\n", editor->sig->filename));
dirname = g_path_get_dirname (editor->sig->filename);
d(printf ("dirname = %s\n", dirname));
base = g_path_get_basename (editor->sig->filename);
d(printf ("basename = %s\n", base));
- filename = g_strdup_printf ("%s/.#%s", dirname, base);
+ filename = g_strdup_printf ("%s/.%s~", dirname, base);
d(printf ("filename = %s\n", filename));
g_free (dirname);
g_free (base);
@@ -119,24 +115,30 @@ menu_file_save_cb (BonoboUIComponent *uic,
char *uri;
uri = g_strdup_printf ("file://%s", filename);
- stream = bonobo_get_object (uri, "IDL:Bonobo/Stream:1.0", NULL);
+ stream = bonobo_get_object (uri, "IDL:Bonobo/Stream:1.0", &ev);
g_free (uri);
- /* FIXME: truncate? */
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto exception;
+ /* FIXME: truncate? */
pstream_iface = Bonobo_Unknown_queryInterface
(bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)),
- "IDL:Bonobo/PersistStream:1.0", NULL);
+ "IDL:Bonobo/PersistStream:1.0", &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto exception;
Bonobo_PersistStream_save (pstream_iface, stream, "text/plain", &ev);
bonobo_object_release_unref (stream, NULL);
}
- if (ev._major != CORBA_NO_EXCEPTION || rename (filename, editor->sig->filename) == -1) {
- menu_file_save_error (uic, &ev);
- unlink (filename);
- }
+ if (ev._major != CORBA_NO_EXCEPTION)
+ goto exception;
+
+ if (rename (filename, editor->sig->filename) == -1)
+ goto exception;
g_free (filename);
@@ -150,6 +152,15 @@ menu_file_save_cb (BonoboUIComponent *uic,
mail_config_signature_set_html (editor->sig, editor->html);
mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED, editor->sig);
}
+
+ return;
+
+ exception:
+
+ menu_file_save_error (uic, &ev);
+ CORBA_exception_free (&ev);
+ unlink (filename);
+ g_free (filename);
}
static void
@@ -251,8 +262,8 @@ load_signature (ESignatureEditor *editor)
if (editor->html) {
Bonobo_PersistFile pfile_iface;
- pfile_iface = Bonobo_Unknown_queryInterface(bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)),
- "IDL:Bonobo/PersistFile:1.0", NULL);
+ pfile_iface = Bonobo_Unknown_queryInterface (bonobo_widget_get_objref (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistFile:1.0", NULL);
CORBA_exception_init (&ev);
Bonobo_PersistFile_load (pfile_iface, editor->sig->filename, &ev);
CORBA_exception_free (&ev);
@@ -316,7 +327,7 @@ format_html_cb (BonoboUIComponent *component,
{
ESignatureEditor *editor = (ESignatureEditor *) data;
-
+
if (type != Bonobo_UIComponent_STATE_CHANGED)
return;