diff --git a/src/app.rs b/src/app.rs
index 02f0fd5..4e8e9ac 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -283,6 +283,7 @@ impl GPSApp {
application.add_action(&gio::SimpleAction::new("node.request-pad-input", None));
application.add_action(&gio::SimpleAction::new("node.request-pad-output", None));
application.add_action(&gio::SimpleAction::new("node.properties", None));
+ application.add_action(&gio::SimpleAction::new("node.duplicate", None));
}
pub fn app_pop_menu_at_position(
diff --git a/src/graphbook.rs b/src/graphbook.rs
index 6285d6a..44a7e99 100644
--- a/src/graphbook.rs
+++ b/src/graphbook.rs
@@ -495,6 +495,14 @@ pub fn create_graphtab(app: &GPSApp, id: u32, name: Option<&str>) {
let node = current_graphtab(&app).graphview().node(node_id).unwrap();
GPSUI::properties::display_plugin_properties(&app, &node.name(), node_id);
});
+ let app_weak = app.downgrade();
+ app.connect_app_menu_action("node.duplicate", move |_, _| {
+ let app = upgrade_weak!(app_weak);
+ GPS_DEBUG!("node.d id: {}", node_id);
+ if let Some(node) = current_graphtab(&app).graphview().node(node_id) {
+ app.add_new_element(&node.name());
+ };
+ });
}
pop_menu.show();
None
diff --git a/src/ui/gps.ui b/src/ui/gps.ui
index 05adb8c..d295fc9 100644
--- a/src/ui/gps.ui
+++ b/src/ui/gps.ui
@@ -111,6 +111,11 @@
app.node.add-to-favorite
<primary>A
+ -
+ _Duplicate
+ app.node.duplicate
+ <primary>A
+