Commit 77f16dfc authored by Timm Bäder's avatar Timm Bäder 🤔 Committed by Felix Riemann
Browse files

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
parent e716b7a0
...@@ -299,16 +299,22 @@ _folder_label_clicked_cb (GtkLabel *label, const gchar *uri, gpointer user_data) ...@@ -299,16 +299,22 @@ _folder_label_clicked_cb (GtkLabel *label, const gchar *uri, gpointer user_data)
{ {
EogMetadataSidebarPrivate *priv = EOG_METADATA_SIDEBAR(user_data)->priv; EogMetadataSidebarPrivate *priv = EOG_METADATA_SIDEBAR(user_data)->priv;
EogImage *img; EogImage *img;
GdkScreen *screen; GtkWidget *toplevel;
GtkWindow *window;
GFile *file; GFile *file;
g_return_if_fail (priv->parent_window != NULL); g_return_if_fail (priv->parent_window != NULL);
img = eog_window_get_image (priv->parent_window); img = eog_window_get_image (priv->parent_window);
screen = gtk_widget_get_screen (GTK_WIDGET (priv->parent_window));
file = eog_image_get_file (img); 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); g_object_unref (file);
} }
......
...@@ -419,7 +419,7 @@ eog_util_file_is_persistent (GFile *file) ...@@ -419,7 +419,7 @@ eog_util_file_is_persistent (GFile *file)
} }
static void 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; gchar *uri = NULL;
GError *error = NULL; GError *error = NULL;
...@@ -438,7 +438,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen) ...@@ -438,7 +438,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen)
g_object_unref (parent_file); 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, g_warning ("Couldn't show containing folder \"%s\": %s", uri,
error->message); error->message);
g_error_free (error); g_error_free (error);
...@@ -448,7 +448,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen) ...@@ -448,7 +448,7 @@ _eog_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen)
} }
void void
eog_util_show_file_in_filemanager (GFile *file, GdkScreen *screen) eog_util_show_file_in_filemanager (GFile *file, GtkWindow *toplevel)
{ {
GDBusProxy *proxy; GDBusProxy *proxy;
gboolean done = FALSE; gboolean done = FALSE;
...@@ -501,5 +501,5 @@ eog_util_show_file_in_filemanager (GFile *file, GdkScreen *screen) ...@@ -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 */ /* Fallback to gtk_show_uri() if launch over DBus is not possible */
if (!done) if (!done)
_eog_util_show_file_in_filemanager_fallback (file, screen); _eog_util_show_file_in_filemanager_fallback (file, toplevel);
} }
...@@ -67,7 +67,7 @@ gboolean eog_util_file_is_persistent (GFile *file); ...@@ -67,7 +67,7 @@ gboolean eog_util_file_is_persistent (GFile *file);
G_GNUC_INTERNAL G_GNUC_INTERNAL
void eog_util_show_file_in_filemanager (GFile *file, void eog_util_show_file_in_filemanager (GFile *file,
GdkScreen *screen); GtkWindow *toplevel);
G_END_DECLS G_END_DECLS
......
...@@ -3018,7 +3018,7 @@ eog_window_action_open_containing_folder (GSimpleAction *action, ...@@ -3018,7 +3018,7 @@ eog_window_action_open_containing_folder (GSimpleAction *action,
g_return_if_fail (file != NULL); g_return_if_fail (file != NULL);
eog_util_show_file_in_filemanager (file, eog_util_show_file_in_filemanager (file,
gtk_widget_get_screen (GTK_WIDGET (user_data))); GTK_WINDOW (user_data));
} }
static void static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment