Skip to content

Fix #85 - Invalid icon & validation improvements - #121

Open
tennox wants to merge 12 commits into
artemanufrij:masterfrom
tennox:fix-edit-view
Open

Fix #85 - Invalid icon & validation improvements#121
tennox wants to merge 12 commits into
artemanufrij:masterfrom
tennox:fix-edit-view

Conversation

@tennox

@tennox tennox commented Nov 24, 2019

Copy link
Copy Markdown

Well - first, the 'edit' view showed "create new web app".

Then the bug:

When no icon is found / selected, the icon_name is empty, but later the on_accept code checks File.new_for_path ("").query_exist () - which will just resolve to the working directory, and as that exists, it tries to load the working directory as icon:

WARNING **: Editor.vala:503: Failed to open file “”: No such file or directory

I fixed that by wrapping with icon.has_prefix("/")

And I also worked on the UX for invalid fields (tennox@0d82f02)

In some cases, the UI didn't show if fields are invalid - so the user doesn't know why the Save button is greyed out.
That's the UX problem of e.g. #85 (you don't see the icon is considered 'invalid')

I refactored so that Form field error status is updated in .validate (now called updateFormStatus), and the change listeners only set the validity boolean.

Other things I fixed along the way

  1. update the icon back to default if the name field is cleared.

  2. I also added validation feedback for the image button (although it feels weird to set class 'destructive-action', I found it to be the easiest :P)

  3. I also changed path detection from .contains ("/") to .has_prefix ("/") as I think we always have absolute paths. And I'm not sure if theme icon names could contain a '/'.

Manuel added 3 commits November 24, 2019 17:18
File.new_for_path("") will just resolve to the working directory, and as that exists, it tries to load the working directory as icon.

I also changed path detection from `.contains ("/")` to `.has_prefix ("/")` as I think we always have absolute paths. And I'm not sure if theme icon names could contain a '/'.
In some edge cases, the UI doesn't show if fields are invalid - so the user doesn't know why the Save button is greyed out.

That's the UX problem of e.g. artemanufrij#85

I refactored so that Form field error status is updated in .validate (now called 'updateFormStatus'), and the change listeners only set the validity boolean.

Also update the icon back to default if the name field is cleared.

I also added validation feedback for the image button (although it feels weird to set class 'destructive-action', I found it to be the easiest :P)
@tennox tennox mentioned this pull request Nov 24, 2019

@ryonakano ryonakano left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It might be nitpicking, but left some coding style comments.

Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment thread src/Widgets/Views/Editor.vala Outdated
Comment on lines +568 to +574

public void set_class(Gtk.Widget widget, string class_name, bool flag) {
if (flag)
widget.get_style_context().add_class(class_name);
else
widget.get_style_context().remove_class(class_name);
} No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why don't you include this method in the Editor class?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I thought static was better - then we could move it to a utils file in case it's needed somewhere else 🤷‍♂️

Comment thread src/Widgets/WebItem.vala Outdated
tennox and others added 9 commits December 6, 2019 14:38
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
Co-Authored-By: Ryo Nakano <26003928+ryonakano@users.noreply.github.com>
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