diff options
Diffstat (limited to 'dev-libs/glib/files/glib-2.28.2-gio_launch_handler.patch')
-rw-r--r-- | dev-libs/glib/files/glib-2.28.2-gio_launch_handler.patch | 234 |
1 files changed, 234 insertions, 0 deletions
diff --git a/dev-libs/glib/files/glib-2.28.2-gio_launch_handler.patch b/dev-libs/glib/files/glib-2.28.2-gio_launch_handler.patch new file mode 100644 index 0000000..2c232b4 --- /dev/null +++ b/dev-libs/glib/files/glib-2.28.2-gio_launch_handler.patch @@ -0,0 +1,234 @@ +From 41a32799fa223937e5e980ffb8c268b183c416e2 Mon Sep 17 00:00:00 2001 +From: Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com> +Date: Wed, 18 Aug 2010 12:02:10 +0200 +Subject: [PATCH] gio: New extension point "gio-desktop-app-info-launch-handler" + +Add an extension point that gets a callback each time a GAppInfo +is launched. The callback receives the GAppInfo, the list of URIs, +the launch context, and the pid. +--- + gio/gdesktopappinfo.c | 123 ++++++++++++++++++++++++++++++++++++++++++++++++- + gio/gdesktopappinfo.h | 31 ++++++++++++ + gio/gio.symbols | 1 + + gio/giomodule.c | 3 + + 4 files changed, 157 insertions(+), 1 deletions(-) + +Index: glib-2.28.2/gio/gdesktopappinfo.c +=================================================================== +--- glib-2.28.2.orig/gio/gdesktopappinfo.c 2011-03-05 04:49:45.000000000 +1100 ++++ glib-2.28.2/gio/gdesktopappinfo.c 2011-03-08 13:31:40.605569315 +1100 +@@ -74,6 +74,12 @@ + static void mime_info_cache_reload (const char *dir); + static gboolean g_desktop_app_info_ensure_saved (GDesktopAppInfo *info, + GError **error); ++static void ++g_desktop_app_info_launch_handler_on_launched (GDesktopAppInfoLaunchHandler *launch_handler, ++ GDesktopAppInfo *app_info, ++ GList *uris, ++ GAppLaunchContext *launch_ctx, ++ gint pid); + + /** + * GDesktopAppInfo: +@@ -995,6 +1001,49 @@ + g_object_unref (msg); + } + ++static void ++g_desktop_app_info_on_launched (GDesktopAppInfo *app_info, ++ GList *uris, ++ GAppLaunchContext *launch_ctx, ++ gint pid) ++{ ++ static gsize lookup = 0; ++ ++ if (g_once_init_enter (&lookup)) ++ { ++ gsize setup_value = 1; ++ GDesktopAppInfoLaunchHandler *lookup_instance; ++ GIOExtensionPoint *ep; ++ GIOExtension *extension; ++ GList *l; ++ ++ /* Ensure vfs in modules loaded */ ++ _g_io_modules_ensure_loaded (); ++ ++ ep = g_io_extension_point_lookup (G_DESKTOP_APP_INFO_LAUNCH_HANDLER_EXTENSION_POINT_NAME); ++ ++ lookup_instance = NULL; ++ for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next) ++ { ++ extension = l->data; ++ lookup_instance = g_object_new (g_io_extension_get_type (extension), NULL); ++ if (lookup_instance != NULL) ++ break; ++ } ++ ++ if (lookup_instance != NULL) ++ setup_value = (gsize)lookup_instance; ++ ++ g_once_init_leave (&lookup, setup_value); ++ } ++ ++ if (lookup == 1) ++ return; ++ ++ g_desktop_app_info_launch_handler_on_launched (G_DESKTOP_APP_INFO_LAUNCH_HANDLER (lookup), ++ app_info, uris, launch_ctx, pid); ++} ++ + #define _SPAWN_FLAGS_DEFAULT (G_SPAWN_SEARCH_PATH) + + static gboolean +@@ -1086,6 +1135,10 @@ + + goto out; + } ++ else ++ { ++ g_desktop_app_info_on_launched (info, old_uris, launch_context, pid); ++ } + + if (pid_callback != NULL) + pid_callback (info, pid, pid_callback_data); +@@ -3120,6 +3173,72 @@ + return desktop_entries; + } + ++/* GDesktopAppInfoLaunchHandler interface: */ ++ ++static void g_desktop_app_info_launch_handler_base_init (gpointer g_class); ++static void g_desktop_app_info_launch_handler_class_init (gpointer g_class, ++ gpointer class_data); ++ ++GType ++g_desktop_app_info_launch_handler_get_type (void) ++{ ++ static volatile gsize g_define_type_id__volatile = 0; ++ ++ if (g_once_init_enter (&g_define_type_id__volatile)) ++ { ++ const GTypeInfo desktop_app_info_launch_handler_info = ++ { ++ sizeof (GDesktopAppInfoLaunchHandlerIface), /* class_size */ ++ g_desktop_app_info_launch_handler_base_init, /* base_init */ ++ NULL, /* base_finalize */ ++ g_desktop_app_info_launch_handler_class_init, ++ NULL, /* class_finalize */ ++ NULL, /* class_data */ ++ 0, ++ 0, /* n_preallocs */ ++ NULL ++ }; ++ ++ GType g_define_type_id = ++ g_type_register_static (G_TYPE_INTERFACE, ++ I_("GDesktopAppInfoLaunchHandler"), ++ &desktop_app_info_launch_handler_info, 0); ++ ++ g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_OBJECT); ++ ++ g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); ++ } ++ ++ return g_define_type_id__volatile; ++} ++ ++static void ++g_desktop_app_info_launch_handler_class_init (gpointer g_class, ++ gpointer class_data) ++{ ++} ++ ++static void ++g_desktop_app_info_launch_handler_base_init (gpointer g_class) ++{ ++} ++ ++static void ++g_desktop_app_info_launch_handler_on_launched (GDesktopAppInfoLaunchHandler *launch_handler, ++ GDesktopAppInfo *app_info, ++ GList *uris, ++ GAppLaunchContext *launch_ctx, ++ gint pid) ++{ ++ GDesktopAppInfoLaunchHandlerIface *iface; ++ ++ g_return_if_fail (G_IS_DESKTOP_APP_INFO_LAUNCH_HANDLER (launch_handler)); ++ ++ iface = G_DESKTOP_APP_INFO_LAUNCH_HANDLER_GET_IFACE (launch_handler); ++ ++ (* iface->on_launched) (launch_handler, app_info, uris, launch_ctx, pid); ++} ++ + /* GDesktopAppInfoLookup interface: */ + + typedef GDesktopAppInfoLookupIface GDesktopAppInfoLookupInterface; +Index: glib-2.28.2/gio/gdesktopappinfo.h +=================================================================== +--- glib-2.28.2.orig/gio/gdesktopappinfo.h 2011-01-06 08:44:06.000000000 +1100 ++++ glib-2.28.2/gio/gdesktopappinfo.h 2011-03-08 13:31:40.605569315 +1100 +@@ -119,6 +119,37 @@ + + #endif /* G_DISABLE_DEPRECATED */ + ++ ++ ++#define G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER (g_desktop_app_info_launch_handler_get_type ()) ++#define G_DESKTOP_APP_INFO_LAUNCH_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER, GDesktopAppInfoLaunchHandler)) ++#define G_IS_DESKTOP_APP_INFO_LAUNCH_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER)) ++#define G_DESKTOP_APP_INFO_LAUNCH_HANDLER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER, GDesktopAppInfoLaunchHandlerIface)) ++ ++/** ++ * G_DESKTOP_APP_INFO_LAUNCH_HANDLER_EXTENSION_POINT_NAME: ++ * ++ * Extension point for default handler to launching. See ++ * <link linkend="extending-gio">Extending GIO</link>. ++ */ ++#define G_DESKTOP_APP_INFO_LAUNCH_HANDLER_EXTENSION_POINT_NAME "gio-desktop-app-info-launch-handler" ++ ++typedef struct _GDesktopAppInfoLaunchHandler GDesktopAppInfoLaunchHandler; ++typedef struct _GDesktopAppInfoLaunchHandlerIface GDesktopAppInfoLaunchHandlerIface; ++ ++struct _GDesktopAppInfoLaunchHandlerIface ++{ ++ GTypeInterface g_iface; ++ ++ void (* on_launched) (GDesktopAppInfoLaunchHandler *launch_handler, ++ GDesktopAppInfo *app_info, ++ GList *uris, ++ GAppLaunchContext *launch_ctx, ++ gint pid); ++}; ++ ++GType g_desktop_app_info_launch_handler_get_type (void) G_GNUC_CONST; ++ + G_END_DECLS + + #endif /* __G_DESKTOP_APP_INFO_H__ */ +Index: glib-2.28.2/gio/gio.symbols +=================================================================== +--- glib-2.28.2.orig/gio/gio.symbols 2011-01-18 07:54:00.000000000 +1100 ++++ glib-2.28.2/gio/gio.symbols 2011-03-08 13:31:40.605569315 +1100 +@@ -135,6 +135,7 @@ + g_desktop_app_info_get_filename + g_desktop_app_info_get_is_hidden + g_desktop_app_info_get_type G_GNUC_CONST ++g_desktop_app_info_launch_handler_on_launched + g_desktop_app_info_launch_uris_as_manager + g_desktop_app_info_lookup_get_type G_GNUC_CONST + g_desktop_app_info_lookup_get_default_for_uri_scheme +Index: glib-2.28.2/gio/giomodule.c +=================================================================== +--- glib-2.28.2.orig/gio/giomodule.c 2011-01-06 08:44:06.000000000 +1100 ++++ glib-2.28.2/gio/giomodule.c 2011-03-08 13:31:40.605569315 +1100 +@@ -559,6 +559,9 @@ + ep = g_io_extension_point_register (G_PROXY_EXTENSION_POINT_NAME); + g_io_extension_point_set_required_type (ep, G_TYPE_PROXY); + ++ ep = g_io_extension_point_register (G_DESKTOP_APP_INFO_LAUNCH_HANDLER_EXTENSION_POINT_NAME); ++ g_io_extension_point_set_required_type (ep, G_TYPE_DESKTOP_APP_INFO_LAUNCH_HANDLER); ++ + ep = g_io_extension_point_register (G_TLS_BACKEND_EXTENSION_POINT_NAME); + g_io_extension_point_set_required_type (ep, G_TYPE_TLS_BACKEND); + } |