From 64e2180e3ec7a63170db152a33398dfe6c5e3cb1 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Fri, 3 Jun 2005 04:20:57 +0000 Subject: Show attachment bar when attachments are added e-msg-composer.c 2005-06-03 Srinivasa Ragavan * e-msg-composer-select-file.c (select_attach_response): Show attachment bar when attachments are added e-msg-composer.c (attachment_bar_changed_cb), (drop_action), (drag_data_received), (create_composer): Added support to DnD targets to the composer GtkHTML window. Also show the attachment bar when there are attachments and hide when all attachments are removed. svn path=/trunk/; revision=29451 --- composer/ChangeLog | 10 ++++++++++ composer/e-msg-composer-select-file.c | 4 ++++ composer/e-msg-composer.c | 36 +++++++++++++++++++++++++++-------- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index d6fcfef835..5216b82afb 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,13 @@ +2005-06-03 Srinivasa Ragavan + + * e-msg-composer-select-file.c (select_attach_response): Show + attachment bar when attachments are added + e-msg-composer.c (attachment_bar_changed_cb), (drop_action), + (drag_data_received), (create_composer): Added support to + DnD targets to the composer GtkHTML window. Also show the + attachment bar when there are attachments and hide when all + attachments are removed. + 2005-05-24 Srinivasa Ragavan * e-msg-composer-attachment.c (e_msg_composer_attachment_new_from_mime_part); Fixed a bug, which considered forwarded mails as remote files. diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c index 51ab823d23..7329d570c5 100644 --- a/composer/e-msg-composer-select-file.c +++ b/composer/e-msg-composer-select-file.c @@ -45,6 +45,7 @@ #include "e-msg-composer-select-file.h" #include +#include "e-msg-composer.h" enum { SELECTOR_MODE_MULTI = (1 << 0), @@ -213,6 +214,9 @@ select_attach_response(GtkWidget *selector, guint response, struct _EMsgComposer g_object_set_data_full ((GObject *) composer, "attach_path", path, g_free); func(composer, names, gtk_toggle_button_get_active(showinline)); + + gtk_widget_show (composer->attachment_expander); + gtk_widget_show (composer->attachment_scrolled_window); g_slist_foreach(names, (GFunc)g_free, NULL); g_slist_free(names); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 1240490b38..f0b1a8eecc 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -2315,7 +2315,8 @@ attachment_bar_changed_cb (EMsgComposerAttachmentBar *bar, } else { gtk_label_set_text (GTK_LABEL (composer->attachment_expander_num), ""); - gtk_widget_hide (composer->attachment_expander_icon); + gtk_widget_hide (composer->attachment_expander); + gtk_widget_hide (composer->attachment_scrolled_window); } @@ -2865,6 +2866,8 @@ drop_action(EMsgComposer *composer, GdkDragContext *context, guint32 action, Gtk d(printf ("dropping an unknown\n")); break; } + gtk_widget_show (composer->attachment_expander); + gtk_widget_show (composer->attachment_scrolled_window); printf("Drag finished, success %d delete %d\n", success, delete); @@ -2914,9 +2917,10 @@ drop_popup_free(EPopup *ep, GSList *items, void *data) } static void -drag_data_received (EMsgComposer *composer, GdkDragContext *context, +drag_data_received (GtkWidget *w, GdkDragContext *context, int x, int y, GtkSelectionData *selection, - guint info, guint time) + guint info, guint time, + EMsgComposer *composer) { if (selection->data == NULL || selection->length == -1) return; @@ -3362,6 +3366,9 @@ create_composer (int visible_mask) int vis; GList *icon_list; BonoboControlFrame *control_frame; + GtkWidget *html_widget = NULL; + gpointer servant;; + BonoboObject *impl; composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL); gtk_window_set_title ((GtkWindow *) composer, _("Compose a message")); @@ -3385,7 +3392,7 @@ create_composer (int visible_mask) /* DND support */ gtk_drag_dest_set (GTK_WIDGET (composer), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY|GDK_ACTION_ASK|GDK_ACTION_MOVE); - g_signal_connect(composer, "drag_data_received", G_CALLBACK (drag_data_received), NULL); + g_signal_connect(composer, "drag_data_received", G_CALLBACK (drag_data_received), composer); g_signal_connect(composer, "drag-motion", G_CALLBACK(drag_motion), composer); e_msg_composer_load_config (composer, visible_mask); @@ -3474,7 +3481,7 @@ create_composer (int visible_mask) G_CALLBACK (attachment_bar_changed_cb), composer); composer->attachment_expander_label = - gtk_label_new_with_mnemonic (_("_Attachment Bar (drop attachments here)")); + gtk_label_new_with_mnemonic (_("_Attachment Bar")); composer->attachment_expander_num = gtk_label_new (""); gtk_label_set_use_markup (GTK_LABEL (composer->attachment_expander_num), TRUE); gtk_misc_set_alignment (GTK_MISC (composer->attachment_expander_label), 0.0, 0.5); @@ -3498,9 +3505,10 @@ create_composer (int visible_mask) gtk_box_pack_start (GTK_BOX (vbox), expander_hbox, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX (vbox), composer->attachment_scrolled_window, FALSE, FALSE, GNOME_PAD_SMALL); - - gtk_widget_show (composer->attachment_scrolled_window); - gtk_widget_show (expander_hbox); + + composer->attachment_expander = expander_hbox; + gtk_widget_hide (composer->attachment_scrolled_window); + gtk_widget_hide (expander_hbox); bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox); gtk_widget_show (vbox); @@ -3516,6 +3524,18 @@ create_composer (int visible_mask) gtk_object_destroy (GTK_OBJECT (composer)); return NULL; } + + /* The engine would have the GtkHTML widget stored in "html-widget" + * We'll use that to listen for DnD signals + */ + + servant = ORBit_small_get_servant (composer->editor_engine); + if (servant && (impl = bonobo_object (servant))) + html_widget = g_object_get_data (G_OBJECT(impl), "html-widget"); + + if (html_widget) { + g_signal_connect (html_widget, "drag_data_received", G_CALLBACK (drag_data_received), composer); + } setup_cut_copy_paste (composer); -- cgit v1.2.3