Add deprecation guards for deprecated GdkAppLaunchContext API

Also adapt the docs to not use deprecated API.
This commit is contained in:
Matthias Clasen 2010-12-24 17:37:00 -05:00
parent 1e13b42b9b
commit 1d41b98cf8
6 changed files with 10 additions and 7 deletions

View File

@ -144,7 +144,7 @@
GError *error = NULL; GError *error = NULL;
info = g_desktop_app_info_new ("epiphany.desktop"); info = g_desktop_app_info_new ("epiphany.desktop");
context = gdk_app_launch_context_new (); context = gdk_display_get_app_launch_context (display);
g_app_info_launch (info, NULL, context, &error); g_app_info_launch (info, NULL, context, &error);
if (error) if (error)

View File

@ -57,7 +57,7 @@
* Use this macro to guard code that is specific to the X11-backend. * Use this macro to guard code that is specific to the X11-backend.
* Since GDK may be configured with multiple backends, an additional * Since GDK may be configured with multiple backends, an additional
* runtime check for the used backend is recommended: * runtime check for the used backend is recommended:
* </para> *
* <example> * <example>
* <title>Backend-specific code</title> * <title>Backend-specific code</title>
* <programlisting> * <programlisting>

View File

@ -41,9 +41,9 @@
* <programlisting> * <programlisting>
* GdkAppLaunchContext *context; * GdkAppLaunchContext *context;
* *
* context = gdk_app_launch_context_new (<!-- -->); * context = gdk_display_get_app_launch_context (display);
* *
* gdk_app_launch_context_set_screen (my_screen); * gdk_app_launch_context_set_screen (screen);
* gdk_app_launch_context_set_timestamp (event->time); * gdk_app_launch_context_set_timestamp (event->time);
* *
* if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error)) * if (!g_app_info_launch_default_for_uri ("http://www.gtk.org", context, &error))

View File

@ -40,9 +40,11 @@ G_BEGIN_DECLS
GType gdk_app_launch_context_get_type (void); GType gdk_app_launch_context_get_type (void);
#ifndef GDK_DISABLE_DEPRECATED
GdkAppLaunchContext *gdk_app_launch_context_new (void); GdkAppLaunchContext *gdk_app_launch_context_new (void);
void gdk_app_launch_context_set_display (GdkAppLaunchContext *context, void gdk_app_launch_context_set_display (GdkAppLaunchContext *context,
GdkDisplay *display); GdkDisplay *display);
#endif
void gdk_app_launch_context_set_screen (GdkAppLaunchContext *context, void gdk_app_launch_context_set_screen (GdkAppLaunchContext *context,
GdkScreen *screen); GdkScreen *screen);
void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context, void gdk_app_launch_context_set_desktop (GdkAppLaunchContext *context,

View File

@ -2218,8 +2218,9 @@ gdk_display_real_get_app_launch_context (GdkDisplay *display)
{ {
GdkAppLaunchContext *ctx; GdkAppLaunchContext *ctx;
ctx = gdk_app_launch_context_new (); ctx = g_object_new (GDK_TYPE_APP_LAUNCH_CONTEXT,
gdk_app_launch_context_set_display (ctx, display); "display", display,
NULL);
return ctx; return ctx;
} }

View File

@ -63,7 +63,7 @@ gtk_show_uri (GdkScreen *screen,
g_return_val_if_fail (uri != NULL, FALSE); g_return_val_if_fail (uri != NULL, FALSE);
context = gdk_app_launch_context_new (); 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_screen (context, screen);
gdk_app_launch_context_set_timestamp (context, timestamp); gdk_app_launch_context_set_timestamp (context, timestamp);