summaryrefslogtreecommitdiff
path: root/gsearchtool/src/gsearchtool-support.c
diff options
context:
space:
mode:
authorraveit65 <[email protected]>2016-08-07 14:02:45 +0200
committerraveit65 <[email protected]>2016-08-07 16:52:20 +0200
commita3897f51ab6eea768e39c8959380caa1ae8ea215 (patch)
treed326bcd64661bec5436c27c647e174cc9bd9a2fd /gsearchtool/src/gsearchtool-support.c
parent7e94553747ccadd00ad4f96a106c4fd9455fdf6e (diff)
downloadmate-utils-a3897f51ab6eea768e39c8959380caa1ae8ea215.tar.bz2
mate-utils-a3897f51ab6eea768e39c8959380caa1ae8ea215.tar.xz
GTK+-3 search: avoid deprecated gdk_app_launch_context_new ()
Diffstat (limited to 'gsearchtool/src/gsearchtool-support.c')
-rw-r--r--gsearchtool/src/gsearchtool-support.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/gsearchtool/src/gsearchtool-support.c b/gsearchtool/src/gsearchtool-support.c
index 2d0b36c8..d12cdbfb 100644
--- a/gsearchtool/src/gsearchtool-support.c
+++ b/gsearchtool/src/gsearchtool-support.c
@@ -952,6 +952,10 @@ open_file_with_filemanager (GtkWidget * window,
GDesktopAppInfo * d_app_info;
GKeyFile * key_file;
GdkAppLaunchContext * ctx = NULL;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkScreen *screen;
+ GdkDisplay *display;
+#endif
GList * list = NULL;
GAppInfo * g_app_info;
GFile * g_file;
@@ -991,7 +995,13 @@ open_file_with_filemanager (GtkWidget * window,
d_app_info = g_desktop_app_info_new_from_keyfile (key_file);
if (d_app_info != NULL) {
+#if GTK_CHECK_VERSION (3, 0, 0)
+ screen = gtk_widget_get_screen (GTK_WIDGET (window));
+ display = gdk_screen_get_display (screen);
+ ctx = gdk_display_get_app_launch_context (display);
+#else
ctx = gdk_app_launch_context_new ();
+#endif
gdk_app_launch_context_set_screen (ctx, gtk_widget_get_screen (window));
result = g_app_info_launch_uris (G_APP_INFO (d_app_info), list, G_APP_LAUNCH_CONTEXT (ctx), NULL);
@@ -1019,6 +1029,9 @@ open_file_with_application (GtkWidget * window,
GAppInfo * app)
{
GdkAppLaunchContext * context;
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GdkDisplay *display;
+#endif
GdkScreen * screen;
gboolean result;
@@ -1026,8 +1039,13 @@ open_file_with_application (GtkWidget * window,
return FALSE;
}
- context = gdk_app_launch_context_new ();
screen = gtk_widget_get_screen (window);
+#if GTK_CHECK_VERSION (3, 0, 0)
+ display = gdk_screen_get_display (screen);
+ context = gdk_display_get_app_launch_context (display);
+#else
+ context = gdk_app_launch_context_new ();
+#endif
gdk_app_launch_context_set_screen (context, screen);
if (app == NULL) {