Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Some improvements #20

Merged

Conversation

liferooter
Copy link
Contributor

@liferooter liferooter commented Dec 17, 2021

Some code and mechanism improvements

@liferooter liferooter changed the title Draft: A lof of improvements Draft: Some improvements Dec 18, 2021
@Prince781
Copy link
Member

Thanks for your efforts, @liferooter . I'll take a look at this soon when I'm done with finals.
One thing you should keep in mind is that I wrote this code to be compatible with Vala 0.48 and Ubuntu 20.04 / eOS 6. If you're changing things, please make sure that Valdo is still compatible with those OSes. For example, null-safe member accesses are nice but are too recent in Vala for me to use.

@liferooter
Copy link
Contributor Author

If you're changing things, please make sure that Valdo is still compatible with those OSes.

Okay, I'll try to keep compability and test on these OSes

@Prince781
Copy link
Member

Prince781 commented Dec 28, 2021

@liferooter You should try to get this stuff merged soon. I think I'd prefer if you sent me multiple PRs, that way I can evaluate your changes more thoroughly and merge them sooner before merge conflicts arise.

@liferooter
Copy link
Contributor Author

You should try to get this stuff merged soon.

Okay, I'll finish today

@liferooter liferooter marked this pull request as ready for review December 28, 2021 17:53
@liferooter liferooter force-pushed the wip/liferooter/a-lot-of-improvements branch from cd0e206 to 3ec337d Compare December 28, 2021 18:01
@liferooter
Copy link
Contributor Author

@Prince781 now PR has no conflicts and ready for review and merging

@Prince781
Copy link
Member

A couple of things:

  1. Running valdo without any arguments should show a list of all available templates. You must not remove this behavior.
  2. Deserializing the template JSON fails on Ubuntu 20.04:
ubuntu@ubuntu:~/dev/valdo$ valdo -l

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"
Available templates:
--------------------
lib         - (null)
gtk         - (null)
new         - (null)
swifty-gtk4 - (null)
eos         - (null)
ubuntu@ubuntu:~/dev/valdo$ 

@liferooter
Copy link
Contributor Author

liferooter commented Dec 28, 2021

Running valdo without any arguments should show a list of all available templates. You must not remove this behavior.

I think that such behavior is non-typical and non-intuitive, doesn't it?

Copy link
Member

@Prince781 Prince781 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. Multiple changes needed. You also need to rename the files back to have the .in suffix. I explained why in one of my review comments.

src/expression.vala Outdated Show resolved Hide resolved
src/expression.vala Show resolved Hide resolved
src/main.vala Outdated Show resolved Hide resolved
src/templateengine.vala Show resolved Hide resolved
templates/eos/template.json Show resolved Hide resolved
templates/gtk/template.json Show resolved Hide resolved
templates/lib/template.json Show resolved Hide resolved
templates/new/template.json Show resolved Hide resolved
templates/swifty-gtk4/template.json Show resolved Hide resolved
@Prince781
Copy link
Member

I think that such behavior is non-typical and non-intuitive, doesn't it?

It's perfectly intuitive—the user sees all available templates if he/she didn't request one. There's no rule that says you can't do this. And if you want to talk about other programs that do a similar thing, dotnet new does this too.

@Prince781
Copy link
Member

I think the rest of the code is pretty well-organized. I wrote this quickly and so it's nice to see someone taking the time to make the code look nice. 😃

@liferooter
Copy link
Contributor Author

2. Deserializing the template JSON fails on Ubuntu 20.04:
ubuntu@ubuntu:~/dev/valdo$ valdo -l

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"

(valdo:3132): Json-WARNING **: 15:46:29.593: Failed to deserialize "description" property of type "(null)" for an object of type "ValdoTemplate"
Available templates:
--------------------
lib         - (null)
gtk         - (null)
new         - (null)
swifty-gtk4 - (null)
eos         - (null)
ubuntu@ubuntu:~/dev/valdo$ 

Just reproduces this bug in Ubuntu 20.04 VM. Have no idea what's wrong and how to fix it without manuary reading every property of every class. But all works on Elementary OS 6.1 with Vala 0.48.20 and there will be new Ubuntu LTS soon with even newer Vala. So may I spit on compatibility with too old Ubuntu which requires to make the app don't use some really needed Vala features?

@Prince781
Copy link
Member

But all works on Elementary OS 6.1 with Vala 0.48.20 and there will be new Ubuntu LTS soon with even newer Vala. So may I spit on compatibility with too old Ubuntu which requires to make the app don't use some really needed Vala features?

Yes, but then you must change meson.build to require json-glib >= 1.5.2

Copy link
Member

@Prince781 Prince781 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Prince781 Prince781 force-pushed the wip/liferooter/a-lot-of-improvements branch from 48390c9 to ec6ba4e Compare December 30, 2021 23:14
@Prince781
Copy link
Member

I had to keep a workaround for JSON-GLib 1.4.4 because eOS 7 won't come out for another 5-6 months and this package won't be updated for the current release.

@Prince781 Prince781 force-pushed the wip/liferooter/a-lot-of-improvements branch from ec6ba4e to dacc7fb Compare December 30, 2021 23:19
@Prince781 Prince781 merged commit f3959de into vala-lang:master Dec 30, 2021
@Prince781
Copy link
Member

@liferooter merged. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants