[eog] util: Port to gtk_show_uri_on_window



commit 77f16dfc8b297cfe40a6d80eb74d2b63ce2f6137
Author: Timm Bäder <mail baedert org>
Date:   Fri Jan 26 11:52:08 2018 +0100

    util: Port to gtk_show_uri_on_window
    
    gtk_show_uri is deprecated and will be removed in later versions.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792923

 src/eog-metadata-sidebar.c |   12 +++++++++---
 src/eog-util.c             |    8 ++++----
 src/eog-util.h             |    2 +-
 src/eog-window.c           |    2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/eog-metadata-sidebar.c b/src/eog-metadata-sidebar.c
index 743217f..b9131d1 100644
--- a/src/eog-metadata-sidebar.c
+++ b/src/eog-metadata-sidebar.c
@@ -299,16 +299,22 @@ _folder_label_clicked_cb (GtkLabel *label, const gchar *uri, gpointer user_data)
 {
        EogMetadataSidebarPrivate *priv = EOG_METADATA_SIDEBAR(user_data)->priv;
        EogImage *img;
-       GdkScreen *screen;
+       GtkWidget *toplevel;
+       GtkWindow *window;
        GFile *file;
 
        g_return_if_fail (priv->parent_window != NULL);
 
        img = eog_window_get_image (priv->parent_window);
-       screen = gtk_widget_get_screen (GTK_WIDGET (priv->parent_window));
        file = eog_image_get_file (img);
 
-       eog_util_show_file_in_filemanager (file, screen);
+       toplevel = gtk_widget_get_toplevel (GTK_WIDGET (label));
+       if (GTK_IS_WINDOW (toplevel))
+               window = GTK_WINDOW (toplevel);
+       else
+               window = NULL;
+
+       eog_util_show_file_in_filemanager (file, window);
 
        g_object_unref (file);
 }
diff --git a/src/eog-util.c b/src/eog-util.c
index 65f38a0..f9e0fea 100644
--- a/src/eog-util.c
+++ b/src/eog-util.c
@@ -419,7 +419,7 @@ eog_util_file_is_persistent (GFile *file)
 }
 
 static void
-_eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen)
+_eog_util_show_file_in_filemanager_fallback (GFile *file, GtkWindow *toplevel)
 {
        gchar *uri = NULL;
        GError *error = NULL;
@@ -438,7 +438,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen)
                g_object_unref (parent_file);
        }
 
-       if (uri && !gtk_show_uri (screen, uri, timestamp, &error)) {
+       if (uri && !gtk_show_uri_on_window (toplevel, uri, timestamp, &error)) {
                g_warning ("Couldn't show containing folder \"%s\": %s", uri,
                           error->message);
                g_error_free (error);
@@ -448,7 +448,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen)
 }
 
 void
-eog_util_show_file_in_filemanager (GFile *file, GdkScreen *screen)
+eog_util_show_file_in_filemanager (GFile *file, GtkWindow *toplevel)
 {
        GDBusProxy *proxy;
        gboolean done = FALSE;
@@ -501,5 +501,5 @@ eog_util_show_file_in_filemanager (GFile *file, GdkScreen *screen)
 
        /* Fallback to gtk_show_uri() if launch over DBus is not possible */
        if (!done)
-               _eog_util_show_file_in_filemanager_fallback (file, screen);
+               _eog_util_show_file_in_filemanager_fallback (file, toplevel);
 }
diff --git a/src/eog-util.h b/src/eog-util.h
index fc41bf1..9f2ad4c 100644
--- a/src/eog-util.h
+++ b/src/eog-util.h
@@ -67,7 +67,7 @@ gboolean eog_util_file_is_persistent (GFile *file);
 
 G_GNUC_INTERNAL
 void     eog_util_show_file_in_filemanager   (GFile *file,
-                                             GdkScreen *screen);
+                                              GtkWindow *toplevel);
 
 G_END_DECLS
 
diff --git a/src/eog-window.c b/src/eog-window.c
index 0ff8419..123b22c 100644
--- a/src/eog-window.c
+++ b/src/eog-window.c
@@ -3018,7 +3018,7 @@ eog_window_action_open_containing_folder (GSimpleAction *action,
        g_return_if_fail (file != NULL);
 
        eog_util_show_file_in_filemanager (file,
-                               gtk_widget_get_screen (GTK_WIDGET (user_data)));
+                                          GTK_WINDOW (user_data));
 }
 
 static void


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