[eog/native-filechooser] Use a native file chooser



commit 87dd0ca26392dc4c26cac32b9d2b503c7baa7cec
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 17 18:50:39 2018 -0400

    Use a native file chooser
    
    This makes eog work in a sandboxed environment.

 src/eog-window.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/eog-window.c b/src/eog-window.c
index 4e913271..e40979fb 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -1673,7 +1673,7 @@ view_zoom_changed_cb (GtkWidget *widget, double zoom, gpointer user_data)
 }
 
 static void
-file_open_dialog_response_cb (GtkWidget *chooser,
+file_open_dialog_response_cb (GtkNativeDialog *chooser,
                              gint       response_id,
                              EogWindow  *ev_window)
 {
@@ -1692,7 +1692,7 @@ file_open_dialog_response_cb (GtkWidget *chooser,
                g_slist_free (uris);
        }
 
-       gtk_widget_destroy (chooser);
+       gtk_native_dialog_destroy (chooser);
 }
 
 static void
@@ -2265,7 +2265,7 @@ eog_window_action_file_open (GSimpleAction *action,
        EogWindow *window;
        EogWindowPrivate *priv;
        EogImage *current;
-       GtkWidget *dlg;
+       GtkFileChooserNative *dlg;
 
        g_return_if_fail (EOG_IS_WINDOW (user_data));
 
@@ -2273,8 +2273,12 @@ eog_window_action_file_open (GSimpleAction *action,
 
        priv = window->priv;
 
-       dlg = eog_file_chooser_new (GTK_FILE_CHOOSER_ACTION_OPEN);
-       gtk_window_set_transient_for (GTK_WINDOW (dlg), GTK_WINDOW (window));
+       dlg = gtk_file_chooser_native_new (_("Open Image"),
+                                           GTK_WINDOW (window),
+                                          GTK_FILE_CHOOSER_ACTION_OPEN,
+                                          _("_Open"),
+                                          _("_Cancel"));
+       gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dlg), TRUE);
 
        current = eog_thumb_view_get_first_selected_image (EOG_THUMB_VIEW (priv->thumbview));
 
@@ -2308,7 +2312,7 @@ eog_window_action_file_open (GSimpleAction *action,
                          G_CALLBACK (file_open_dialog_response_cb),
                          window);
 
-       gtk_widget_show_all (dlg);
+       gtk_native_dialog_show (GTK_NATIVE_DIALOG (dlg));
 }
 
 static void


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