GNOME Bugzilla – Bug 307515
drag and drop variable symbol onto watches for simple expressions
Last modified: 2011-03-09 20:29:50 UTC
I'd like to double click over a variable symbol in the source, then drag and drop that onto the "watches", to add it as a simple expression. For more complex expressions, perhaps a ctrl-drop would pop up a dialog? It should be smart about pointers and structs... Other information:
Middle-click pasting should do the same thing.
Dragging is fine, but not middle-click. Middle click defines a paste and we are not pasting anything. It will confuse the usability, imho.
Created attachment 182863 [details] [review] Nancí's patch
Review of attachment 182863 [details] [review]: Thanks for you patch, I have tried and it's working fine. I have a small remark: gtk_drag_dest_set(debug_tree_get_tree_widget (ew->debug_tree), GTK_DEST_DEFAULT_ALL, drag_targets, 4, GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK); Can be written in a bit better way like this gtk_drag_dest_set(debug_tree_get_tree_widget (ew->debug_tree), GTK_DEST_DEFAULT_ALL, drag_targets, sizeof (drag_targets) / sizeof (drag_targets[0]), GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK); The sizeof operator gives you the size of the element, it's working on variables and types. Here you get the number of elements of the drag_targets array. So you can add new elements in this array without having to change anything here. Then, I have another question. I don't understand the goal of the following lines: tl = gtk_drag_dest_get_target_list (GTK_WIDGET (debug_tree_get_tree_widget (ew->debug_tree))); if (tl != NULL) { GdkAtom target = gdk_atom_intern_static_string ("application/x-watch-signal"); gtk_target_list_add (tl, target, GTK_TARGET_OTHER_WIDGET, TARGET_WATCH); } What is the use of this code?
(In reply to comment #4) > Review of attachment 182863 [details] [review]: > > Thanks for you patch, I have tried and it's working fine. > > I have a small remark: > gtk_drag_dest_set(debug_tree_get_tree_widget (ew->debug_tree), > GTK_DEST_DEFAULT_ALL, > drag_targets, > 4, > GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK); > Can be written in a bit better way like this > gtk_drag_dest_set(debug_tree_get_tree_widget (ew->debug_tree), > GTK_DEST_DEFAULT_ALL, > drag_targets, > sizeof (drag_targets) / sizeof (drag_targets[0]), > GDK_ACTION_COPY|GDK_ACTION_MOVE|GDK_ACTION_LINK); > > The sizeof operator gives you the size of the element, it's working on > variables and types. Here you get the number of elements of the drag_targets > array. So you can add new elements in this array without having to change > anything here. Thanks, nice. > > Then, I have another question. I don't understand the goal of the following > lines: > tl = gtk_drag_dest_get_target_list (GTK_WIDGET (debug_tree_get_tree_widget > (ew->debug_tree))); > > if (tl != NULL) > { > GdkAtom target = gdk_atom_intern_static_string > ("application/x-watch-signal"); > gtk_target_list_add (tl, target, GTK_TARGET_OTHER_WIDGET, TARGET_WATCH); > } > What is the use of this code? It can be removed. I first thought I would need it, because I saw this way on some places and the dropping wasn't working. Later I realized that it was not needed, but I forgot to remove, sorry.
Thanks Nancí, I have committed your patch with the few changes above.