Skip to content
Permalink
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

origin commit:
https://gitlab.gnome.org/GNOME/eog/commit/77f16df
  • Loading branch information...
baedert authored and raveit65 committed Jan 26, 2018
1 parent 4115f76 commit 416dc9be3cdfb8e2eb5c07f17f2ce4bb7a9848dc
Showing with 15 additions and 9 deletions.
  1. +9 −3 src/eom-metadata-sidebar.c
  2. +4 −4 src/eom-util.c
  3. +1 −1 src/eom-util.h
  4. +1 −1 src/eom-window.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);
}
@@ -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);
}
@@ -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

@@ -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

0 comments on commit 416dc9b

Please sign in to comment.
You can’t perform that action at this time.