aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-06-27 02:07:22 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-06-27 02:07:22 +0800
commita6123511735299f9811a40ed55344a9fcba90655 (patch)
tree241f34c78f3f73ff4ab25c45809c8c90a33071ed /composer
parent187f4c8b0c9ada3c5c0362ebc23cbef0f7987955 (diff)
downloadgsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar.gz
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar.bz2
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar.lz
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar.xz
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.tar.zst
gsoc2013-evolution-a6123511735299f9811a40ed55344a9fcba90655.zip
Implement "Save"/"Save As...".
svn path=/trunk/; revision=3739
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog9
-rw-r--r--composer/e-msg-composer.c82
2 files changed, 81 insertions, 10 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index b51ae878b0..4ffcd926dd 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,12 @@
+2000-06-26 Ettore Perazzoli <ettore@helixcode.com>
+
+ * e-msg-composer.c
+ (load): New.
+ (open_cb): Use it.
+ (save): New function.
+ (save_cb): Implemented by using it.
+ (save_as_cb): Likewise.
+
2000-06-17 Ettore Perazzoli <ettore@helixcode.com>
* e-msg-composer.c (e_msg_composer_construct): I18N the title bar.
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 0832adeb81..2e63dab8e7 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -416,6 +416,8 @@ set_editor_text (BonoboWidget *editor, const char *text)
}
+/* Commands. */
+
static void
show_attachments (EMsgComposer *composer,
gboolean show)
@@ -444,6 +446,52 @@ show_attachments (EMsgComposer *composer,
this point, it is not a toggle because Glade is broken. */
}
+static void
+save (EMsgComposer *composer,
+ const char *file_name)
+{
+ CORBA_Environment ev;
+ char *my_file_name;
+
+ if (file_name != NULL)
+ my_file_name = g_strdup (file_name);
+ else
+ my_file_name = e_msg_composer_select_file (composer, _("Save as..."));
+
+ if (my_file_name == NULL)
+ return;
+
+ CORBA_exception_init (&ev);
+
+ Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
+ _("Error saving file: %s"), g_basename (file_name));
+ }
+
+ CORBA_exception_free (&ev);
+
+ g_free (my_file_name);
+}
+
+static void
+load (EMsgComposer *composer,
+ const char *file_name)
+{
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ Bonobo_PersistFile_load (composer->persist_file_interface, file_name, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
+ _("Error loading file: %s"), g_basename (file_name));
+
+ CORBA_exception_free (&ev);
+}
+
/* Address dialog callbacks. */
@@ -484,7 +532,6 @@ open_cb (GtkWidget *widget,
gpointer data)
{
EMsgComposer *composer;
- CORBA_Environment ev;
char *file_name;
composer = E_MSG_COMPOSER (data);
@@ -493,15 +540,7 @@ open_cb (GtkWidget *widget,
if (file_name == NULL)
return;
- CORBA_exception_init (&ev);
-
- Bonobo_PersistFile_load (composer->persist_file_interface, file_name, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
- _("Error loading file: %s"), g_basename (file_name));
-
- CORBA_exception_free (&ev);
+ load (composer, file_name);
g_free (file_name);
}
@@ -510,12 +549,35 @@ static void
save_cb (GtkWidget *widget,
gpointer data)
{
+ EMsgComposer *composer;
+ CORBA_char *file_name;
+ CORBA_Environment ev;
+
+ composer = E_MSG_COMPOSER (data);
+
+ CORBA_exception_init (&ev);
+
+ file_name = Bonobo_PersistFile_get_current_file (composer->persist_file_interface, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ save (composer, NULL);
+ } else {
+ save (composer, file_name);
+ CORBA_free (file_name);
+ }
+
+ CORBA_exception_free (&ev);
}
static void
save_as_cb (GtkWidget *widget,
gpointer data)
{
+ EMsgComposer *composer;
+
+ composer = E_MSG_COMPOSER (data);
+
+ save (composer, NULL);
}
static void