mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
GWin32AppInfo: Add g_win32_app_info_launch_uris_impl utility function
This utility function will be called by both launch_uris and launch_uris_async, passing a from_task parameter respectively as NULL and non-NULL. The from_task parameter will be needed to know whether GAppLaunchContext signals should be emitted directly (from_task == NULL) or scheduled for emission on the main thread (from_task != NULL).
This commit is contained in:
parent
bf13a5e0a4
commit
f0ff6a6af0
@ -4776,6 +4776,7 @@ g_win32_app_info_launch_internal (GWin32AppInfo *info,
|
||||
IShellItemArray *items, /* UWP only */
|
||||
GAppLaunchContext *launch_context,
|
||||
GSpawnFlags spawn_flags,
|
||||
GTask *from_task,
|
||||
GError **error)
|
||||
{
|
||||
gboolean completed = FALSE;
|
||||
@ -5070,9 +5071,10 @@ make_item_array (gboolean for_files,
|
||||
|
||||
|
||||
static gboolean
|
||||
g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
||||
g_win32_app_info_launch_uris_impl (GAppInfo *appinfo,
|
||||
GList *uris,
|
||||
GAppLaunchContext *launch_context,
|
||||
GTask *from_task,
|
||||
GError **error)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
@ -5091,7 +5093,7 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
||||
return res;
|
||||
}
|
||||
|
||||
res = g_win32_app_info_launch_internal (info, NULL, FALSE, items, launch_context, 0, error);
|
||||
res = g_win32_app_info_launch_internal (info, NULL, FALSE, items, launch_context, 0, from_task, error);
|
||||
|
||||
if (items != NULL)
|
||||
IShellItemArray_Release (items);
|
||||
@ -5132,6 +5134,7 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
||||
NULL,
|
||||
launch_context,
|
||||
G_SPAWN_SEARCH_PATH,
|
||||
from_task,
|
||||
error);
|
||||
|
||||
g_list_free_full (objs, free_file_or_uri);
|
||||
@ -5139,6 +5142,15 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
||||
return res;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
||||
GList *uris,
|
||||
GAppLaunchContext *launch_context,
|
||||
GError **error)
|
||||
{
|
||||
return g_win32_app_info_launch_uris_impl (appinfo, uris, launch_context, NULL, error);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GList *uris; /* (element-type utf8) (owned) (nullable) */
|
||||
@ -5164,7 +5176,7 @@ launch_uris_async_thread (GTask *task,
|
||||
GError *local_error = NULL;
|
||||
gboolean succeeded;
|
||||
|
||||
succeeded = g_app_info_launch_uris (appinfo, data->uris, data->context, &local_error);
|
||||
succeeded = g_win32_app_info_launch_uris_impl (appinfo, data->uris, data->context, task, &local_error);
|
||||
if (succeeded)
|
||||
g_task_return_boolean (task, TRUE);
|
||||
else
|
||||
@ -5235,7 +5247,7 @@ g_win32_app_info_launch (GAppInfo *appinfo,
|
||||
return res;
|
||||
}
|
||||
|
||||
res = g_win32_app_info_launch_internal (info, NULL, TRUE, items, launch_context, 0, error);
|
||||
res = g_win32_app_info_launch_internal (info, NULL, TRUE, items, launch_context, 0, NULL, error);
|
||||
|
||||
if (items != NULL)
|
||||
IShellItemArray_Release (items);
|
||||
@ -5267,6 +5279,7 @@ g_win32_app_info_launch (GAppInfo *appinfo,
|
||||
NULL,
|
||||
launch_context,
|
||||
G_SPAWN_SEARCH_PATH,
|
||||
NULL,
|
||||
error);
|
||||
|
||||
g_list_free_full (objs, free_file_or_uri);
|
||||
|
Loading…
Reference in New Issue
Block a user