From f3c12c30862ffd0cc946031d8cf9fdf98fc18fcb Mon Sep 17 00:00:00 2001 From: Chenthill Palanisamy Date: Mon, 28 Feb 2005 16:58:38 +0000 Subject: Connect the signal to "event", and open the attachment only if its a 2005-02-28 Chenthill Palanisamy * gui/dialogs/comp-editor.c: (attachment_bar_icon_clicked_cb), (setup_widgets): Connect the signal to "event", and open the attachment only if its a double click from the cal attachment bar. svn path=/trunk/; revision=28916 --- calendar/gui/dialogs/comp-editor.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index cb17c26300..638a000f2a 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -860,8 +860,8 @@ attachment_bar_changed_cb (CalAttachmentBar *bar, } -static void -attachment_bar_icon_clicked_cb (CalAttachmentBar *bar, void *data) +static gboolean +attachment_bar_icon_clicked_cb (CalAttachmentBar *bar, GdkEvent *event, void *data) { GnomeIconList *icon_list; GList *p; @@ -869,18 +869,22 @@ attachment_bar_icon_clicked_cb (CalAttachmentBar *bar, void *data) char *attach_file_url; GError *error = NULL; - icon_list = GNOME_ICON_LIST (bar); - p = gnome_icon_list_get_selection (icon_list); - if (p) { - num = GPOINTER_TO_INT (p->data); - attach_file_url = cal_attachment_bar_get_nth_attachment_filename (bar, num); - /* launch the url now */ - /* TODO should send GError and handle error conditions - * here */ - gnome_url_show (attach_file_url, &error); - if (error) - g_message ("DEBUG: Launch failed :(\n"); - g_free (attach_file_url); } + if (E_IS_CAL_ATTACHMENT_BAR (bar) && event->type == GDK_2BUTTON_PRESS) { + icon_list = GNOME_ICON_LIST (bar); + p = gnome_icon_list_get_selection (icon_list); + if (p) { + num = GPOINTER_TO_INT (p->data); + attach_file_url = cal_attachment_bar_get_nth_attachment_filename (bar, num); + /* launch the url now */ + /* TODO should send GError and handle error conditions + * here */ + gnome_url_show (attach_file_url, &error); + if (error) + g_message ("DEBUG: Launch failed :(\n"); + g_free (attach_file_url); } + return TRUE; + } else + return FALSE; } static void @@ -945,7 +949,7 @@ setup_widgets (CompEditor *editor) gtk_widget_show (priv->attachment_bar); g_signal_connect (priv->attachment_bar, "changed", G_CALLBACK (attachment_bar_changed_cb), editor); - g_signal_connect (GNOME_ICON_LIST (priv->attachment_bar), "button-release-event", + g_signal_connect (GNOME_ICON_LIST (priv->attachment_bar), "event", G_CALLBACK (attachment_bar_icon_clicked_cb), NULL); priv->attachment_expander_label = gtk_label_new_with_mnemonic (_("Show _Attachment Bar (drop attachments here)")); -- cgit v1.2.3