Skip to content

Renamer: Avoid listbox get_children#2564

Merged
jeremypw merged 6 commits intomainfrom
danirabbit/renamer-listboxiter
Mar 24, 2025
Merged

Renamer: Avoid listbox get_children#2564
jeremypw merged 6 commits intomainfrom
danirabbit/renamer-listboxiter

Conversation

@danirabbit
Copy link
Member

There is no more ListBox.get_children () in GTK4

There's one place I didn't replace here and it's the block starting at line 154. I suppose we could iterate over the list and add to a counter to get the number of children? Alternatively if we switched this whole thing to use a ListModel we could get the number of items in the model, but we'd need to add a "new_name" property to Files.File. Thoughts @jeremypw?

@danirabbit danirabbit moved this to Needs Review in GTK4 Porting Mar 20, 2025
@jeremypw
Copy link
Contributor

I thought I had already rewritten this somewhere avoiding getting the number of children but I can't seem to locate it atm. If I can't find it I'll do it again.

@jeremypw
Copy link
Contributor

As we only add rows in one place and never remove them, the simplest solution is to just count them as they are added. Using a model would be more elegant if rows are added and removed adhoc.

@jeremypw jeremypw merged commit e8aba11 into main Mar 24, 2025
4 checks passed
@jeremypw jeremypw deleted the danirabbit/renamer-listboxiter branch March 24, 2025 19:05
@github-project-automation github-project-automation bot moved this from Needs Review to Done in GTK4 Porting Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants