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

Allow an About menu item in File to be used as special #4934

Merged
merged 6 commits into from
Jun 17, 2024

Conversation

andydotxyz
Copy link
Member

@andydotxyz andydotxyz commented Jun 13, 2024

to replace the macOS about in the app menu

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

@coveralls
Copy link

Coverage Status

coverage: 65.555% (-0.02%) from 65.57%
when pulling a524443 on andydotxyz:feature/about-override
into 389162b on fyne-io:develop.

@Jacalz
Copy link
Member

Jacalz commented Jun 13, 2024

I suppose this is targeted towards 2.6 given that we are in a feature freeze, right?

@andydotxyz
Copy link
Member Author

Hmm, in a sense yes. But this is a small enabler that should have landed months ago as part of the new About window in fyne-x. Given that I'm tempted to try and convince you there is no new feature here (and certainly no new api :) )

@andydotxyz
Copy link
Member Author

Sending my apologies as this was discovered in git stashes very late in the release process and I should have processed them all ages ago.

@dweymouth
Copy link
Contributor

Tested it and it works, I can't say I'm a fan of the "magic strings" approach but it's what was already in place for settings/preferences. We should document this better because I didn't even know this existed. Also we'll need to think about the magic string approach now that we have localization/translation, but that doesn't block this PR.

Copy link
Member

@toaster toaster left a comment

Choose a reason for hiding this comment

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

  • don’t modify the input menu
  • fix handleSpecialItems (add test cases revealing the flaws if they don’t already exist)
  • fix memory leak in (and probably optimize) insertDarwinMenuItem

internal/driver/glfw/menu_darwin.go Outdated Show resolved Hide resolved
internal/driver/glfw/menu_darwin.go Outdated Show resolved Hide resolved
item = [menu itemArray][0];
[item setAction:@selector(tapped:)];
[item setTarget:[FyneMenuHandler class]];
[item setTag:id+menuTagMin];
Copy link
Member

Choose a reason for hiding this comment

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

id is a keyword. What does it do here?

internal/driver/glfw/menu_darwin.m Outdated Show resolved Hide resolved
@coveralls
Copy link

Coverage Status

coverage: 65.636% (+0.07%) from 65.57%
when pulling b3d09d6 on andydotxyz:feature/about-override
into 389162b on fyne-io:develop.

@Jacalz
Copy link
Member

Jacalz commented Jun 14, 2024

I'm sorry; I like the idea behind the change but I'm not that keen on letting things through, it defeats the purpose of having a feature freeze. Given that idea with it is to let things stabilise and allow us to focus more on bug fixing, I'd be tempted to say that merging PR:s that already are open is a step too far already. What's the point in having a process for the feature freeze if we don't follow it?

@andydotxyz
Copy link
Member Author

What's the point in having a process for the feature freeze if we don't follow it?

Essentially the purpose of a release schedule on a large open source project is about corralling energy towards the release. If we cut off at a specific time all work because a date has passed then the enthusiasm that was going into those items wanes and we have to work again to resuscitate the item 3-4 months later after we have been working on bug fixing. I don't wish to break process but I do want to see the best release we can make in the approximate timescales.

@andydotxyz
Copy link
Member Author

In this specific instance it is absolutely my fault - the about screen landed in fyne-x about 3 months ago and I forgot about this tweak that makes it more useful. The result will be macOS apps with multiple About menu entries for the next 4-6 months...

Copy link
Member

@toaster toaster left a comment

Choose a reason for hiding this comment

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

  • remove unnecessary condition
  • deduplicate code
  • add “About” menu test case

Nice to have:

  • add test which would have detected the misbehaviour of the first implementation

Comment on lines 148 to 150
if i < len(menu.Items)-1 {
items = append(items, menu.Items[i+1:]...)
}
Copy link
Member

Choose a reason for hiding this comment

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

This condition is not necessary. I vote to remove it again.

Copy link
Member

Choose a reason for hiding this comment

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

Also, the two cases of the switch contain the same code, AFAICS. That should be consolidated.

Copy link
Member

Choose a reason for hiding this comment

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

And: Where are the tests?

Please add an “About” case to the existing test in menu_darwin_test.go.
Also, I’d really hoped for a test checking the flaws that were introduced without being detected.

Copy link
Member Author

Choose a reason for hiding this comment

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

I reverted the code to the older recursive version - some of the test cases seemed to only work that way. About is now added to tests

@coveralls
Copy link

Coverage Status

coverage: 65.693% (+0.1%) from 65.57%
when pulling 2af30b0 on andydotxyz:feature/about-override
into 389162b on fyne-io:develop.

@andydotxyz andydotxyz requested a review from toaster June 16, 2024 20:25
@andydotxyz andydotxyz merged commit 8894f52 into fyne-io:develop Jun 17, 2024
12 checks passed
@andydotxyz andydotxyz deleted the feature/about-override branch June 17, 2024 08:28
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.

5 participants