@@ -7,8 +7,8 @@ use adw::prelude::*;
7
7
use futures:: StreamExt ;
8
8
use gettextrs:: gettext;
9
9
use gtk4:: {
10
- Builder , Button , CallbackAction , FileDialog , FileFilter , Label , Shortcut , ShortcutController ,
11
- ShortcutTrigger , ToggleButton , gio , glib , glib :: clone , graphene , gsk,
10
+ Builder , Button , FileDialog , FileFilter , Label , ToggleButton , gio , glib , glib :: clone , graphene ,
11
+ gsk,
12
12
} ;
13
13
use num_traits:: ToPrimitive ;
14
14
use rnote_engine:: engine:: import:: { PdfImportPageSpacing , PdfImportPagesType } ;
@@ -475,23 +475,14 @@ pub(crate) async fn dialog_import_pdf_w_prefs(
475
475
} ) ) ;
476
476
} ) ) ;
477
477
478
- // Overwrite builtin close shortcut
479
- let controller = ShortcutController :: new ( ) ;
480
- controller. add_shortcut ( Shortcut :: new (
481
- Some ( ShortcutTrigger :: parse_string ( "Escape" ) . unwrap ( ) ) ,
482
- Some ( CallbackAction :: new ( clone ! (
483
- #[ weak]
484
- import_pdf_button_cancel,
485
- #[ upgrade_or]
486
- glib:: Propagation :: Stop ,
487
- move |_, _| {
488
- import_pdf_button_cancel. emit_clicked( ) ;
489
-
490
- glib:: Propagation :: Stop
491
- }
492
- ) ) ) ,
478
+ // Send a cancel response when the dialog is closed
479
+ dialog. connect_closed ( clone ! (
480
+ #[ weak]
481
+ import_pdf_button_cancel,
482
+ move |_| {
483
+ import_pdf_button_cancel. emit_clicked( ) ;
484
+ }
493
485
) ) ;
494
- dialog. add_controller ( controller) ;
495
486
496
487
// Present than wait for a response from the dialog
497
488
dialog. present ( appwindow. root ( ) . as_ref ( ) ) ;
@@ -581,23 +572,14 @@ pub(crate) async fn dialog_import_xopp_w_prefs(
581
572
} ) ) ;
582
573
} ) ) ;
583
574
584
- // Overwrite builtin close shortcut
585
- let controller = ShortcutController :: new ( ) ;
586
- controller. add_shortcut ( Shortcut :: new (
587
- Some ( ShortcutTrigger :: parse_string ( "Escape" ) . unwrap ( ) ) ,
588
- Some ( CallbackAction :: new ( clone ! (
589
- #[ weak]
590
- import_xopp_button_cancel,
591
- #[ upgrade_or]
592
- glib:: Propagation :: Stop ,
593
- move |_, _| {
594
- import_xopp_button_cancel. emit_clicked( ) ;
595
-
596
- glib:: Propagation :: Stop
597
- }
598
- ) ) ) ,
575
+ // Send a cancel response when the dialog is closed
576
+ dialog. connect_closed ( clone ! (
577
+ #[ weak]
578
+ import_xopp_button_cancel,
579
+ move |_| {
580
+ import_xopp_button_cancel. emit_clicked( ) ;
581
+ }
599
582
) ) ;
600
- dialog. add_controller ( controller) ;
601
583
602
584
// Present than wait for a response from the dialog
603
585
dialog. present ( appwindow. root ( ) . as_ref ( ) ) ;
0 commit comments