diff --git a/glade/add-process-dialog.glade b/glade/add-process-dialog.glade
index d5b5fd8..ba9889b 100644
--- a/glade/add-process-dialog.glade
+++ b/glade/add-process-dialog.glade
@@ -1,154 +1,236 @@
-
-
-
+
+
+
-
- Add Process
- False
- True
- GTK_WIN_POS_MOUSE
- GDK_WINDOW_TYPE_HINT_DIALOG
-
-
- True
-
-
- True
- 6
- 3
- 2
- 9
- 11
-
-
- True
- 0,000000
- 0,000000
- Name
-
-
- GTK_FILL
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Base Priority
-
-
- 2
- 3
- GTK_FILL
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Arrival Time
-
-
- 1
- 2
- GTK_FILL
-
-
-
-
-
- True
- True
- ●
- 17
-
-
- 1
- 2
-
-
-
-
-
- True
- True
- 1,000000 1,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- True
- 0,000000 0,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 2
- 3
-
-
-
-
-
- 2
-
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
- True
- True
- True
- gtk-cancel
- True
- -6
-
-
-
-
- True
- True
- True
- True
- gtk-ok
- True
- -5
-
-
- 1
-
-
-
-
- False
- GTK_PACK_END
-
-
-
-
-
+
+
+ Add Process
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_MOUSE
+ True
+ False
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+ True
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+ True
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ 6
+ True
+ 3
+ 2
+ False
+ 11
+ 9
+
+
+
+ True
+ Name
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+
+
+
+
+
+
+
+ True
+ Base Priority
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 2
+ 3
+
+
+
+
+
+
+
+ True
+ Arrival Time
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+ 0
+
+ True
+ ●
+ False
+ 17
+
+
+ 1
+ 2
+ 0
+ 1
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
diff --git a/glade/add-request-dialog.glade b/glade/add-request-dialog.glade
index a4037d9..cdda078 100644
--- a/glade/add-request-dialog.glade
+++ b/glade/add-request-dialog.glade
@@ -1,296 +1,445 @@
-
-
-
+
+
+
-
- 300
- 240
- Add Request
- True
- GTK_WIN_POS_MOUSE
- GDK_WINDOW_TYPE_HINT_DIALOG
-
-
- True
-
-
- True
- 4
- 6
-
-
- True
- 6
-
-
- True
- 0,000000
- 0,000000
- Instant
-
-
- False
- False
-
-
-
-
- True
- True
- 0,000000 0,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
-
-
-
-
- False
- False
-
-
-
-
- True
- True
- GTK_POLICY_NEVER
- GTK_SHADOW_IN
-
-
- True
- True
- True
-
-
-
-
- 1
-
-
-
-
- True
- 2
- 2
- 6
- 6
-
-
- True
-
-
- 1
- 2
- GTK_FILL
- GTK_FILL
-
-
-
-
- True
- True
- 0,000000 1,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Resource
-
-
- GTK_FILL
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Duration
-
-
- 1
- 2
- GTK_FILL
-
-
-
-
-
- False
- False
- 2
-
-
-
-
- True
- 6
- GTK_BUTTONBOX_SPREAD
-
-
- True
- True
- True
-
-
- True
- 0,000000
- 0,000000
- 0,000000
- 0,000000
-
-
- True
- 2
-
-
- True
- 0,000000
- 0,000000
- gtk-add
-
-
- False
- False
-
-
-
-
- True
- 0,000000
- 0,000000
- Add
- True
-
-
- False
- False
- 1
-
-
-
-
-
-
-
-
-
-
- True
- True
- True
-
-
- True
- 0,000000
- 0,000000
- 0,000000
- 0,000000
-
-
- True
- 2
-
-
- True
- 0,000000
- 0,000000
- gtk-remove
-
-
- False
- False
-
-
-
-
- True
- 0,000000
- 0,000000
- Remove
- True
-
-
- False
- False
- 1
-
-
-
-
-
-
-
-
- 1
-
-
-
-
- False
- 3
-
-
-
-
- 2
-
-
-
-
- True
- GTK_BUTTONBOX_SPREAD
-
-
- True
- True
- True
- gtk-cancel
- True
- -6
-
-
-
-
- True
- True
- True
- True
- gtk-ok
- True
- -5
-
-
- 1
-
-
-
-
- False
- GTK_PACK_END
-
-
-
-
-
+
+
+ 300
+ 240
+ Add Request
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_MOUSE
+ True
+ True
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+ True
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ GTK_BUTTONBOX_SPREAD
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+ True
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ 4
+ True
+ False
+ 6
+
+
+
+ True
+ False
+ 6
+
+
+
+ True
+ Instant
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 0
+ True
+ True
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ True
+ GTK_POLICY_NEVER
+ GTK_POLICY_AUTOMATIC
+ GTK_SHADOW_IN
+ GTK_CORNER_TOP_LEFT
+
+
+
+ True
+ True
+ True
+ False
+ True
+ True
+ False
+ False
+ False
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+ True
+ 2
+ 2
+ False
+ 6
+ 6
+
+
+
+ True
+ False
+ True
+
+
+ 1
+ 2
+ 0
+ 1
+
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 1 1 inf 1 0 0
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+
+
+ True
+ Resource
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+
+
+
+
+
+
+
+ True
+ Duration
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+
+
+
+
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ 6
+ True
+ GTK_BUTTONBOX_SPREAD
+ 0
+
+
+
+ True
+ True
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ True
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ True
+ False
+ 2
+
+
+
+ True
+ gtk-add
+ 4
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ Add
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+
+ True
+ True
+ True
+ GTK_RELIEF_NORMAL
+ True
+
+
+
+ True
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+ True
+ False
+ 2
+
+
+
+ True
+ gtk-remove
+ 4
+ 0
+ 0
+ 0
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+ True
+ Remove
+ True
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ False
+ False
+
+
+
+
+
+
+
+
+
+
+ 0
+ False
+ True
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
diff --git a/glade/add-resource-dialog.glade b/glade/add-resource-dialog.glade
index 2338c5e..3c54b56 100644
--- a/glade/add-resource-dialog.glade
+++ b/glade/add-resource-dialog.glade
@@ -1,184 +1,288 @@
-
-
-
+
+
+
-
- Add Resource
- False
- True
- GTK_WIN_POS_MOUSE
- GDK_WINDOW_TYPE_HINT_DIALOG
-
-
- True
-
-
- True
- 6
- 4
- 2
- 9
- 11
-
-
- True
- 0,000000
- 0,000000
- Pre-emptable
-
-
- 3
- 4
- GTK_FILL
-
-
-
-
-
- True
- True
- True
- True
-
-
- 1
- 2
- 3
- 4
- GTK_FILL
-
-
-
-
-
- True
- True
- 0,000000 0,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 2
- 3
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Availability
-
-
- 2
- 3
- GTK_FILL
-
-
-
-
-
- True
- True
- 0,000000 1,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Places
-
-
- 1
- 2
- GTK_FILL
-
-
-
-
-
- True
- True
- ●
- 17
-
-
- 1
- 2
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Name
-
-
- GTK_FILL
-
-
-
-
-
- 2
-
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
- True
- True
- True
- gtk-cancel
- True
- -6
-
-
-
-
- True
- True
- True
- True
- gtk-ok
- True
- -5
-
-
- 1
-
-
-
-
- False
- GTK_PACK_END
-
-
-
-
-
+
+
+ Add Resource
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_MOUSE
+ True
+ False
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+ True
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+ True
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ 6
+ True
+ 4
+ 2
+ False
+ 11
+ 9
+
+
+
+ True
+ Pre-emptable
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 3
+ 4
+
+
+
+
+
+
+
+ True
+ True
+ GTK_RELIEF_NORMAL
+ True
+ False
+ False
+ True
+
+
+
+
+
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
+
+
+
+ True
+ Availability
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 2
+ 3
+
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 1 1 inf 1 0 0
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+
+
+ True
+ Places
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+ 0
+
+ True
+ ●
+ False
+ 17
+
+
+ 1
+ 2
+ 0
+ 1
+
+
+
+
+
+
+ True
+ Name
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
diff --git a/glade/add-thread-dialog.glade b/glade/add-thread-dialog.glade
index c19de68..84c5cd3 100644
--- a/glade/add-thread-dialog.glade
+++ b/glade/add-thread-dialog.glade
@@ -1,184 +1,285 @@
-
-
-
+
+
+
-
- Add Thread
- False
- True
- GTK_WIN_POS_MOUSE
- GDK_WINDOW_TYPE_HINT_DIALOG
-
-
- True
-
-
- True
- 6
- 4
- 2
- 9
- 11
-
-
- True
- True
- 0,000000 0,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 3
- 4
-
-
-
-
-
- True
- True
- 0,000000 0,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 2
- 3
-
-
-
-
-
- True
- True
- 0,000000 1,000000 0,000000 1,000000 10,000000 10,000000
- 1
- True
-
-
- 1
- 2
- 1
- 2
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Cpu Time
-
-
- 1
- 2
- GTK_FILL
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Arrival Time
-
-
- 2
- 3
- GTK_FILL
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Base Priority
-
-
- 3
- 4
- GTK_FILL
-
-
-
-
-
- True
- True
- ●
- 17
-
-
- 1
- 2
-
-
-
-
-
- True
- 0,000000
- 0,000000
- Name
-
-
- GTK_FILL
-
-
-
-
-
- 2
-
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
- True
- True
- True
- gtk-cancel
- True
- -6
-
-
-
-
- True
- True
- True
- True
- gtk-ok
- True
- -5
-
-
- 1
-
-
-
-
- False
- GTK_PACK_END
-
-
-
-
-
+
+
+ Add Thread
+ GTK_WINDOW_TOPLEVEL
+ GTK_WIN_POS_MOUSE
+ True
+ False
+ False
+ True
+ False
+ False
+ GDK_WINDOW_TYPE_HINT_DIALOG
+ GDK_GRAVITY_NORTH_WEST
+ True
+ False
+ True
+
+
+
+ True
+ False
+ 0
+
+
+
+ True
+ GTK_BUTTONBOX_END
+
+
+
+ True
+ True
+ True
+ gtk-cancel
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -6
+
+
+
+
+
+ True
+ True
+ True
+ True
+ gtk-ok
+ True
+ GTK_RELIEF_NORMAL
+ True
+ -5
+
+
+
+
+ 0
+ False
+ True
+ GTK_PACK_END
+
+
+
+
+
+ 6
+ True
+ 4
+ 2
+ False
+ 11
+ 9
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 1
+ 2
+ 3
+ 4
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 0 0 inf 1 0 0
+
+
+ 1
+ 2
+ 2
+ 3
+
+
+
+
+
+
+ True
+ True
+ 1
+ 0
+ True
+ GTK_UPDATE_ALWAYS
+ False
+ False
+ 1 1 inf 1 0 0
+
+
+ 1
+ 2
+ 1
+ 2
+
+
+
+
+
+
+ True
+ Cpu Time
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 1
+ 2
+
+
+
+
+
+
+
+ True
+ Arrival Time
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 2
+ 3
+
+
+
+
+
+
+
+ True
+ Base Priority
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 3
+ 4
+
+
+
+
+
+
+
+ True
+ True
+ True
+ True
+ 0
+
+ True
+ ●
+ False
+ 17
+
+
+ 1
+ 2
+ 0
+ 1
+
+
+
+
+
+
+ True
+ Name
+ False
+ False
+ GTK_JUSTIFY_LEFT
+ False
+ False
+ 0
+ 0
+ 0
+ 0
+ PANGO_ELLIPSIZE_NONE
+ -1
+ False
+ 0
+
+
+ 0
+ 1
+ 0
+ 1
+
+
+
+
+
+
+ 0
+ True
+ True
+
+
+
+
+
+
diff --git a/src/add_request_dialog.cc b/src/add_request_dialog.cc
index d93c223..4f57ccd 100644
--- a/src/add_request_dialog.cc
+++ b/src/add_request_dialog.cc
@@ -44,12 +44,19 @@ AddRequestDialog::AddRequestDialog(BaseObjectType* cobject, const RefPtr& g
_glade->get_widget("Add", _add_button);
_glade->get_widget("Remove", _remove_button);
_glade->get_widget("Resource.Combo", _resource_combo);
-
-
+ _glade->get_widget("OK.Button", _ok_button);
+
/** ATTACH SIGNAL HANDLERS FOR BUTTONS **/
- _add_button->signal_clicked().connect(sigc::mem_fun(*this, &AddRequestDialog::_on_add));
- _remove_button->signal_clicked().connect(sigc::mem_fun(*this, &AddRequestDialog::_on_remove));
+ _add_button->signal_clicked().connect(
+ sigc::mem_fun(*this, &AddRequestDialog::_on_add));
+
+ _remove_button->signal_clicked().connect(
+ sigc::mem_fun(*this, &AddRequestDialog::_on_remove));
+
+ _ok_button->set_sensitive(false);
+ _remove_button->set_sensitive(false);
+ _add_button->set_sensitive(false);
/** INITIALIZE COMBOBOX **/
_combo_columns.add(_combo_key_column);
@@ -59,6 +66,9 @@ AddRequestDialog::AddRequestDialog(BaseObjectType* cobject, const RefPtr& g
_resource_combo->set_model(_combo_model);
_resource_combo->pack_start(_combo_key_column, false);
_resource_combo->pack_start(_combo_resource_column, true);
+
+ _resource_combo->signal_changed().connect(
+ sigc::mem_fun(*this, &AddRequestDialog::_on_combo_selection_changed));
/** INITIALIZE LISTVIEW **/
@@ -69,14 +79,43 @@ AddRequestDialog::AddRequestDialog(BaseObjectType* cobject, const RefPtr& g
_list_model = ListStore::create(_list_columns);
_list->set_model(_list_model);
+ _list_model->signal_row_deleted().connect(
+ sigc::mem_fun(*this, &AddRequestDialog::_on_row_removed));
+
+ _list_model->signal_row_inserted().connect(
+ sigc::mem_fun(*this, &AddRequestDialog::_on_row_added));
+
_list->append_column(_("key"), _list_key_column);
_list->append_column(_("resource"), _list_resource_column);
_list->append_column(_("length"), _list_length_column);
_list->get_selection()->signal_changed().connect(
- sigc::mem_fun(*this, &AddRequestDialog::_on_selection_changed));
+ sigc::mem_fun(*this, &AddRequestDialog::_on_list_selection_changed));
+
+ Simulation::get_instance().get_history().add_resource("guitar");
+ Simulation::get_instance().get_history().add_resource("drums");
}
+
+Request&
+AddRequestDialog::construct_request(Thread& owner)
+{
+ assert(_list_model->children());
+
+ SpinButton* instant_spin;
+ _glade->get_widget("Instant.Spin", instant_spin);
+
+ History& h = Simulation::get_instance().get_history();
+ Request& r = h.add_request(owner, instant_spin->get_value_as_int());
+
+ TreeNodeChildren sreq_container = _list_model->children();
+
+ for(Iseq it = iseq(sreq_container); it; ++it)
+ h.add_subrequest(r, (*it)[_list_key_column], (*it)[_list_length_column]);
+
+ return r;
+}
+
void
AddRequestDialog::on_show()
{
@@ -95,7 +134,7 @@ AddRequestDialog::on_show()
row[_combo_key_column] = it->first;
row[_combo_resource_column] = it->second->get_name();
}
-
+
Dialog::on_show();
}
@@ -104,23 +143,20 @@ AddRequestDialog::_on_add()
{
TreeModel::iterator sel = _resource_combo->get_active();
- if(sel)
- {
- SpinButton* duration_spin;
-
- _glade->get_widget("Duration.Spin", duration_spin);
+ SpinButton* duration_spin;
- TreeModel::Row row = *(_list_model->append());
+ _glade->get_widget("Duration.Spin", duration_spin);
- const unsigned int key = (*sel)[_combo_key_column];
- row[_list_key_column] = key;
+ TreeModel::Row row = *(_list_model->append());
- const ustring resource = (*sel)[_combo_resource_column];
- row[_list_resource_column] = resource;
+ const unsigned int key = (*sel)[_combo_key_column];
+ row[_list_key_column] = key;
- const unsigned int length = duration_spin->get_value_as_int();
- row[_list_length_column] = length;
- }
+ const ustring resource = (*sel)[_combo_resource_column];
+ row[_list_resource_column] = resource;
+
+ const unsigned int length = duration_spin->get_value_as_int();
+ row[_list_length_column] = length;
}
void
@@ -131,9 +167,28 @@ AddRequestDialog::_on_remove()
}
void
-AddRequestDialog::_on_selection_changed()
+AddRequestDialog::_on_list_selection_changed()
{
_remove_button->set_sensitive(
_list->get_selection()->count_selected_rows() > 0);
}
+void
+AddRequestDialog::_on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it)
+{
+ _ok_button->set_sensitive(true);
+}
+
+void
+AddRequestDialog::_on_row_removed(const Gtk::TreePath& path)
+{
+ _ok_button->set_sensitive(static_cast(_list_model->children()));
+}
+
+void
+AddRequestDialog::_on_combo_selection_changed()
+{
+ _add_button->set_sensitive(
+ static_cast(_resource_combo->get_active()));
+}
+
diff --git a/src/add_request_dialog.hh b/src/add_request_dialog.hh
index 72ac757..b9d6b54 100644
--- a/src/add_request_dialog.hh
+++ b/src/add_request_dialog.hh
@@ -21,6 +21,12 @@
#ifndef ADD_REQUEST_DIALOG_HH
#define ADD_REQUEST_DIALOG_HH 1
+namespace sgpem
+{
+ class Request;
+ class Thread;
+}
+
#include "config.h"
#include
@@ -36,13 +42,24 @@ namespace sgpem
public:
AddRequestDialog(BaseObjectType* cobject, const Glib::RefPtr& glade);
+ /**
+ \brief Attemts to build a request by using the data supplied
+ up to now.
+ \note Must be called only after it has been shown at least
+ one time with an OK, otherwise expect undefined behaviour!
+ */
+ Request& construct_request(Thread& t);
+
protected:
virtual void on_show();
private:
void _on_add();
void _on_remove();
- void _on_selection_changed();
+ void _on_list_selection_changed();
+ void _on_row_added(const Gtk::TreePath& path, const Gtk::TreeIter& it);
+ void _on_row_removed(const Gtk::TreePath& path);
+ void _on_combo_selection_changed();
Glib::RefPtr _glade;
Gtk::TreeView* _list;
@@ -54,6 +71,7 @@ namespace sgpem
Gtk::Button* _add_button;
Gtk::Button* _remove_button;
+ Gtk::Button* _ok_button;
Gtk::ComboBox* _resource_combo;
Glib::RefPtr _combo_model;
diff --git a/src/schedulables_tree_widget.cc b/src/schedulables_tree_widget.cc
index 85d3d43..acb162f 100644
--- a/src/schedulables_tree_widget.cc
+++ b/src/schedulables_tree_widget.cc
@@ -244,18 +244,6 @@ SchedulablesTreeWidget::_on_add_process()
void
SchedulablesTreeWidget::_on_add_thread()
{
-// TreeModel::iterator sel = get_selection()->get_selected();
-//
-// if(!sel)
-// return;
-//
-// const void* p_handle = (*sel)[_handles_column];
-// HandleType type = (*sel)[_types_column];
-// Process* p = reinterpret_cast(const_cast(p_handle));
-//
-// if(p == NULL || type != htype_process)
-// return;
-
Process* p = get_selected_process();
if(p == NULL)
return;
@@ -286,26 +274,13 @@ SchedulablesTreeWidget::_on_add_thread()
void
SchedulablesTreeWidget::_on_add_request()
{
-// TreeModel::iterator sel = get_selection()->get_selected();
-//
-// if(!sel)
-// return;
-//
-// const void* p_handle = (*sel)[_handles_column];
-// HandleType type = (*sel)[_types_column];
-// Thread* t = reinterpret_cast(const_cast(p_handle));
-//
-// if(t == NULL || type != htype_thread)
-// return;
Thread* t = get_selected_thread();
if(t == NULL)
return;
if(_add_request_dialog->run() == RESPONSE_OK)
- {
- //FIXME writre code for me :-)
- }
+ _add_request_dialog->construct_request(*t);
_add_request_dialog->hide();
}