summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-06-23 16:39:30 +0200
committerraveit65 <[email protected]>2016-06-24 20:48:20 +0200
commit9ad55d4b3af02a5416a9d2afd7512ee3318cb307 (patch)
tree0c54001edcc63b2f23e8ddd8fa50e1cff9b9d9b4 /shell
parent9ea467efb4c99f4c1fec535537d0160511366b45 (diff)
downloadatril-9ad55d4b3af02a5416a9d2afd7512ee3318cb307.tar.bz2
atril-9ad55d4b3af02a5416a9d2afd7512ee3318cb307.tar.xz
GTK+-3: do not use gdk_app_launch_context_new()
Use gdk_display_get_app_launch_context() instead. taken from: https://git.gnome.org/browse/evince/commit/?id=987f7d9
Diffstat (limited to 'shell')
-rw-r--r--shell/ev-window.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/shell/ev-window.c b/shell/ev-window.c
index b282062c..382f4c97 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6581,7 +6581,12 @@ launch_action (EvWindow *window, EvLinkAction *action)
GAppInfo *app_info;
GFile *file;
GList file_list = {NULL};
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkAppLaunchContext *context;
+ GdkScreen *screen;
+#else
GAppLaunchContext *context;
+#endif
GError *error = NULL;
if (filename == NULL)
@@ -6612,6 +6617,15 @@ launch_action (EvWindow *window, EvLinkAction *action)
return;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ screen = gtk_window_get_screen (GTK_WINDOW (window));
+ context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+ gdk_app_launch_context_set_screen (context, screen);
+ gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
+
+ file_list.data = file;
+ if (!g_app_info_launch (app_info, &file_list, G_APP_LAUNCH_CONTEXT (context), &error)) {
+#else
context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ());
gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context),
gtk_window_get_screen (GTK_WINDOW (window)));
@@ -6620,6 +6634,7 @@ launch_action (EvWindow *window, EvLinkAction *action)
file_list.data = file;
if (!g_app_info_launch (app_info, &file_list, context, &error)) {
+#endif
ev_window_error_message (window, error,
"%s",
_("Unable to launch external application."));
@@ -6640,6 +6655,15 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
const gchar *uri = ev_link_action_get_uri (action);
GError *error = NULL;
gboolean ret;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkAppLaunchContext *context;
+ GdkScreen *screen;
+
+ screen = gtk_window_get_screen (GTK_WINDOW (window));
+ context = gdk_display_get_app_launch_context (gdk_screen_get_display (screen));
+ gdk_app_launch_context_set_screen (context, screen);
+ gdk_app_launch_context_set_timestamp (context, gtk_get_current_event_time ());
+#else
GAppLaunchContext *context;
context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ());
@@ -6647,6 +6671,7 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
gtk_window_get_screen (GTK_WINDOW (window)));
gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context),
gtk_get_current_event_time ());
+#endif
if (!g_strstr_len (uri, strlen (uri), "://") &&
!g_str_has_prefix (uri, "mailto:")) {
@@ -6671,10 +6696,17 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
new_uri = g_strdup_printf ("file:///%s", uri);
}
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+ ret = g_app_info_launch_default_for_uri (new_uri, G_APP_LAUNCH_CONTEXT (context), &error);
+ g_free (new_uri);
+ } else {
+ ret = g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (context), &error);
+#else
ret = g_app_info_launch_default_for_uri (new_uri, context, &error);
g_free (new_uri);
} else {
ret = g_app_info_launch_default_for_uri (uri, context, &error);
+#endif
}
if (ret == FALSE) {