Skip to content

GridView: current_grid_key → set_page#699

Merged
danirabbit merged 13 commits intomasterfrom
danirabbit/gridview-carouselfuncs
Mar 9, 2026
Merged

GridView: current_grid_key → set_page#699
danirabbit merged 13 commits intomasterfrom
danirabbit/gridview-carouselfuncs

Conversation

@danirabbit
Copy link
Member

@danirabbit danirabbit commented Mar 6, 2026

Replace current_grid_key property with a set_page function. Changes the names of public functions to specify "page"

This also changes the index to be 0 based

@danirabbit danirabbit requested a review from a team March 6, 2026 19:38
Copy link
Member

@leolost2605 leolost2605 left a comment

Choose a reason for hiding this comment

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

I don't know a lot about the code base but makes sense to me :) Just a few comments

danirabbit and others added 4 commits March 7, 2026 07:15
Co-authored-by: Leonhard <leo.kargl@proton.me>
Co-authored-by: Leonhard <leo.kargl@proton.me>
Co-authored-by: Leonhard <leo.kargl@proton.me>
@danirabbit danirabbit requested a review from leolost2605 March 7, 2026 17:40
@danirabbit

This comment was marked as resolved.

@leolost2605
Copy link
Member

@danirabbit yes thank you!

@danirabbit danirabbit changed the title GridView: use carousel as source of truth for page pos GridView: current_grid_key → set_page Mar 8, 2026
@danirabbit
Copy link
Member Author

@leolost2605 okay this branch now only contains the final change from current_grid_key to set_page

Copy link
Member

@leolost2605 leolost2605 left a comment

Choose a reason for hiding this comment

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

LGTM only one comment

@@ -264,9 +264,9 @@ public class Slingshot.SlingshotView : Gtk.Bin, UnityClient {
var key = Gdk.keyval_name (keyval).replace ("KP_", "");
int page = int.parse (key);
if (page < 0 || page == 9) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (page < 0 || page == 9) {
if (page <= 0 || page == 9) {

I think this should also trigger at 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

If we changed that to = 0 then it would go the last page on 0 instead of the first page. I'm not sure that's expected? Unless we change also 9 to go to page 9 and 0 to be last page?

Copy link
Member

@leolost2605 leolost2605 Mar 8, 2026

Choose a reason for hiding this comment

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

Yeah I was a bit confused because I missed that on master the current grid key was clamped. I thought it was intended that 0 was last page because it's all the way to the right but I didn't look very close. The main thing why I mentioned it is because afaict with this PR we would then set_page (-1).

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah which afaict still works the same as in master. Is it okay if we consider this separately since I didn't change the behavior?

Copy link
Member

@leolost2605 leolost2605 Mar 9, 2026

Choose a reason for hiding this comment

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

Hmm maybe I'm doing something wrong but for me on master alt + 0 would switch to the first page and with this branch it doesn't do anything. And afaict what's happening is that we overflow the uint because we have -1, which causes nth_data to return null because our list doesn't have uint.max entries. And even if this would somehow be handled and then switch to the first page I'm not sure relying on an overflow is good practice (?) so IMO we should handle this explicitly. Whether that's going to the first or last page I really don't have a strong opinion about but ig first page makes sense to stay in line with master for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

@leolost2605 got it! Made 0 and 9 explicit so we're not relying on the math here. Also I moved the conditional for the view mode check, so it should be easier to read. Might want to review with hide whitespace changes

@danirabbit danirabbit requested a review from leolost2605 March 9, 2026 17:34
Copy link
Member

@leolost2605 leolost2605 left a comment

Choose a reason for hiding this comment

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

LGTM thanks for the patience :)

@danirabbit
Copy link
Member Author

@leolost2605 thank you for the thorough review!

@danirabbit danirabbit enabled auto-merge (squash) March 9, 2026 19:15
@danirabbit danirabbit merged commit a710410 into master Mar 9, 2026
4 checks passed
@danirabbit danirabbit deleted the danirabbit/gridview-carouselfuncs branch March 9, 2026 19:16
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