[tepl] File loading: ensure to open the file in the good window



commit 069d0aaeee8035914926707346f6fd574fcb5dc4
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sat Oct 14 16:24:55 2017 +0200

    File loading: ensure to open the file in the good window

 tepl/tepl-application-window.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/tepl/tepl-application-window.c b/tepl/tepl-application-window.c
index 32584f2..e8c775b 100644
--- a/tepl/tepl-application-window.c
+++ b/tepl/tepl-application-window.c
@@ -141,17 +141,16 @@ open_file_chooser_response_cb (GtkFileChooserDialog  *file_chooser_dialog,
 {
        if (response_id == GTK_RESPONSE_ACCEPT)
        {
-               GFile *file;
-               GtkApplication *gtk_app;
-               TeplApplication *tepl_app;
-
-               file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_chooser_dialog));
+               GFile *location;
 
-               gtk_app = gtk_window_get_application (GTK_WINDOW (tepl_window->priv->gtk_window));
-               tepl_app = tepl_application_get_from_gtk_application (gtk_app);
-               tepl_application_open_simple (tepl_app, file);
+               location = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (file_chooser_dialog));
+               tepl_application_window_open_file (tepl_window, location, TRUE);
+               g_object_unref (location);
 
-               g_object_unref (file);
+               /* Present the window because it is not necessarily the most
+                * recently focused window.
+                */
+               gtk_window_present (GTK_WINDOW (tepl_window->priv->gtk_window));
        }
 
        gtk_widget_destroy (GTK_WIDGET (file_chooser_dialog));


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