aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2000-06-14 23:49:15 +0800
committerDan Winship <danw@src.gnome.org>2000-06-14 23:49:15 +0800
commit4e6bf7a95495a193005e91ecbc9508201ea8bb63 (patch)
tree72d6290eda4285962eeb62dfcf529c7f65e63468
parentf73a4deee4fe176b59a04eee2d2ad119ac53d130 (diff)
downloadgsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar.gz
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar.bz2
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar.lz
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar.xz
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.tar.zst
gsoc2013-evolution-4e6bf7a95495a193005e91ecbc9508201ea8bb63.zip
keep the GtkFileSelection around between calls so we start up in the same
* 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.) svn path=/trunk/; revision=3570
-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));
}