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 735053 - [PATCH] Use GtkBuilder.
[PATCH] Use GtkBuilder.
Status: RESOLVED FIXED
Product: iagno
Classification: Applications
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: iagno-maint
iagno-maint
Depends on:
Blocks:
 
 
Reported: 2014-08-19 13:28 UTC by Arnaud B.
Modified: 2014-09-16 15:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use GtkBuilder. (11.53 KB, patch)
2014-08-19 13:28 UTC, Arnaud B.
accepted-commit_after_freeze Details | Review
Use GtkBuilder. (14.48 KB, patch)
2014-08-19 14:14 UTC, Arnaud B.
reviewed Details | Review
Use GtkBuilder. (13.46 KB, patch)
2014-08-19 14:54 UTC, Arnaud B.
reviewed Details | Review
Use GtkBuilder. (14.84 KB, patch)
2014-08-19 23:37 UTC, Arnaud B.
accepted-commit_after_freeze Details | Review
Use GtkBuilder for preferences' dialog. (13.27 KB, patch)
2014-08-20 19:31 UTC, Arnaud B.
reviewed Details | Review
Use GtkBuilder for preferences' dialog. (13.45 KB, patch)
2014-08-22 14:04 UTC, Arnaud B.
reviewed Details | Review
Use GtkBuilder for preferences' dialog. (13.43 KB, patch)
2014-08-22 15:07 UTC, Arnaud B.
accepted-commit_after_freeze Details | Review
Use GtkBuilder. (16.88 KB, patch)
2014-09-16 01:58 UTC, Arnaud B.
committed Details | Review
Use GtkBuilder for preferences’ dialog. (13.28 KB, patch)
2014-09-16 02:00 UTC, Arnaud B.
committed Details | Review
Bump Gtk+ required version to 3.13.4. (642 bytes, patch)
2014-09-16 04:10 UTC, Arnaud B.
committed Details | Review
Use GResource. (6.85 KB, patch)
2014-09-16 04:11 UTC, Arnaud B.
none Details | Review
Use GResource. (6.46 KB, patch)
2014-09-16 05:02 UTC, Arnaud B.
none Details | Review
Use GResource. (7.41 KB, patch)
2014-09-16 05:09 UTC, Arnaud B.
committed Details | Review
Using Gtk namespace in iagno.vala. (10.75 KB, patch)
2014-09-16 11:51 UTC, Arnaud B.
rejected Details | Review
Let startup() do its work instead of activate(), and reorder. (5.37 KB, patch)
2014-09-16 12:08 UTC, Arnaud B.
reviewed Details | Review
Let startup() do its work instead of activate(), and reorder. (5.45 KB, patch)
2014-09-16 14:48 UTC, Arnaud B.
committed Details | Review

Description Arnaud B. 2014-08-19 13:28:51 UTC
Created attachment 283884 [details] [review]
Use GtkBuilder.

Now that the UI is frozen, let’s change the code! =D
Comment 1 Michael Catanzaro 2014-08-19 13:50:17 UTC
Review of attachment 283884 [details] [review]:

Looks straightforward. I like UI files.

Ideally you would follow this up with a patch to split the menu into a separate UI file named menu.ui, since I don't like hiding the menu in the same file.
Comment 2 Arnaud B. 2014-08-19 14:14:27 UTC
Created attachment 283898 [details] [review]
Use GtkBuilder.

I prefer doing all in one patch (using `git mv`…).
Comment 3 Michael Catanzaro 2014-08-19 14:32:39 UTC
Review of attachment 283898 [details] [review]:

I think iagno-menu.ui needs to be added to POTFILES.in.
Comment 4 Arnaud B. 2014-08-19 14:54:19 UTC
Created attachment 283901 [details] [review]
Use GtkBuilder.
Comment 5 Michael Catanzaro 2014-08-19 22:51:02 UTC
Review of attachment 283901 [details] [review]:

You forgot to 'git add data/iagno-menu.ui'
Comment 6 Arnaud B. 2014-08-19 23:37:10 UTC
Created attachment 283939 [details] [review]
Use GtkBuilder.

