[gnac] Double click rather than single click on the tree view to add files.



commit 9c4af5afc55c29ecc1e4203bd15b5b7aa5fcb823
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Tue Aug 25 09:05:18 2009 +0200

    Double click rather than single click on the tree view to add files.

 src/gnac-file-list.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/gnac-file-list.c b/src/gnac-file-list.c
index b1c3e97..97ed118 100644
--- a/src/gnac-file-list.c
+++ b/src/gnac-file-list.c
@@ -692,18 +692,27 @@ gnac_file_list_on_button_pressed(GtkWidget      *treeview,
                                  GdkEventButton *event, 
                                  gpointer        user_data)
 {  
+  gboolean expanded;
   gboolean ret = FALSE;
-  if (event->type == GDK_BUTTON_PRESS) {
-    gboolean expanded;
-    GtkTreePath *path;
+  GtkTreePath *path;
 
-    expanded = gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
-        (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL);
+  expanded = gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
+      (gint) event->x, (gint) event->y, &path, NULL, NULL, NULL);
 
+  /* double click */
+  if (event->type == GDK_2BUTTON_PRESS) 
+  {
+    /* left click on an empty line */
     if (event->button == 1 && !expanded) {
       gnac_on_ui_add_cb(treeview, NULL);
       ret = TRUE;
-    } else if (event->button == 3) {
+    }
+  }
+  /* single click */
+  else if (event->type == GDK_BUTTON_PRESS) 
+  {
+    /* right click */
+    if (event->button == 3) {
       if (expanded && gnac_file_list_count_selected_rows() <= 1) {
         GtkTreeRowReference *reference;
         reference = gtk_tree_row_reference_new(model, path);
@@ -714,10 +723,10 @@ gnac_file_list_on_button_pressed(GtkWidget      *treeview,
       gnac_ui_show_popup_menu(treeview, event, user_data);
       ret = TRUE;
     }
-
-    gtk_tree_path_free(path);
   }
 
+  gtk_tree_path_free(path);
+
   return ret;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]