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 669023 - Anjuta should automatically detect which file will hold members for ui widgets.
Anjuta should automatically detect which file will hold members for ui widgets.
Status: RESOLVED FIXED
Product: anjuta
Classification: Applications
Component: plugins: glade
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Anjuta maintainers
Anjuta maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-30 12:40 UTC by Marco Diego Aurélio Mesquita
Modified: 2012-02-08 20:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Automatically detect which file that will hold member widgets declaration and initialization. (9.95 KB, patch)
2012-01-30 12:40 UTC, Marco Diego Aurélio Mesquita
none Details | Review
Automatically detect which file that will hold member widgets declaration and initialization. (11.06 KB, patch)
2012-01-31 11:34 UTC, Marco Diego Aurélio Mesquita
needs-work Details | Review
Automatically detect which file that will hold member widgets declaration and initialization. (11.04 KB, patch)
2012-01-31 19:15 UTC, Marco Diego Aurélio Mesquita
committed Details | Review

Description Marco Diego Aurélio Mesquita 2012-01-30 12:40:50 UTC
Created attachment 206416 [details] [review]
Automatically detect which file that will hold member widgets declaration and initialization.

The attached patch implements automatic file detection for the file that will hold member widgets declaration and initialization. The typename is currently unused, but is required for proper Vala integration.

Please review it.
Comment 1 Abderrahim Kitouni 2012-01-30 20:57:37 UTC
Review of attachment 206416 [details] [review]:

Should be OK for Vala, thanks.

I'm however not sure it is acceptable to assume that the source file and ui file are in the same directory.

One more thing: your style doesn't seem very consistent, especially regarding space after function name.

::: plugins/glade/plugin.c
@@ +354,3 @@
+	if(docs) {
+		gchar *widget_name = glade_widget_get_name (widget);
+		gchar *widget_typename = G_OBJECT_TYPE_NAME (G_OBJECT (glade_widget_get_object(widget)));

you don't need the G_OBJECT cast here

@@ +358,3 @@
+			IAnjutaDocument *curr_doc = IANJUTA_DOCUMENT(data);
+			if(IANJUTA_IS_EDITOR(curr_doc)) {
+				printf("Emitting signal!\n");

A forgotten debug statement? You can use DEBUG_PRINT if you want to keep it.

::: plugins/language-support-cpp-java/plugin.c
@@ +893,3 @@
+	gchar *current_filedir = g_file_get_path (g_file_get_parent (current_file));
+
+	/* Continue only if files are on the same dir */

I'm not sure this restriction is OK. Often the ui file isn't in the same directory as the source files.
Comment 2 Marco Diego Aurélio Mesquita 2012-01-30 23:40:40 UTC
(In reply to comment #1)
> Review of attachment 206416 [details] [review]:
> 
> Should be OK for Vala, thanks.

You're welcome.

> 
> I'm however not sure it is acceptable to assume that the source file and ui
> file are in the same directory.

I'll remove this constraint.

> 
> One more thing: your style doesn't seem very consistent, especially regarding
> space after function name.

I'll proof-read the patch.

> 
> ::: plugins/glade/plugin.c
> @@ +354,3 @@
> +    if(docs) {
> +        gchar *widget_name = glade_widget_get_name (widget);
> +        gchar *widget_typename = G_OBJECT_TYPE_NAME (G_OBJECT
> (glade_widget_get_object(widget)));
> 
> you don't need the G_OBJECT cast here

I'll remove it.

> 
> @@ +358,3 @@
> +            IAnjutaDocument *curr_doc = IANJUTA_DOCUMENT(data);
> +            if(IANJUTA_IS_EDITOR(curr_doc)) {
> +                printf("Emitting signal!\n");
> 
> A forgotten debug statement? You can use DEBUG_PRINT if you want to keep it.

I'll remove it.

> 
> ::: plugins/language-support-cpp-java/plugin.c
> @@ +893,3 @@
> +    gchar *current_filedir = g_file_get_path (g_file_get_parent
> (current_file));
> +
> +    /* Continue only if files are on the same dir */
> 
> I'm not sure this restriction is OK. Often the ui file isn't in the same
> directory as the source files.

I'll remove it.
Comment 3 Marco Diego Aurélio Mesquita 2012-01-31 11:34:10 UTC
Created attachment 206508 [details] [review]
Automatically detect which file that will hold member widgets declaration and initialization.

The attached patch addresses comments of latest review. Please review it.
Comment 4 Johannes Schmid 2012-01-31 18:41:05 UTC
Review of attachment 206508 [details] [review]:

See my small comments.

::: plugins/glade/plugin.c
@@ +358,1 @@
+	void send_signal (gpointer data, gpointer user_data) {

Please follow the coding style.

::: plugins/language-support-cpp-java/plugin.c
@@ +923,3 @@
+		// Since this signal is not disconnect on plugin uninstall, we have to prevent multiple connection.
+		if (!g_signal_handler_find (lang_plugin->current_editor,
+									G_SIGNAL_MATCH_FUNC,

The indentation here seems messed up.
Comment 5 Marco Diego Aurélio Mesquita 2012-01-31 19:15:27 UTC
Created attachment 206546 [details] [review]
Automatically detect which file that will hold member widgets declaration and initialization.

The attached patch fixes latest comments. Please review it.
Comment 6 Johannes Schmid 2012-01-31 19:18:44 UTC
Review of attachment 206546 [details] [review]:

Looks good!
Comment 7 Abderrahim Kitouni 2012-02-08 20:15:46 UTC
Review of attachment 206546 [details] [review]:

I've committed this patch (and implemented your feature for the vala plugin). This bug can be closed now.