@@ -11,12 +11,12 @@ use clap::Parser;
1111use gtk:: {
1212 self ,
1313 gdk:: { Display , Texture } ,
14- gio:: { spawn_blocking, Cancellable , ListStore , Settings } ,
14+ gio:: { spawn_blocking, Cancellable , ListStore , Menu , Settings } ,
1515 glib:: { self , clone, spawn_future_local, BoxedAnyObject , Bytes } ,
1616 prelude:: * ,
1717 Align , Application , ApplicationWindow , Box , Button , DropDown , FileDialog , GridView , ListItem ,
18- Orientation , Picture , ProgressBar , ScrolledWindow , SignalListItemFactory , SingleSelection ,
19- StringObject , Switch , Text , TextBuffer ,
18+ MenuButton , Orientation , Picture , PopoverMenu , ProgressBar , ScrolledWindow ,
19+ SignalListItemFactory , SingleSelection , StringObject , Switch , Text , TextBuffer , Popover
2020} ;
2121use log:: debug;
2222use rand:: Rng ;
@@ -302,6 +302,11 @@ fn build_ui(app: &Application, args: Cli) {
302302
303303 wallpaper_changers_dropdown. set_halign ( Align :: End ) ;
304304 wallpaper_changers_dropdown. set_halign ( Align :: Center ) ;
305+ wallpaper_changers_dropdown. set_margin_top ( 12 ) ;
306+ wallpaper_changers_dropdown. set_margin_start ( 12 ) ;
307+ wallpaper_changers_dropdown. set_margin_bottom ( 12 ) ;
308+ wallpaper_changers_dropdown. set_margin_end ( 12 ) ;
309+
305310
306311 let previous_wallpapers_text_buffer = TextBuffer :: builder ( ) . build ( ) ;
307312 settings
@@ -438,7 +443,7 @@ fn build_ui(app: &Application, args: Cli) {
438443 . build ( ) ;
439444
440445 sort_dropdown. connect_selected_notify ( clone ! (
441- #[ weak ]
446+ #[ strong ]
442447 invert_sort_switch,
443448 #[ weak]
444449 image_list_store,
@@ -473,7 +478,7 @@ fn build_ui(app: &Application, args: Cli) {
473478 settings,
474479 #[ weak]
475480 sort_dropdown,
476- #[ weak ]
481+ #[ strong ]
477482 invert_sort_switch,
478483 move |_| {
479484 change_image_button_handlers(
@@ -538,6 +543,24 @@ fn build_ui(app: &Application, args: Cli) {
538543 . bind ( "changer" , & wallpaper_changers_dropdown, "selected" )
539544 . build ( ) ;
540545
546+ let options_box = Box :: builder ( ) . orientation ( Orientation :: Vertical ) . build ( ) ;
547+ let sort_invert_box = Box :: builder ( ) . orientation ( Orientation :: Horizontal ) . build ( ) ;
548+ sort_invert_box. append ( & invert_sort_switch_label) ;
549+ sort_invert_box. append ( & invert_sort_switch) ;
550+ options_box. append ( & sort_invert_box) ;
551+
552+ let options_popover_menu = Popover :: builder ( ) . margin_top ( 12 ) . margin_start ( 12 ) . margin_bottom ( 12 ) . margin_end ( 12 ) . child ( & options_box) . build ( ) ;
553+ let options_menu_button = MenuButton :: builder ( )
554+ . popover ( & options_popover_menu)
555+ . halign ( Align :: Start )
556+ . valign ( Align :: Center )
557+ . margin_start ( 12 )
558+ . margin_top ( 12 )
559+ . margin_bottom ( 12 )
560+ . margin_end ( 12 )
561+ . label ( "Options" )
562+ . build ( ) ;
563+
541564 let changer_options_box = Box :: builder ( )
542565 . margin_top ( 12 )
543566 . margin_start ( 12 )
@@ -552,8 +575,7 @@ fn build_ui(app: &Application, args: Cli) {
552575 changer_options_box. append ( & monitors_dropdown) ;
553576 changer_options_box. append ( & open_folder_button) ;
554577 changer_options_box. append ( & sort_dropdown) ;
555- changer_options_box. append ( & invert_sort_switch) ;
556- changer_options_box. append ( & invert_sort_switch_label) ;
578+ changer_options_box. append ( & options_menu_button) ;
557579 changer_options_box. append ( & wallpaper_changers_dropdown) ;
558580 changer_options_box. append ( & changer_specific_options_box) ;
559581
@@ -575,7 +597,7 @@ fn build_ui(app: &Application, args: Cli) {
575597 folder_path_buffer. connect_changed ( clone ! (
576598 #[ weak]
577599 image_list_store,
578- #[ weak ]
600+ #[ strong ]
579601 invert_sort_switch,
580602 #[ strong]
581603 sender_enable_changer_options_bar,
0 commit comments