Conversation
…dering if integer values do not change on the view
danirabbit
reviewed
Mar 5, 2026
| 'Views/ProcessView/ProcessView.vala', | ||
| 'Views/ProcessView/ProcessInfoView/ProcessInfoView.vala', | ||
| 'Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala', | ||
| # 'Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala', |
danirabbit
reviewed
Mar 5, 2026
Comment on lines
+139
to
+149
| public void collapse_all () { | ||
| // Method implementation | ||
| } | ||
|
|
||
| public void focus_on_child_row () { | ||
| // Method implementation | ||
| } | ||
|
|
||
| public void focus_on_first_row () { | ||
| // Method implementation | ||
| } |
danirabbit
reviewed
Mar 5, 2026
| public class Monitor.ProcessTreeView : Granite.Bin { | ||
| private Gtk.ColumnView list; | ||
|
|
||
| public ProcessTreeView (TreeViewModel model) { |
Member
There was a problem hiding this comment.
Can we do this gobject style?
danirabbit
reviewed
Mar 5, 2026
Member
danirabbit
left a comment
There was a problem hiding this comment.
Made a few comments about code style etc
| var cpu_item_factory = new Gtk.SignalListItemFactory (); | ||
| var memory_item_factory = new Gtk.SignalListItemFactory (); | ||
| var pid_item_factory = new Gtk.SignalListItemFactory (); | ||
|
|
Comment on lines
+25
to
+50
| name_item_factory.setup.connect ((factory, obj) => { | ||
| var cell = obj as Gtk.ColumnViewCell; | ||
|
|
||
| var box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 4) { | ||
| hexpand = true, | ||
| halign = Gtk.Align.START | ||
| }; | ||
| var icon = new Gtk.Image.from_icon_name ("application-x-executable") { | ||
| pixel_size = 16 | ||
| }; | ||
|
|
||
| box.append (icon); | ||
| box.append (new Gtk.Label (Utils.NO_DATA)); | ||
| cell.child = box; | ||
| }); | ||
|
|
||
| name_item_factory.bind.connect ((factory, obj) => { | ||
| var cell = obj as Gtk.ColumnViewCell; | ||
| var box = cell.child as Gtk.Box; | ||
| var label = box.get_last_child () as Gtk.Label; | ||
| var icon = box.get_first_child () as Gtk.Image; | ||
|
|
||
| var item = cell.item as ProcessRowData; | ||
| label.set_text (item.name); | ||
| icon.gicon = item.icon; | ||
| }); |
Member
There was a problem hiding this comment.
Can we do these as functions instead of lambdas?
Comment on lines
+67
to
+70
| var cell = obj as Gtk.ColumnViewCell; | ||
| var label = cell.child as Gtk.Label; | ||
| var item = cell.item as ProcessRowData; | ||
| label.set_text ("%.0f%%".printf (item.cpu)); |
Member
There was a problem hiding this comment.
Code style is to cast with parentheses and to prefer properties over setter functions:
Suggested change
| var cell = obj as Gtk.ColumnViewCell; | |
| var label = cell.child as Gtk.Label; | |
| var item = cell.item as ProcessRowData; | |
| label.set_text ("%.0f%%".printf (item.cpu)); | |
| var cell = (Gtk.ColumnViewCell) obj; | |
| var label = (Gtk.Label) cell.child; | |
| var item = (ProcessRowData) cell.item; | |
| label.text = "%.0f%%".printf (item.cpu); |
| var cell = obj as Gtk.ColumnViewCell; | ||
| cell.child = new Gtk.Label (Utils.NO_DATA) { | ||
| hexpand = true, | ||
| halign = Gtk.Align.START |
Member
There was a problem hiding this comment.
We can ommit namespaces for constants
Suggested change
| halign = Gtk.Align.START | |
| halign = START |
Comment on lines
+93
to
+105
| string units = _("KiB"); | ||
|
|
||
| // convert to MiB if needed | ||
| if (memory_usage_double > 1024.0) { | ||
| memory_usage_double /= 1024.0; | ||
| units = _("MiB"); | ||
| } | ||
|
|
||
| // convert to GiB if needed | ||
| if (memory_usage_double > 1024.0) { | ||
| memory_usage_double /= 1024.0; | ||
| units = _("GiB"); | ||
| } |
Member
There was a problem hiding this comment.
Can we use https://valadoc.org/glib-2.0/GLib.format_size.html here instead?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The intend is to future proof the process list and lay some ground for a tree view reintroduction.