diff options
author | Timm Bäder <[email protected]> | 2018-01-26 11:52:08 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-07-23 23:14:12 +0200 |
commit | 416dc9be3cdfb8e2eb5c07f17f2ce4bb7a9848dc (patch) | |
tree | c5cec881c7420daf181dc410671d2910f88ee3b6 | |
parent | 4115f76df9da09cecdf44f0be95b6f8ea3793060 (diff) | |
download | eom-416dc9be3cdfb8e2eb5c07f17f2ce4bb7a9848dc.tar.bz2 eom-416dc9be3cdfb8e2eb5c07f17f2ce4bb7a9848dc.tar.xz |
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
origin commit:
https://gitlab.gnome.org/GNOME/eog/commit/77f16df
-rw-r--r-- | src/eom-metadata-sidebar.c | 12 | ||||
-rw-r--r-- | src/eom-util.c | 8 | ||||
-rw-r--r-- | src/eom-util.h | 2 | ||||
-rw-r--r-- | src/eom-window.c | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/src/eom-metadata-sidebar.c b/src/eom-metadata-sidebar.c index 018269b..e6d2cce 100644 --- a/src/eom-metadata-sidebar.c +++ b/src/eom-metadata-sidebar.c @@ -429,16 +429,22 @@ _folder_button_clicked_cb (GtkButton *button, gpointer user_data) { EomMetadataSidebarPrivate *priv = EOM_METADATA_SIDEBAR(user_data)->priv; EomImage *img; - GdkScreen *screen; + GtkWidget *toplevel; + GtkWindow *window; GFile *file; g_return_if_fail (priv->parent_window != NULL); img = eom_window_get_image (priv->parent_window); - screen = gtk_widget_get_screen (GTK_WIDGET (priv->parent_window)); file = eom_image_get_file (img); - eom_util_show_file_in_filemanager (file, screen); + toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button)); + if (GTK_IS_WINDOW (toplevel)) + window = GTK_WINDOW (toplevel); + else + window = NULL; + + eom_util_show_file_in_filemanager (file, window); g_object_unref (file); } diff --git a/src/eom-util.c b/src/eom-util.c index bfffbcf..1dc42fa 100644 --- a/src/eom-util.c +++ b/src/eom-util.c @@ -343,7 +343,7 @@ eom_util_file_is_persistent (GFile *file) } static void -_eom_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen) +_eom_util_show_file_in_filemanager_fallback (GFile *file, GtkWindow *toplevel) { gchar *uri = NULL; GError *error = NULL; @@ -362,7 +362,7 @@ _eom_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); @@ -372,7 +372,7 @@ _eom_util_show_file_in_filemanager_fallback (GFile *file, GdkScreen *screen) } void -eom_util_show_file_in_filemanager (GFile *file, GdkScreen *screen) +eom_util_show_file_in_filemanager (GFile *file, GtkWindow *toplevel) { GDBusProxy *proxy; gboolean done = FALSE; @@ -425,5 +425,5 @@ eom_util_show_file_in_filemanager (GFile *file, GdkScreen *screen) /* Fallback to gtk_show_uri() if launch over DBus is not possible */ if (!done) - _eom_util_show_file_in_filemanager_fallback (file, screen); + _eom_util_show_file_in_filemanager_fallback (file, toplevel); } diff --git a/src/eom-util.h b/src/eom-util.h index 30c9658..528ec4e 100644 --- a/src/eom-util.h +++ b/src/eom-util.h @@ -63,7 +63,7 @@ gboolean eom_util_file_is_persistent (GFile *file); G_GNUC_INTERNAL void eom_util_show_file_in_filemanager (GFile *file, - GdkScreen *screen); + GtkWindow *toplevel); G_END_DECLS diff --git a/src/eom-window.c b/src/eom-window.c index 4b80df0..5c41674 100644 --- a/src/eom-window.c +++ b/src/eom-window.c @@ -3025,7 +3025,7 @@ eom_window_cmd_open_containing_folder (GtkAction *action, gpointer user_data) g_return_if_fail (file != NULL); eom_util_show_file_in_filemanager (file, - gtk_widget_get_screen (GTK_WIDGET (user_data))); + GTK_WINDOW (user_data)); } static void |