sync with 0.9.12cvs28 HEAD
[claws.git] / src / mimeview.c
index 3354c827bb559e466ee6df5263e459234404d4e5..49a81545e751e5b8946f6917ce57025e8481e84d 100644 (file)
@@ -798,11 +798,17 @@ static gint mimeview_button_pressed(GtkWidget *widget, GdkEventButton *event,
        return FALSE;
 }
 
+/* from gdkevents.c */
+#define DOUBLE_CLICK_TIME 250
+
 static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event, 
                                    MimeInfo *partinfo)
 {
+       static MimeInfo *lastinfo;
+       static guint32 lasttime;
+
        if (event->button == 2 ||
-           (event->button == 1 && event->type == GDK_2BUTTON_PRESS)) {
+           (event->button == 1 && (event->time - lasttime) < DOUBLE_CLICK_TIME && lastinfo == partinfo)) {
                /* call external program for image, audio or html */
                mimeview_launch(mimeview);
                return TRUE;
@@ -834,6 +840,8 @@ static gboolean part_button_pressed(MimeView *mimeview, GdkEventButton *event,
                return TRUE;
        }
 
+       lastinfo = partinfo;
+       lasttime = event->time;
        return FALSE;
 }
 
@@ -1335,8 +1343,6 @@ static gboolean icon_clicked_cb (GtkWidget *button, GdkEventButton *event, MimeV
                if (event->button == 2 || event->button == 3)
                        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button),
                                                     TRUE);
-       } else {
-               g_signal_stop_emission_by_name(G_OBJECT(button), "button_release_event");
        }
 
        part_button_pressed(mimeview, event, partinfo);