Commit fa7c1318 authored by Petr Štětka's avatar Petr Štětka
Browse files

Added basic stop (kill) process.

parent b3e3f17f
......@@ -3,10 +3,12 @@ namespace Usage
public class ProcessDialog : Gtk.Dialog
{
private Gtk.Widget kill_button;
private uint pid;
public ProcessDialog()
public ProcessDialog(uint pid)
{
Object(use_header_bar: 1);
this.pid = pid;
this.title = "Process";
this.border_width = 5;
set_default_size (350, 100);
......@@ -32,6 +34,7 @@ namespace Usage
switch(response_id)
{
case Gtk.ResponseType.HELP:
kill_process(pid);
destroy();
break;
case Gtk.ResponseType.CLOSE:
......@@ -39,5 +42,10 @@ namespace Usage
break;
}
}
private void kill_process(uint pid)
{
Posix.kill ((Posix.pid_t) pid, Posix.SIGKILL);
}
}
}
\ No newline at end of file
......@@ -51,7 +51,7 @@ namespace Usage
switch_details();
else
{
var dialog = new ProcessDialog();
var dialog = new ProcessDialog(pid);
dialog.show_all ();
}
......
......@@ -37,7 +37,7 @@ namespace Usage
event_box.add(main_box);
event_box.button_press_event.connect ((event) => {
var dialog = new ProcessDialog();
var dialog = new ProcessDialog(pid);
dialog.show_all ();
return false;
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment