@@ -144,8 +144,8 @@ where
144144pub struct ModuleRef {
145145 pub id : usize ,
146146 pub name : String ,
147- pub widget : Widget ,
148- pub popup : Option < gtk :: Box > ,
147+ pub root_widget : Widget ,
148+ pub popup : Option < ModulePopupParts > ,
149149}
150150
151151pub struct ModuleParts < W : IsA < Widget > > {
@@ -182,14 +182,15 @@ impl<W: IsA<Widget>> ModuleParts<W> {
182182 }
183183}
184184
185+ #[ derive( Clone ) ]
185186pub struct ModulePopupParts {
186187 /// The popup container, with all its contents
187188 pub container : gtk:: Box ,
188189 /// An array of buttons which can be used for opening the popup.
189190 /// For most modules, this will only be a single button.
190191 pub buttons : Vec < Button > ,
191192
192- pub button_finder : Option < Box < ButtonFinder > > ,
193+ pub button_finder : Option < Rc < ButtonFinder > > ,
193194}
194195
195196impl Debug for ModulePopupParts {
@@ -206,7 +207,7 @@ pub trait ModulePopup {
206207 fn into_popup_parts ( self , buttons : Vec < & Button > ) -> Option < ModulePopupParts > ;
207208 fn into_popup_parts_owned ( self , buttons : Vec < Button > ) -> Option < ModulePopupParts > ;
208209
209- fn into_popup_parts_with_finder ( self , finder : Box < ButtonFinder > ) -> Option < ModulePopupParts > ;
210+ fn into_popup_parts_with_finder ( self , finder : Rc < ButtonFinder > ) -> Option < ModulePopupParts > ;
210211}
211212
212213impl ModulePopup for Option < gtk:: Box > {
@@ -222,7 +223,7 @@ impl ModulePopup for Option<gtk::Box> {
222223 } )
223224 }
224225
225- fn into_popup_parts_with_finder ( self , finder : Box < ButtonFinder > ) -> Option < ModulePopupParts > {
226+ fn into_popup_parts_with_finder ( self , finder : Rc < ButtonFinder > ) -> Option < ModulePopupParts > {
226227 self . map ( |container| ModulePopupParts {
227228 container,
228229 buttons : vec ! [ ] ,
@@ -354,8 +355,7 @@ pub trait ModuleFactory {
354355
355356 module_parts. setup_identifiers ( & common) ;
356357
357- let popup_container = module_parts. popup . as_ref ( ) . map ( |p| p. container . clone ( ) ) ;
358- if let Some ( popup_content) = module_parts. popup {
358+ if let Some ( popup_content) = module_parts. popup . clone ( ) {
359359 popup_content
360360 . container
361361 . add_css_class ( & format ! ( "popup-{module_name}" ) ) ;
@@ -375,8 +375,8 @@ pub trait ModuleFactory {
375375 Ok ( ModuleRef {
376376 id,
377377 name : instance_name,
378- widget : module_parts. widget . upcast ( ) ,
379- popup : popup_container ,
378+ root_widget : module_parts. widget . upcast ( ) ,
379+ popup : module_parts . popup ,
380380 } )
381381 }
382382
0 commit comments