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 591971 - Translation Memories - gtranslator hangs when no directory is selected and add button is pressed
Translation Memories - gtranslator hangs when no directory is selected and ad...
Status: RESOLVED FIXED
Product: gtranslator
Classification: Other
Component: general
HEAD
Other All
: High critical
: 2.0
Assigned To: gtranslator-maint
gtranslator-maint
Depends on:
Blocks:
 
 
Reported: 2009-08-16 14:38 UTC by fpuga
Modified: 2012-03-24 10:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Warning dialog if path is blank (1.39 KB, patch)
2012-03-23 11:12 UTC, Daniel Mustieles
needs-work Details | Review
Previous patch reviewed and fixed (1.41 KB, patch)
2012-03-23 19:01 UTC, Daniel Mustieles
needs-work Details | Review
Minor changes (1.40 KB, patch)
2012-03-23 19:32 UTC, Daniel Mustieles
needs-work Details | Review
More changes (1.25 KB, patch)
2012-03-23 19:44 UTC, Daniel Mustieles
none Details | Review
git diff patch (643 bytes, patch)
2012-03-23 20:09 UTC, Daniel Mustieles
none Details | Review
Patch (1.85 KB, patch)
2012-03-23 20:16 UTC, Daniel Mustieles
none Details | Review

Description fpuga 2009-08-16 14:38:01 UTC
Edit -> Preferences -> Translation Memories

If "add to database" button is clicked leaving directory field empty gtranslator hangs.

Also if non existing directory is entered gtranslator tries to process it instead of display a warning.

I think that some king of test must be done on function "on_add_database_button_pulsed".
Comment 1 Daniel Mustieles 2012-03-23 11:12:56 UTC
Created attachment 210404 [details] [review]
Warning dialog if path is blank

This patch adds a warning dialog if the user presses the button without selecting a folder.

Maybe you could add an extra condition to verify that the folders exists
Comment 2 Ignacio Casal Quinteiro (nacho) 2012-03-23 11:22:31 UTC
Review of attachment 210404 [details] [review]:

Please update the patch in relation to the comments pointed inline.

::: plugins/translation-memory/gtr-translation-memory-dialog.c
@@ +224,3 @@
+
+  /*
+   * If path is blank, show a warning message

/* If path is empty, show a warning message */

@@ +227,3 @@
+   */
+  if (*path == '\0')
+    {

declare here the GtkDialog *dialog;

@@ +228,3 @@
+  if (*path == '\0')
+    {
+      g_free (path);

no need to free the path, it is owned by the entry

@@ +234,3 @@
+                                       GTK_BUTTONS_CLOSE, NULL);
+
+    {

Do not use set_markup, you are not using any markup in the message, use set_text

@@ +236,3 @@
+       gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), _("Please specify a valid path to build the translation memory"));
+
+      g_free (path);

Do not use dialog_run, it is getting deprecated. Use something like: gtk_widget_show ();
g_signal_connect (dialog, "response",
                  G_CALLBACK (gtk_widget_destroy), NULL));

@@ +237,3 @@
+
+       gtk_dialog_run (GTK_DIALOG (dialog));
+      g_free (path);

no need for this with the previous message

@@ +238,3 @@
+       gtk_dialog_run (GTK_DIALOG (dialog));
+       gtk_widget_destroy (dialog);
+      dialog = gtk_message_dialog_new (data->parent,

wrong indentation here?

@@ +240,3 @@
+    }
+    else
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,

wrong indentation?

@@ +266,3 @@
   g_object_unref (dir);
+
+    }//Verify if path is blank or not

no need for this comment
Comment 3 Daniel Mustieles 2012-03-23 19:01:19 UTC
Created attachment 210461 [details] [review]
Previous patch reviewed and fixed

Right, sorry for the incovenience, but this is my first patch for source code.

I hope now it is ok.
Comment 4 Ignacio Casal Quinteiro (nacho) 2012-03-23 19:05:41 UTC
Review of attachment 210461 [details] [review]:

Some more minor comments.

::: plugins/translation-memory/gtr-translation-memory-dialog.c
@@ +232,3 @@
+                                       GTK_MESSAGE_WARNING,
+                                       GTK_BUTTONS_CLOSE,
+  if (*path == '\0')

the _() should be in one line

@@ +264,3 @@
                    data, (GDestroyNotify) destroy_idle_data);
 
   g_object_unref (dir);

this is wrongly indented
Comment 5 Daniel Mustieles 2012-03-23 19:32:42 UTC
Created attachment 210468 [details] [review]
Minor changes

Again! ;-)
Comment 6 Ignacio Casal Quinteiro (nacho) 2012-03-23 19:37:42 UTC
Review of attachment 210468 [details] [review]:

more comments

::: plugins/translation-memory/gtr-translation-memory-dialog.c
@@ +238,3 @@
+                        G_CALLBACK (gtk_widget_destroy), NULL);
+    }
+      dialog = gtk_message_dialog_new (data->parent,

this else has too much indentation, it should be at the same level of the if

@@ +239,3 @@
+    }
+    else
+                                       GTK_DIALOG_DESTROY_WITH_PARENT,

I mean what about all the code inside this block?
Comment 7 Daniel Mustieles 2012-03-23 19:44:39 UTC
Created attachment 210471 [details] [review]
More changes

I've written it based in the previous code. I don't know the rules about indentationin GNOME's source code.

Please, if indentation is still wrong, fix it yourself, and tell me about the changes.

Thanks and sorry for the incovenience
Comment 8 Ignacio Casal Quinteiro (nacho) 2012-03-23 19:47:45 UTC
One last request provide a format-patch, for this you have to commit the patch locally and create the patch with git format-patch, this way I can give you the credit for the patch.
Comment 9 Daniel Mustieles 2012-03-23 20:09:00 UTC
Created attachment 210481 [details] [review]
git diff patch

Trying again...
Comment 10 Ignacio Casal Quinteiro (nacho) 2012-03-23 20:12:45 UTC
It does not look like a format-patch. Just do like usual:
git commit -a
The message
and instead of push you do: git format-patch origin
Comment 11 Daniel Mustieles 2012-03-23 20:16:46 UTC
Created attachment 210483 [details] [review]
Patch

Ok, I didn't know how to do it.

I hope this is the final chapter of this patch ;-)
Comment 12 Ignacio Casal Quinteiro (nacho) 2012-03-24 08:56:32 UTC
See here the final patch: http://git.gnome.org/browse/gtranslator/commit/?id=7a0214bbfb9256fd1af1390de507037d69626f1b

As you can see the message of the commit is more specific and after double checking I changed a few more things. Thanks for working on this.
Comment 13 Daniel Mustieles 2012-03-24 10:09:09 UTC
Thanks for your help. Now, I know how to create a git-based patch :)