Skip to content

Commit

Permalink
Part of ProcessView ported
Browse files Browse the repository at this point in the history
  • Loading branch information
stsdc committed Nov 23, 2023
1 parent cea210d commit ef5a39c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
10 changes: 4 additions & 6 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow {
// Widgets
public Headerbar headerbar;

// public ProcessView process_view;
public ProcessView process_view;
// public SystemView system_view;
public ContainerView container_view;
private Gtk.Stack stack;
Expand All @@ -30,13 +30,13 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow {

resources = new Resources ();

// process_view = new ProcessView ();
process_view = new ProcessView ();
// system_view = new SystemView (resources);
container_view = new ContainerView ();

stack = new Gtk.Stack ();
stack.set_transition_type (Gtk.StackTransitionType.SLIDE_LEFT_RIGHT);
stack.add_titled (new Gtk.Label ("string? str"), "process_view", _("Processes"));
stack.add_titled (process_view, "process_view", _("Processes"));
stack.add_titled (new Gtk.Label ("string? str"), "system_view", _("System"));

if (MonitorApp.settings.get_boolean ("containers-view-state")) {
Expand Down Expand Up @@ -86,9 +86,7 @@ public class Monitor.MainWindow : Gtk.ApplicationWindow {

new Thread<void> ("upd", () => {
Timeout.add_seconds (MonitorApp.settings.get_int ("update-time"), () => {
// process_view.update ();


process_view.update ();
container_view.update ();


Expand Down
26 changes: 13 additions & 13 deletions src/Views/ProcessView/ProcessInfoView/ProcessInfoView.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
public class Monitor.ProcessInfoView : Gtk.Box {
private Preventor preventor;
// private Preventor preventor;
private ProcessInfoIOStats process_info_io_stats = new ProcessInfoIOStats ();

private Process _process;
Expand All @@ -20,7 +20,7 @@ public class Monitor.ProcessInfoView : Gtk.Box {
if (_process.uid != Posix.getuid ()) {
process_info_cpu_ram.hide ();
process_info_io_stats.hide ();
preventor.hide ();
// preventor.hide ();
} else {
_process.fd_permission_error.connect (show_permission_error_infobar);

Expand Down Expand Up @@ -107,27 +107,27 @@ public class Monitor.ProcessInfoView : Gtk.Box {
process_action_bar.append (end_process_button);
process_action_bar.append (kill_process_button);

preventor = new Preventor (process_action_bar, "process_action_bar");
// preventor = new Preventor (process_action_bar, "process_action_bar");

kill_process_button.clicked.connect (() => {
preventor.set_prevention (_("Confirm kill of the process?"));
preventor.confirmed.connect ((is_confirmed) => {
if (is_confirmed) process.kill (); // maybe add a toast that process killed
});
// preventor.set_prevention (_("Confirm kill of the process?"));
// preventor.confirmed.connect ((is_confirmed) => {
// if (is_confirmed) process.kill (); // maybe add a toast that process killed
// });
});

end_process_button.clicked.connect (() => {
preventor.set_prevention (_("Confirm end of the process?"));
preventor.confirmed.connect ((is_confirmed) => {
if (is_confirmed) process.end (); // maybe add a toast that process ended
});
// preventor.set_prevention (_("Confirm end of the process?"));
// preventor.confirmed.connect ((is_confirmed) => {
// if (is_confirmed) process.end (); // maybe add a toast that process ended
// });
});

grid.attach (preventor, 0, 5, 1, 1);
// grid.attach (preventor, 0, 5, 1, 1);

process_info_cpu_ram.hide ();
process_info_io_stats.hide ();
preventor.hide ();
// preventor.hide ();
}

private void show_permission_error_infobar (string error) {
Expand Down
2 changes: 1 addition & 1 deletion src/Views/ProcessView/ProcessView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Monitor.ProcessView : Gtk.Box {
}

public ProcessView () {
treeview_model = new TreeViewModel ();
treeview_model = TreeViewModel.get_default ();

process_tree_view = new CPUProcessTreeView (treeview_model);
process_tree_view.process_selected.connect ((process) => on_process_selected (process));
Expand Down
4 changes: 2 additions & 2 deletions src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ source_app_files = [
'Utils.vala',

# Views
# 'Views/ProcessView/ProcessView.vala',
# 'Views/ProcessView/ProcessInfoView/ProcessInfoView.vala',
'Views/ProcessView/ProcessView.vala',
'Views/ProcessView/ProcessInfoView/ProcessInfoView.vala',
'Views/ProcessView/ProcessTreeView/CPUProcessTreeView.vala',

'Views/PreferencesView/PreferencesView.vala',
Expand Down

0 comments on commit ef5a39c

Please sign in to comment.