You’re right, it could be useful… ^^’
Comment 7 Michael Catanzaro 2014-08-20 15:28:54 UTC
Review of attachment 283939 [details] [review]:

Thanks!
Comment 8 Arnaud B. 2014-08-20 19:31:41 UTC
Created attachment 283995 [details] [review]
Use GtkBuilder for preferences' dialog.

Here is a patch for the preferences' dialog. The GtkDialog itself isn’t in the ui file for the use-header-bar flag to be switchable if requested.
Comment 9 Michael Catanzaro 2014-08-22 02:19:59 UTC
Review of attachment 283995 [details] [review]:

Nits:

::: src/iagno.vala
@@ +487,3 @@
+        {
+            // TODO graphical error
+            stderr.printf ("Could not load UI: %s\n", e.message);

I would almost always use warning() or error() instead of stderr.printf().  In this case, error(), since something seriously horrible has gone wrong.  error() will cause the program to crash.

@@ +540,3 @@
         catch (FileError e)
         {
+            // TODO graphical error? sensitivity?

I would just change it to an error so that it crashes. (But in a different patch, not this one.  New TODOs are appreciated, just not in unrelated patches. :)
Comment 10 Arnaud B. 2014-08-22 14:04:25 UTC
Created attachment 284200 [details] [review]
Use GtkBuilder for preferences' dialog.

Using error() for the problems using UI files.
Comment 11 Michael Catanzaro 2014-08-22 14:46:37 UTC
Review of attachment 284200 [details] [review]:

Nits. Just set your next patch's status directly to accepted-commit-after-freeze.

::: src/iagno.vala
@@ +97,1 @@
             return;

Actually you don't return, since error() causes the program to crash. :)

@@ +487,3 @@
+        {
+            error ("Could not load UI: %s\n", e.message);
+            return;

Same here.
Comment 12 Arnaud B. 2014-08-22 15:07:39 UTC
Created attachment 284227 [details] [review]
Use GtkBuilder for preferences' dialog.

Here is it!
Comment 13 Michael Catanzaro 2014-09-15 22:29:25 UTC
Can you please rebase these?
Comment 14 Arnaud B. 2014-09-16 01:58:58 UTC
Created attachment 286246 [details] [review]
Use GtkBuilder.

Pushing Iulian’s patches first was *really not* a good idea. ^^’
Comment 15 Arnaud B. 2014-09-16 02:00:55 UTC
Created attachment 286247 [details] [review]
Use GtkBuilder for preferences’ dialog.

We really need to use GResource for menu and images, that will be probably the next bug opened.
Comment 16 Michael Catanzaro 2014-09-16 02:44:38 UTC
Of course pushing his patches first was a good idea! I didn't want the newest contributor to have to deal with the merge conflicts, and you're no longer the newest contributor. :) Yeah, I actually thought that through. Slightly evil towards you; sorry about that.

GResources are good for most programs, and we can certainly use one for our menu, but it's a bad fit for themeable games as that makes it dramatically more difficult for players to experiment with their own themes. User themes do occasionally make their way upstream (e.g. for 3.12 I replaced all but the high contrast themes in four-in-a-row with user-created themes) so we want to make sure those remain as easy as possible. In fact, we recently-ish changed Mahjongg to place its themes in a gresource; I'd like to undo that....
Comment 17 Michael Catanzaro 2014-09-16 02:45:40 UTC
Thanks!

P.S. I only branched a subset of the games today. I'll get to your accepted patches in the other games within the next week or so.

Attachment 286246 [details] pushed as 210d59f - Use GtkBuilder.
Comment 18 Arnaud B. 2014-09-16 04:10:04 UTC
Created attachment 286255 [details] [review]
Bump Gtk+ required version to 3.13.4.

(In reply to comment #16)
> Of course pushing his patches first was a good idea! I didn't want the newest
> contributor to have to deal with the merge conflicts, and you're no longer the
> newest contributor. :) Yeah, I actually thought that through. Slightly evil
> towards you; sorry about that.

Yeah, I had in mind you thought of it. But this one was really a hard time. ^^

> GResources are good for most programs, and we can certainly use one for our
> menu, but it's a bad fit for themeable games as that makes it dramatically more
> difficult for players to experiment with their own themes. User themes do
> occasionally make their way upstream (e.g. for 3.12 I replaced all but the high
> contrast themes in four-in-a-row with user-created themes) so we want to make
> sure those remain as easy as possible. In fact, we recently-ish changed
> Mahjongg to place its themes in a gresource; I'd like to undo that....

In a program like Iagno (same doesn’t apply to Mahjongg), having a default theme loaded via GResource looks like a good idea (not only thinking of removing the theme engine). Here comes a patch that puts the three new svgs and the UI files in a GResource, with autoloading of the app-menu. First patch just bumps Gtk+ version.
Comment 19 Arnaud B. 2014-09-16 04:11:28 UTC
Created attachment 286256 [details] [review]
Use GResource.
Comment 20 Arnaud B. 2014-09-16 04:28:29 UTC
Looks like I failed to reopen, and I don’t understand how to do that. xD
Comment 21 Arnaud B. 2014-09-16 05:02:07 UTC
Created attachment 286258 [details] [review]
Use GResource.

Forgot the preferences’ dialog.
Comment 22 Arnaud B. 2014-09-16 05:09:17 UTC
Created attachment 286259 [details] [review]
Use GResource.

Of course, I forgot to re-add the gresource file. ^^’
Comment 23 Arnaud B. 2014-09-16 11:51:38 UTC
Created attachment 286288 [details] [review]
Using Gtk namespace in iagno.vala.

A little cleaning, now that the GtkBuilder patches has landed. ^^
Comment 24 Arnaud B. 2014-09-16 12:08:40 UTC
Created attachment 286289 [details] [review]
Let startup() do its work instead of activate(), and reorder.

Here is a patch that puts the launching functions in the order they are called, so it’s quite more understandable; and so, that corrects the little hack of having all the code in activate() instead of in startup() but with a `if (window != null) return;` (so that the window could only be launched once).
Comment 25 Michael Catanzaro 2014-09-16 13:29:10 UTC
Review of attachment 286259 [details] [review]:

I hesitate to use a GResource for dark.svg and light.svg as that would have to be undone to fix bug #736693. The rest looks good.
Comment 26 Michael Catanzaro 2014-09-16 13:33:15 UTC
Review of attachment 286288 [details] [review]:

No, I think this makes the code harder to read. :(
Comment 27 Michael Catanzaro 2014-09-16 13:34:31 UTC
Review of attachment 286289 [details] [review]:

Yup! Marking as "reviewed" since it probably needs rebased.
Comment 28 Michael Catanzaro 2014-09-16 13:34:54 UTC
Comment on attachment 286255 [details] [review]
Bump Gtk+ required version to 3.13.4.

Yup
Comment 29 Arnaud B. 2014-09-16 13:38:01 UTC
(In reply to comment #25)
> I hesitate to use a GResource for dark.svg and light.svg as that would have to
> be undone to fix bug #736693. The rest looks good.

It could be at every moment replaced with gtk_image_set_from_icon_set(), if I’m
not mistaken. Having an UI file complete is quite better than having to look
many files to know what you are working on…
Comment 30 Arnaud B. 2014-09-16 14:48:57 UTC
Created attachment 286302 [details] [review]
Let startup() do its work instead of activate(), and reorder.

Yeah, the GResource patch should in my mind be pushed like this, whatever happens to themes. Here is an updated “reorder function” patch.
Comment 31 Michael Catanzaro 2014-09-16 15:16:06 UTC
I don't think treating the pieces as icons is appropriate.

But OK....

Attachment 286255 [details] pushed as ae661bb - Bump Gtk+ required version to 3.13.4.
Attachment 286259 [details] pushed as a4c6c10 - Use GResource.
Attachment 286302 [details] pushed as c7c25c0 - Let startup() do its work instead of activate(), and reorder.