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 642991 - Prevent glade plugin from creating a callback that already exists.
Prevent glade plugin from creating a callback that already exists.
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: glade
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Anjuta maintainers
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2011-02-22 19:53 UTC by Marco Diego Aurélio Mesquita
Modified: 2012-03-14 20:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to prevent glade plugin from creating a callback that already exists. (2.31 KB, patch)
2011-02-22 19:53 UTC, Marco Diego Aurélio Mesquita
committed Details | Review
Identation fix. (2.13 KB, patch)
2011-02-22 20:23 UTC, Marco Diego Aurélio Mesquita
committed Details | Review
Scrolls to a callback if it is already defined (2.52 KB, patch)
2011-02-22 23:14 UTC, Marco Diego Aurélio Mesquita
committed Details | Review
Sets the caret position to the body of a callback (1.05 KB, patch)
2011-02-23 03:53 UTC, Marco Diego Aurélio Mesquita
committed Details | Review
Small improvements for callback generation on glade signal drop. (5.35 KB, patch)
2011-02-23 04:52 UTC, Marco Diego Aurélio Mesquita
reviewed Details | Review
Code improvements on glade signal drop. (2.25 KB, patch)
2011-02-23 19:23 UTC, Marco Diego Aurélio Mesquita
committed Details | Review

Description Marco Diego Aurélio Mesquita 2011-02-22 19:53:45 UTC
Created attachment 181623 [details] [review]
Patch to prevent glade plugin from creating a callback that already exists.

The attached patch prevents the glade plugin from creating a callback that already exists. Please review it.
Comment 1 Marco Diego Aurélio Mesquita 2011-02-22 20:23:27 UTC
Created attachment 181633 [details] [review]
Identation fix.

The attached patch fixes identation issues with my previous patch. Please review it.
Comment 2 Marco Diego Aurélio Mesquita 2011-02-22 23:14:48 UTC
Created attachment 181653 [details] [review]
Scrolls to a callback if it is already defined

Improved the on_glade_drop callback so that now it scrolls to the callback if it is already defined.
Comment 3 Marco Diego Aurélio Mesquita 2011-02-23 03:53:16 UTC
Created attachment 181668 [details] [review]
Sets the caret position to the body of a callback

The attached patch sets the cursor position to the body of a callback that is created using the glade plugin. It is an small but important usability improvement. Please review it.
Comment 4 Marco Diego Aurélio Mesquita 2011-02-23 04:52:55 UTC
Created attachment 181671 [details] [review]
Small improvements for callback generation on glade signal drop.

The attached patch improves the code for generation of callbacks on glade signal drop. Please review it.
Comment 5 Johannes Schmid 2011-02-23 18:47:05 UTC
Review of attachment 181623 [details] [review]:

OK, looks fine with the indentation fix.
Comment 6 Johannes Schmid 2011-02-23 18:47:34 UTC
Review of attachment 181653 [details] [review]:

Nice addition!
Comment 7 Johannes Schmid 2011-02-23 18:52:44 UTC
Review of attachment 181671 [details] [review]:

Looks good overall, see my small comments below.

::: plugins/language-support-cpp-java/plugin.c
@@ +553,2 @@
 	IAnjutaIterable *iter;
+	if ((iter = language_support_find_symbol (lang_plugin, split_signal_data[2])) == NULL)

I would prefer if the handler temp variable would be kept because split_signal_data[2] doesn't tell you much about what actually happens here.

@@ +559,3 @@
 			{
+				language_support_add_c_callback (editor, iterator, split_signal_data,
+												 "\n", "\n{\n\n}\n", 4);

The offset parameter should be a constant #define'd somewhere. No magic numbers in code please. I haven't tested it but I guess it could be useful to call ianjuta_indenter_indent() on the line where the caret is put because that would make sure the cursor is at the correct indendation.

@@ +565,3 @@
 			{
+				language_support_add_c_callback (editor, iterator, split_signal_data,
+												 " ", ";\n", 1);

dito with the #define for the offset
Comment 8 Marco Diego Aurélio Mesquita 2011-02-23 19:23:34 UTC
Created attachment 181739 [details] [review]
Code improvements on glade signal drop.

The attached patch implements Johannes Schmid's requirements. Please review it.
Comment 9 Johannes Schmid 2011-02-23 20:14:55 UTC
Review of attachment 181739 [details] [review]:

OK, this looks good now.
Comment 10 Johannes Schmid 2011-02-23 20:18:41 UTC
There is one more thing in C that we could implement. In on_glade_drop_possible() we could check if we are in the global scope. If ianjuta_symbol_manager_get_scope() returns NULL (or a file scope, not entirely sure) we are outside any existing function and dropping is possible. Otherwise, we are inside and dropping won't be a good idea.
In addition we could possible check if we are inside a comment but that could be out-of-scope a bit.

What would be great would be if you could implement the additions you made for C for Python, too. language-support-python has basically the same concept as C (with some easier things because python is simpler than C). But I could also benefit from setting the cursor postions correctly.

Thanks!
Comment 11 Marco Diego Aurélio Mesquita 2011-02-23 20:51:19 UTC
It is strange: http://anjuta.sourceforge.net/documents/libanjuta/libanjuta-ianjuta-symbol-manager.html says something about the method:

IAnjutaIterable* (*get_scope) (IAnjutaSymbolManager *obj, const gchar* filename,  gulong line,  IAnjutaSymbolField info_fields, GError **err);

But libanjuta/interfaces/ianjuta-symbol-manager.h does no declares it. Was it removed recently?
Comment 12 Marco Diego Aurélio Mesquita 2011-02-23 20:56:39 UTC
Looks like it was removed by this commit: http://git.gnome.org/browse/anjuta/commit/?id=ee5b00981f9045ada874baf12996887b4b29cd8c

Can it be reverted?
Comment 13 Marco Diego Aurélio Mesquita 2011-02-23 22:26:39 UTC
(In reply to comment #10)
> There is one more thing in C that we could implement. In
> on_glade_drop_possible() we could check if we are in the global scope. If
> ianjuta_symbol_manager_get_scope() returns NULL (or a file scope, not entirely
> sure) we are outside any existing function and dropping is possible. Otherwise,
> we are inside and dropping won't be a good idea.

Doesn't seem too complicated, but I'm stuck in https://bugzilla.gnome.org/show_bug.cgi?id=643139
Comment 14 Marco Diego Aurélio Mesquita 2012-03-14 16:15:14 UTC
Glade plugin already avoids creating a callback that already exists. The rest of the discussion should go to https://bugzilla.gnome.org/show_bug.cgi?id=643139 . Please close this bug.