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
library: Adds columnview entry #437
Conversation
I've implemented the following:
P.S:
What else can be demonstrated here? @andyholmes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is starting to shape up.
Let's get the UI a little more polished, because we still need to demonstrate column sorters, resizing, and probably want to do column that has a different type like an icon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, once the date column is reporting a basic date, it's on to the "fun" part: column sorting.
Do you want to work through column sorting together, or if I link you to Gtk.ColumnView.get_sorter()
as a hint do you can get the name column sorting?
factory.connect("bind", (factory, list_item) => { | ||
const label_widget = list_item.get_child(); | ||
const model_item = list_item.get_item(); | ||
label_widget.label = model_item.get_size().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we want to use a human readable size here, but let's leave that for the polish phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to double-check my math, but this should be good enough:
if (Math.floor(size / 1_000_000_000) > 0)
label_widget.label = `${(size / 1_000_000_000).toFixed(1)} GB`
else if (Math.floor(size / 1_000_000) > 0)
label_widget.label = `${(size / 1_000_000).toFixed(1)} MB`
else if (Math.floor(size / 1000) > 0)
label_widget.label = `${(size / 1000).toFixed(1)} kB`
else
label_widget.label = `${(size / 1000)} bytes`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job!
This is tough one, and it's going to help a lot of people. Let's get the thing polished up, and it's good to merge.
factory.connect("bind", (factory, list_item) => { | ||
const label_widget = list_item.get_child(); | ||
const model_item = list_item.get_item(); | ||
label_widget.label = model_item.get_size().toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Be sure to double-check my math, but this should be good enough:
if (Math.floor(size / 1_000_000_000) > 0)
label_widget.label = `${(size / 1_000_000_000).toFixed(1)} GB`
else if (Math.floor(size / 1_000_000) > 0)
label_widget.label = `${(size / 1_000_000).toFixed(1)} MB`
else if (Math.floor(size / 1000) > 0)
label_widget.label = `${(size / 1000).toFixed(1)} kB`
else
label_widget.label = `${(size / 1000)} bytes`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
* Add columnview * test * Update * Clean Up and implement colview * Refactoring and applied suggested changes * Applied changes * Progress * Updated * Update * Update * Reverse * Applied Suggested Changes * Minor Change
No description provided.