aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer-attachment-bar.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-10-23 01:04:12 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-10-23 01:04:12 +0800
commit20255e43dfe6513e6c58807031ed74978759c70b (patch)
treeabc22a6f71143e88d075cb8829799f3772b1bd93 /composer/e-msg-composer-attachment-bar.c
parent7305f431fcc00b8b8127988bc107e2410c3c74f2 (diff)
downloadgsoc2013-evolution-20255e43dfe6513e6c58807031ed74978759c70b.tar.gz
gsoc2013-evolution-20255e43dfe6513e6c58807031ed74978759c70b.tar.zst
gsoc2013-evolution-20255e43dfe6513e6c58807031ed74978759c70b.zip
Pull the fix to the "attach-twice-and-crash" problem up to HEAD.
svn path=/trunk/; revision=6108
Diffstat (limited to 'composer/e-msg-composer-attachment-bar.c')
-rw-r--r--composer/e-msg-composer-attachment-bar.c50
1 files changed, 9 insertions, 41 deletions
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 0a7428b2ea..71ccf2a4f3 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -28,9 +28,12 @@
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
+#include "e-msg-composer.h"
#include "e-msg-composer-attachment.h"
#include "e-msg-composer-attachment-bar.h"
+
#include "e-icon-list.h"
+
#include "camel/camel-data-wrapper.h"
#include "camel/camel-stream-fs.h"
#include "camel/camel-stream-mem.h"
@@ -382,53 +385,18 @@ edit_selected (EMsgComposerAttachmentBar *bar)
/* "Attach" dialog. */
static void
-attach_cb (GtkWidget *widget,
- gpointer data)
-{
- EMsgComposerAttachmentBar *bar;
- GtkWidget *file_selection;
- const gchar *file_name;
-
- file_selection = gtk_widget_get_toplevel (widget);
- bar = E_MSG_COMPOSER_ATTACHMENT_BAR (data);
-
- file_name = gtk_file_selection_get_filename
- (GTK_FILE_SELECTION (file_selection));
- add_from_file (bar, file_name);
-
- gtk_widget_hide (file_selection);
-}
-
-static void
add_from_user (EMsgComposerAttachmentBar *bar)
{
- static GtkWidget *fs;
+ EMsgComposer *composer;
+ char *file_name;
- if (!fs) {
- GtkWidget *cancel_button;
- GtkWidget *ok_button;
+ composer = E_MSG_COMPOSER (gtk_widget_get_toplevel (GTK_WIDGET (bar)));
- fs = gtk_file_selection_new (_("Add attachment"));
+ file_name = e_msg_composer_select_file (composer, _("Attach a file"));
- ok_button = GTK_FILE_SELECTION (fs)->ok_button;
- gtk_signal_connect (GTK_OBJECT (ok_button),
- "clicked", GTK_SIGNAL_FUNC (attach_cb),
- bar);
-
- 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));
-
- 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), "");
-
- gtk_window_set_position (GTK_WINDOW (fs), GTK_WIN_POS_MOUSE);
+ add_from_file (bar, file_name);
- gtk_widget_show (GTK_WIDGET (fs));
+ g_free (file_name);
}