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

Fix Gtk.Popover select translate and save state select language. #1399

Open
wants to merge 4 commits into
base: gtk4
Choose a base branch
from

Conversation

keygenqt
Copy link

my_gif

Added saving of language selection for translation, it is very inconvenient to select a new translation language each time. In addition to this, there is a bug related to Gtk.Popover & select (after selecting a language, the window can only be closed with focus on select, I have not yet figured out how to overcome this, it looks like a gtk bug).

If it is possible to save the state in the application without using localStorage, I will be glad if you tell me.

@marsaif
Copy link

marsaif commented Sep 17, 2024

thank you so much for adding this feature

@johnfactotum
Copy link
Owner

Using localStorage is okay (in theory using GSettings would be better but probably not worth the trouble).

But I would like to prevent it from leaking into other contexts, if possible (preferably each tool should have a separate origin). That's mainly why I haven't gotten around to fixing this. I think I attempted to set a different origin by setting the URL to foliate:selection-tool... but apparently that doesn't work.

But maybe it doesn't matter. But perhaps it should at least use a different URI scheme, to separate it from the main foliate: scheme.

@keygenqt keygenqt changed the title Add save state select translate. Fix Gtk.Popover select translate and save state select language. Sep 19, 2024
@keygenqt
Copy link
Author

keygenqt commented Sep 19, 2024

my_gif

Now that's ok. I don't really understand GJS, as I understand the problem Gtk.Popover + Gtk.DropDown/select is not new https://gitlab.gnome.org/GNOME/gtk/-/issues/5568. I fixed Popover by replacing select with buttons and add saving via localStorage. Maybe I didn't do everything perfectly, but it works =)

width: 100%;
}
footer div {
white-space: nowrap;
Copy link
Owner

Choose a reason for hiding this comment

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

The text will not always fit. You might try setting the flex-basis to max-content or fit-content but still allow it to shrink and wrap. The same applies to the . Also should probably add a gap so that the texts won't run together.

Copy link
Author

Choose a reason for hiding this comment

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

There are no such long names. I added a fix for correct output.

Screenshot from 2024-09-24 07-54-05

Copy link
Owner

Choose a reason for hiding this comment

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

It's very much possible that the line would not fit. The texts are localized and in other languages they could be much longer than they are in English. Also the font is set to menu, so the text could also become too long depending on the font set by the user.

Copy link
Author

Choose a reason for hiding this comment

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

No matter how long the text is, the layout will not float, and the user will find what he needs in the pop-up. I fixed it.

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.

3 participants