After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 307515 - drag and drop variable symbol onto watches for simple expressions
drag and drop variable symbol onto watches for simple expressions
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: debug-manager
2.0.x
Other All
: Normal enhancement
: ---
Assigned To: Anjuta maintainers
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2005-06-13 14:38 UTC by Karl Hegbloom
Modified: 2011-03-09 20:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Nancí's patch (2.89 KB, patch)
2011-03-08 20:16 UTC, Sébastien Granjoux
reviewed Details | Review

Description Karl Hegbloom 2005-06-13 14:38:56 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:
Comment 1 Karl Hegbloom 2005-06-13 14:40:31 UTC
Middle-click pasting should do the same thing.
Comment 2 Naba Kumar 2007-02-12 16:42:03 UTC
Dragging is fine, but not middle-click. Middle click defines a paste and we are not pasting anything. It will confuse the usability, imho.
Comment 3 Sébastien Granjoux 2011-03-08 20:16:18 UTC
Created attachment 182863 [details] [review]
Nancí's patch
Comment 4 Sébastien Granjoux 2011-03-08 20:20:52 UTC
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?
Comment 5 Nanci de Brito Bonfim 2011-03-08 22:51:59 UTC
(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.
Comment 6 Sébastien Granjoux 2011-03-09 20:29:50 UTC
Thanks Nancí, I have committed your patch with the few changes above.