Add "forever" scope

Some functions are meant to exist for the entire duration of the
process, and thus have no need for a notification function because
one will never be called.

Fixes: #49
This commit is contained in:
Emmanuele Bassi 2020-04-08 20:04:03 +01:00 committed by Emmanuele Bassi
parent c493763ff2
commit 4398e1fde2
3 changed files with 14 additions and 6 deletions

View File

@ -1244,6 +1244,8 @@ start_parameter (GMarkupParseContext *context,
param->scope = GI_SCOPE_TYPE_ASYNC;
else if (scope && strcmp (scope, "notified") == 0)
param->scope = GI_SCOPE_TYPE_NOTIFIED;
else if (scope && strcmp (scope, "forever") == 0)
param->scope = GI_SCOPE_TYPE_FOREVER;
else
param->scope = GI_SCOPE_TYPE_INVALID;

View File

@ -532,6 +532,9 @@ write_callable_info (const gchar *namespace,
case GI_SCOPE_TYPE_NOTIFIED:
xml_printf (file, " scope=\"notified\"");
break;
case GI_SCOPE_TYPE_FOREVER:
xml_printf (file, " scope=\"forever\"");
break;
default:
g_assert_not_reached ();
}

View File

@ -358,12 +358,14 @@ typedef enum {
* GIScopeType:
* @GI_SCOPE_TYPE_INVALID: The argument is not of callback type.
* @GI_SCOPE_TYPE_CALL: The callback and associated user_data is only
* used during the call to this function.
* used during the call to this function.
* @GI_SCOPE_TYPE_ASYNC: The callback and associated user_data is
* only used until the callback is invoked, and the callback.
* is invoked always exactly once.
* @GI_SCOPE_TYPE_NOTIFIED: The callback and and associated
* user_data is used until the caller is notfied via the destroy_notify.
* only used until the callback is invoked, and the callback.
* is invoked always exactly once.
* @GI_SCOPE_TYPE_NOTIFIED: The callback and associated
* user_data is used until the caller is notfied via the destroy_notify.
* @GI_SCOPE_TYPE_FOREVER: The callback and associated user_data is
* used until the process terminates
*
* Scope type of a #GIArgInfo representing callback, determines how the
* callback is invoked and is used to decided when the invoke structs
@ -373,7 +375,8 @@ typedef enum {
GI_SCOPE_TYPE_INVALID,
GI_SCOPE_TYPE_CALL,
GI_SCOPE_TYPE_ASYNC,
GI_SCOPE_TYPE_NOTIFIED
GI_SCOPE_TYPE_NOTIFIED,
GI_SCOPE_TYPE_FOREVER
} GIScopeType;
/**