aboutsummaryrefslogtreecommitdiff
path: root/gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'gui.c')
-rw-r--r--gui.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gui.c b/gui.c
index 09bca3a..9328126 100644
--- a/gui.c
+++ b/gui.c
@@ -682,19 +682,30 @@ void selection_clicked(GtkButton* self, gpointer user_data) {
connection_interface1 = (struct interface*)user_data;
} else {
// Delete any old connection
- // @todo this isn't pushed to the undo redo stack!
+ struct undo_entry* undo_new_del = NULL;
+ if(connection_interface1->connection) {
+ struct undo_del_con_data* undo_del_con_new = NULL;
+ NEW_UNDO_STRUCT(undo_del_con, undo_del_con_data, undo_new_del, undo_del_con_new);
+ undo_del_con_new->int1 = connection_interface1;
+ undo_del_con_new->int2 = (connection_interface1->connection->interface1 == connection_interface1 ? connection_interface1->connection->interface2 : connection_interface1->connection->interface1);
+ undo_del_con_new->template = connection_interface1->connection->template;
+ }
+
delete_connection(connection_interface1->connection);
delete_connection(((struct interface*)user_data)->connection);
// Create the connection
new_connection(connection_interface1, (struct interface*)user_data, selected_connection_template);
- struct undo_entry* undo_new = NULL;
+ struct undo_entry* undo_new_add = NULL;
struct undo_add_con_data* undo_add_con_new = NULL;
- NEW_UNDO_STRUCT(undo_add_con, undo_add_con_data, undo_new, undo_add_con_new);
- undo_add_con_new->con = connection_interface1->connection;
+ NEW_UNDO_STRUCT(undo_add_con, undo_add_con_data, undo_new_add, undo_add_con_new);
+ if(undo_new_del) {
+ undo_new_del->prev_sibling = undo_new_add;
+ undo_new_add->next_sibling = undo_new_del;
+ }
undo_add_con_new->int1 = connection_interface1;
undo_add_con_new->int2 = (struct interface*)user_data;
undo_add_con_new->template = selected_connection_template;
- undo_add_entry(undo_new);
+ undo_add_entry(undo_new_add);
connection_interface1 = NULL;
}
Jeremias Stotters git repositories generated by CGIT