mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +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 */
|
IShellItemArray *items, /* UWP only */
|
||||||
GAppLaunchContext *launch_context,
|
GAppLaunchContext *launch_context,
|
||||||
GSpawnFlags spawn_flags,
|
GSpawnFlags spawn_flags,
|
||||||
|
GTask *from_task,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean completed = FALSE;
|
gboolean completed = FALSE;
|
||||||
@ -5070,9 +5071,10 @@ make_item_array (gboolean for_files,
|
|||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
g_win32_app_info_launch_uris_impl (GAppInfo *appinfo,
|
||||||
GList *uris,
|
GList *uris,
|
||||||
GAppLaunchContext *launch_context,
|
GAppLaunchContext *launch_context,
|
||||||
|
GTask *from_task,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
gboolean res = FALSE;
|
gboolean res = FALSE;
|
||||||
@ -5091,7 +5093,7 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
|||||||
return res;
|
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)
|
if (items != NULL)
|
||||||
IShellItemArray_Release (items);
|
IShellItemArray_Release (items);
|
||||||
@ -5132,6 +5134,7 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
|||||||
NULL,
|
NULL,
|
||||||
launch_context,
|
launch_context,
|
||||||
G_SPAWN_SEARCH_PATH,
|
G_SPAWN_SEARCH_PATH,
|
||||||
|
from_task,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
g_list_free_full (objs, free_file_or_uri);
|
g_list_free_full (objs, free_file_or_uri);
|
||||||
@ -5139,6 +5142,15 @@ g_win32_app_info_launch_uris (GAppInfo *appinfo,
|
|||||||
return res;
|
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
|
typedef struct
|
||||||
{
|
{
|
||||||
GList *uris; /* (element-type utf8) (owned) (nullable) */
|
GList *uris; /* (element-type utf8) (owned) (nullable) */
|
||||||
@ -5164,7 +5176,7 @@ launch_uris_async_thread (GTask *task,
|
|||||||
GError *local_error = NULL;
|
GError *local_error = NULL;
|
||||||
gboolean succeeded;
|
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)
|
if (succeeded)
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
else
|
else
|
||||||
@ -5235,7 +5247,7 @@ g_win32_app_info_launch (GAppInfo *appinfo,
|
|||||||
return res;
|
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)
|
if (items != NULL)
|
||||||
IShellItemArray_Release (items);
|
IShellItemArray_Release (items);
|
||||||
@ -5267,6 +5279,7 @@ g_win32_app_info_launch (GAppInfo *appinfo,
|
|||||||
NULL,
|
NULL,
|
||||||
launch_context,
|
launch_context,
|
||||||
G_SPAWN_SEARCH_PATH,
|
G_SPAWN_SEARCH_PATH,
|
||||||
|
NULL,
|
||||||
error);
|
error);
|
||||||
|
|
||||||
g_list_free_full (objs, free_file_or_uri);
|
g_list_free_full (objs, free_file_or_uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user