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

feat: Port dialogs to AdwDialog #623

Closed
wants to merge 9 commits into from

Conversation

sungsphinx
Copy link
Contributor

I managed to port most dialogs/windows, except the input remote (and probably the same for the media remote) because the app kept hanging and not responding when trying to show them.

@andyholmes
Copy link
Owner

Thanks, I'm super backlogged today, but I'll have a look through when I get a chance 👍

Copy link
Owner

@andyholmes andyholmes left a comment

Choose a reason for hiding this comment

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

Looking pretty good, thanks!

The tests in tests/libvalent/ui need to be updated, check for the #define VALENT_TYPE_TEST_SUBJECT at the top of the files.

Also the struct member(s) in valent-window.c/valent-device-preferences-page.c need to be changed from GtkWindow to AdwDialog with:

- g_clear_pointer (&self->preferences, gtk_window_destroy);
+ g_clear_pointer (&self->preferences, adw_dialog_force_close);

Might need to change a few of the above in tests/libvalent/ui/ as well. For now, the only test that needs to pass is the Flatpak (unstable) one, the others will pas when the Fedora image is updated.

Let me know if you need any help!

src/libvalent/ui/valent-device-page.c Outdated Show resolved Hide resolved
src/libvalent/ui/valent-device-page.c Outdated Show resolved Hide resolved
src/libvalent/ui/valent-device-page.c Outdated Show resolved Hide resolved
src/libvalent/ui/valent-window.c Outdated Show resolved Hide resolved
src/libvalent/ui/valent-window.c Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
libadwaita_version = '>= 1.4'
libadwaita_version = '>= 1.5.alpha'
Copy link
Owner

Choose a reason for hiding this comment

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

This will have to be changed to '>= 1.5' before merge.

@sungsphinx
Copy link
Contributor Author

Looking pretty good, thanks!

The tests in tests/libvalent/ui need to be updated, check for the #define VALENT_TYPE_TEST_SUBJECT at the top of the files.

Also the struct member(s) in valent-window.c/valent-device-preferences-page.c need to be changed from GtkWindow to AdwDialog with:

- g_clear_pointer (&self->preferences, gtk_window_destroy);
+ g_clear_pointer (&self->preferences, adw_dialog_force_close);

Might need to change a few of the above in tests/libvalent/ui/ as well. For now, the only test that needs to pass is the Flatpak (unstable) one, the others will pas when the Fedora image is updated.

Let me know if you need any help!

Hi, I am very sorry about this reply being very late, but I need some help with this:

Hopefully I am understanding what the code is supposed to do correctly.

In test-device-preferences-window.c (same for test-preferences-window.c), the code uses gtk_window_present which does not require specifying a parent GtkWidget or window, however adw_dialog_present requires it. The problem I face is that there is no definition to the parent window available, so I am not sure what to do, it might just be that I am kind of tired right now 😅

@andyholmes
Copy link
Owner

Hi, I am very sorry about this reply being very late, but I need some help with this:

No problem :)

Hopefully I am understanding what the code is supposed to do correctly.

In test-device-preferences-window.c (same for test-preferences-window.c), the code uses gtk_window_present which does not require specifying a parent GtkWidget or window, however adw_dialog_present requires it. The problem I face is that there is no definition to the parent window available, so I am not sure what to do, it might just be that I am kind of tired right now 😅

It looks like that can just be NULL: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.Dialog.present.html

If that ends up not working for some reason, you can just do a gtk_window_new() and pass that as the argument.

@sungsphinx
Copy link
Contributor Author

Hi, I am very sorry about this reply being very late, but I need some help with this:

No problem :)

Hopefully I am understanding what the code is supposed to do correctly.
In test-device-preferences-window.c (same for test-preferences-window.c), the code uses gtk_window_present which does not require specifying a parent GtkWidget or window, however adw_dialog_present requires it. The problem I face is that there is no definition to the parent window available, so I am not sure what to do, it might just be that I am kind of tired right now 😅

It looks like that can just be NULL: https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/method.Dialog.present.html

If that ends up not working for some reason, you can just do a gtk_window_new() and pass that as the argument.

Didn't realize you could set it as NULL, oops 😅

sungsphinx and others added 2 commits March 3, 2024 17:47
Bumps [fsfe/reuse-action](https://github.com/fsfe/reuse-action) from 2
to 3.
- [Release notes](https://github.com/fsfe/reuse-action/releases)
- [Commits](fsfe/reuse-action@v2...v3)

---
updated-dependencies:
- dependency-name: fsfe/reuse-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@sungsphinx
Copy link
Contributor Author

Ok... I have no idea what's going on with git 🤨

@andyholmes
Copy link
Owner

Oh weird, did that happen with a git rebase?

@sungsphinx
Copy link
Contributor Author

sungsphinx commented Mar 3, 2024

Oh weird, did that happen with a git rebase?

Yea, I am probably going to re-do the branch and open a new PR to clean it up.

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