[shotwell/wip/gtk4: 62/94] Fix device unmount dialogs




commit 1289b14995f78134c63ebda1c6d7540cf3373d35
Author: Jens Georg <mail jensge org>
Date:   Wed Apr 13 22:44:21 2022 +0200

    Fix device unmount dialogs

 src/camera/ImportPage.vala | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index 49e3a8c0..df70587a 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -979,14 +979,16 @@ public class ImportPage : CheckerboardPage {
                         Gtk.ButtonsType.CANCEL, "%s", mounted_message);
                     dialog.title = Resources.APP_TITLE;
                     dialog.add_button(_("_Unmount"), Gtk.ResponseType.YES);
-                    int dialog_res = 0; // TODO dialog.run();
-                    dialog.destroy();
-                    
-                    if (dialog_res != Gtk.ResponseType.YES) {
-                        set_page_message(_("Please unmount the camera."));
-                    } else {
-                        unmount_camera(mount);
-                    }
+                    dialog.set_transient_for(AppWindow.get_instance());
+                    dialog.show();
+                    dialog.response.connect((source, res) => {
+                        if (res != Gtk.ResponseType.YES) {
+                            set_page_message(_("Please unmount the camera."));
+                        } else {
+                            unmount_camera(mount);
+                        }
+                        dialog.destroy();
+                    });
                 } else {
                     string locked_message = _("The camera is locked by another application. Shotwell can 
only access the camera when it’s unlocked. Please close any other application using the camera and try 
again.");
 
@@ -995,10 +997,12 @@ public class ImportPage : CheckerboardPage {
                         Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING,
                         Gtk.ButtonsType.OK, "%s", locked_message);
                     dialog.title = Resources.APP_TITLE;
-                    // TODO dialog.run();
-                    dialog.destroy();
-                    
-                    set_page_message(_("Please close any other application using the camera."));
+                    dialog.set_transient_for(AppWindow.get_instance());
+                    dialog.show();
+                    dialog.response.connect((source, res) => {                    
+                        set_page_message(_("Please close any other application using the camera."));
+                        dialog.destroy();
+                    });
                 }
             break;
             


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]