[evince] Don't use gdk_app_launch_context_new()
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] Don't use gdk_app_launch_context_new()
- Date: Sun, 20 Nov 2011 17:07:20 +0000 (UTC)
commit 987f7d927151899899ef6442050688be0fefe0ef
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Sun Nov 20 18:06:39 2011 +0100
Don't use gdk_app_launch_context_new()
Use gdk_display_get_app_launch_context() instead.
libdocument/ev-attachment.c | 23 ++++++++++++-----------
shell/ev-window.c | 32 ++++++++++++++++----------------
2 files changed, 28 insertions(+), 27 deletions(-)
---
diff --git a/libdocument/ev-attachment.c b/libdocument/ev-attachment.c
index 9f9f4fe..912a50e 100644
--- a/libdocument/ev-attachment.c
+++ b/libdocument/ev-attachment.c
@@ -345,25 +345,26 @@ ev_attachment_launch_app (EvAttachment *attachment,
guint32 timestamp,
GError **error)
{
- gboolean result;
- GList *files = NULL;
- GAppLaunchContext *context = NULL;
- GError *ioerror = NULL;
+ gboolean result;
+ GList *files = NULL;
+ GdkAppLaunchContext *context;
+ GdkDisplay *display;
+ GError *ioerror = NULL;
g_assert (G_IS_FILE (attachment->priv->tmp_file));
g_assert (G_IS_APP_INFO (attachment->priv->app));
files = g_list_prepend (files, attachment->priv->tmp_file);
- context = G_APP_LAUNCH_CONTEXT (gdk_app_launch_context_new ());
- gdk_app_launch_context_set_screen (GDK_APP_LAUNCH_CONTEXT (context), screen);
- gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context), timestamp);
+ display = screen ? gdk_screen_get_display (screen) : gdk_display_get_default ();
+ context = gdk_display_get_app_launch_context (display);
+ gdk_app_launch_context_set_screen (context, screen);
+ gdk_app_launch_context_set_timestamp (context, timestamp);
result = g_app_info_launch (attachment->priv->app, files,
- context, &ioerror);
-
- if (context)
- g_object_unref (context);
+ G_APP_LAUNCH_CONTEXT (context),
+ &ioerror);
+ g_object_unref (context);
if (!result) {
g_set_error (error,
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 526cf4e..768fc1c 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -6180,7 +6180,8 @@ launch_action (EvWindow *window, EvLinkAction *action)
GAppInfo *app_info;
GFile *file;
GList file_list = {NULL};
- GAppLaunchContext *context;
+ GdkAppLaunchContext *context;
+ GdkScreen *screen;
GError *error = NULL;
if (filename == NULL)
@@ -6211,14 +6212,13 @@ launch_action (EvWindow *window, EvLinkAction *action)
return;
}
- 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)));
- gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context),
- gtk_get_current_event_time ());
-
+ 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, context, &error)) {
+ if (!g_app_info_launch (app_info, &file_list, G_APP_LAUNCH_CONTEXT (context), &error)) {
ev_window_error_message (window, error,
"%s",
_("Unable to launch external application."));
@@ -6239,13 +6239,13 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
const gchar *uri = ev_link_action_get_uri (action);
GError *error = NULL;
gboolean ret;
- GAppLaunchContext *context;
+ GdkAppLaunchContext *context;
+ GdkScreen *screen;
- 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)));
- gdk_app_launch_context_set_timestamp (GDK_APP_LAUNCH_CONTEXT (context),
- gtk_get_current_event_time ());
+ 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 ());
if (!g_strstr_len (uri, strlen (uri), "://") &&
!g_str_has_prefix (uri, "mailto:")) {
@@ -6270,10 +6270,10 @@ launch_external_uri (EvWindow *window, EvLinkAction *action)
new_uri = g_strdup_printf ("file:///%s", uri);
}
}
- ret = g_app_info_launch_default_for_uri (new_uri, context, &error);
+ 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, context, &error);
+ ret = g_app_info_launch_default_for_uri (uri, G_APP_LAUNCH_CONTEXT (context), &error);
}
if (ret == FALSE) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]