aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
Diffstat (limited to 'composer')
-rw-r--r--composer/ChangeLog6
-rw-r--r--composer/e-msg-composer-attachment-bar.c38
2 files changed, 29 insertions, 15 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 720d5dd3f5..6c52a39c77 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,5 +1,11 @@
2000-06-14 Dan Winship <danw@helixcode.com>
+ * e-msg-composer-attachment-bar.c (add_from_user): keep the
+ GtkFileSelection around between calls so we start up in the same
+ directory we ended up in last time around. (Also fixes a big
+ memory leak in that the code was already keeping the
+ GtkFileSelection around, it just wasn't remembering to reuse it.)
+
* e-msg-composer.c (format_text): Don't line-wrap lines that start
with ">".
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index d6749f72c4..405104f608 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -290,25 +290,33 @@ attach_cb (GtkWidget *widget,
static void
add_from_user (EMsgComposerAttachmentBar *bar)
{
- GtkWidget *file_selection;
- GtkWidget *cancel_button;
- GtkWidget *ok_button;
+ static GtkWidget *fs;
+
+ if (!fs) {
+ GtkWidget *cancel_button;
+ GtkWidget *ok_button;
+
+ fs = gtk_file_selection_new (_("Add attachment"));
+
+ ok_button = GTK_FILE_SELECTION (fs)->ok_button;
+ gtk_signal_connect (GTK_OBJECT (ok_button),
+ "clicked", GTK_SIGNAL_FUNC (attach_cb),
+ bar);
- file_selection = gtk_file_selection_new (_("Add attachment"));
- gtk_window_set_position (GTK_WINDOW (file_selection),
- GTK_WIN_POS_MOUSE);
+ cancel_button = GTK_FILE_SELECTION (fs)->cancel_button;
+ gtk_signal_connect_object (GTK_OBJECT (cancel_button),
+ "clicked",
+ GTK_SIGNAL_FUNC (gtk_widget_hide),
+ GTK_OBJECT (fs));
- ok_button = GTK_FILE_SELECTION (file_selection)->ok_button;
- gtk_signal_connect (GTK_OBJECT (ok_button),
- "clicked", GTK_SIGNAL_FUNC (attach_cb), bar);
+ gtk_signal_connect (GTK_OBJECT (fs), "delete_event",
+ GTK_SIGNAL_FUNC (gtk_widget_hide), NULL);
+ } else
+ gtk_file_selection_set_filename (GTK_FILE_SELECTION (fs), "");
- cancel_button = GTK_FILE_SELECTION (file_selection)->cancel_button;
- gtk_signal_connect_object (GTK_OBJECT (cancel_button),
- "clicked",
- GTK_SIGNAL_FUNC (gtk_widget_hide),
- GTK_OBJECT (file_selection));
+ gtk_window_set_position (GTK_WINDOW (fs), GTK_WIN_POS_MOUSE);
- gtk_widget_show (GTK_WIDGET (file_selection));
+ gtk_widget_show (GTK_WIDGET (fs));
}