From 4e6bf7a95495a193005e91ecbc9508201ea8bb63 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 14 Jun 2000 15:49:15 +0000 Subject: 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 --- composer/ChangeLog | 6 +++++ composer/e-msg-composer-attachment-bar.c | 38 +++++++++++++++++++------------- 2 files changed, 29 insertions(+), 15 deletions(-) (limited to 'composer') 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 + * 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)); } -- cgit v1.2.3