@@ -50,6 +50,7 @@ mod imp {
5050 pub clone_sidebar : RefCell < Option < SidebarRow > > ,
5151 pub cloning_content : gtk:: Box ,
5252 pub view_switcher : adw:: InlineViewSwitcher ,
53+ pub clone_warning_banner : adw:: Banner ,
5354 }
5455
5556 impl CreateDistroboxDialog {
@@ -69,11 +70,19 @@ mod imp {
6970 // insert at the top of the cloning_content box
7071 self . cloning_content . append ( & sidebar_row) ;
7172 self . clone_sidebar . replace ( Some ( sidebar_row) ) ;
73+
74+ // Show warning if container is running
75+ if container. is_running ( ) {
76+ self . clone_warning_banner . set_revealed ( true ) ;
77+ } else {
78+ self . clone_warning_banner . set_revealed ( false ) ;
79+ }
7280 } else {
7381 // no clone source, ensure image row is visible
7482 self . image_row . set_visible ( true ) ;
7583 self . cloning_content . set_visible ( false ) ;
7684 self . view_switcher . set_visible ( true ) ;
85+ self . clone_warning_banner . set_revealed ( false ) ;
7786 }
7887 }
7988 }
@@ -115,6 +124,12 @@ mod imp {
115124 cloning_header. append ( & cloning_label) ;
116125
117126 self . cloning_content . append ( & cloning_header) ;
127+
128+ // Add warning banner for running containers
129+ self . clone_warning_banner . set_title ( "Cloning the container requires stopping it first" ) ;
130+ self . clone_warning_banner . set_revealed ( false ) ;
131+ self . cloning_content . append ( & self . clone_warning_banner ) ;
132+
118133 self . content . append ( & self . cloning_content ) ;
119134
120135 let preferences_group = adw:: PreferencesGroup :: new ( ) ;
@@ -204,6 +219,7 @@ mod imp {
204219 if let Ok ( create_args) = res {
205220 // If cloning from a source, delegate to clone_container, otherwise create normally
206221 if let Some ( src) = obj. clone_src( ) {
222+ src. stop( ) ;
207223 obj. root_store( )
208224 . clone_container( & src. name( ) , create_args) ;
209225 } else {
@@ -366,7 +382,8 @@ mod imp {
366382
367383glib:: wrapper! {
368384 pub struct CreateDistroboxDialog ( ObjectSubclass <imp:: CreateDistroboxDialog >)
369- @extends adw:: Dialog , gtk:: Widget ;
385+ @extends adw:: Dialog , gtk:: Widget ,
386+ @implements gtk:: Accessible , gtk:: Buildable , gtk:: ConstraintTarget , gtk:: Actionable ;
370387}
371388impl CreateDistroboxDialog {
372389 pub fn new ( root_store : RootStore ) -> Self {
0 commit comments