Commit ab40b242 authored by Matthias Clasen's avatar Matthias Clasen

Merge branch 'gio-extension-point-help' into 'master'

gio: Support "help" in extension point env vars

See merge request !601
parents 3d9727c0 8f718928
Pipeline #52971 passed with stages
in 20 minutes and 2 seconds
......@@ -371,6 +371,9 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
has the name "local", the implementation in the gvfs module has
the name "gvfs". Most commonly, system software will set this to "local"
to avoid having `GFile` APIs perform unnecessary DBus calls.
</para><para>
The special value <literal>help</literal> can be used to print a list of
available implementations to standard output.
</para>
</formalpara>
......@@ -390,6 +393,9 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
in GIO on Linux has the name "inotify", others that are built
are built as modules (depending on the platform) are called
"fam" and "fen".
</para><para>
The special value <literal>help</literal> can be used to print a list of
available implementations to standard output.
</para>
</formalpara>
......@@ -402,6 +408,9 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
The #GVolumeMonitor implementation for local files that is included
in GIO has the name "unix", the udisks2-based implementation in the
gvfs module has the name "udisks2".
</para><para>
The special value <literal>help</literal> can be used to print a list of
available implementations to standard output.
</para>
</formalpara>
......@@ -413,6 +422,9 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
implementation to override the default for debugging purposes.
GIO does not include a #GTlsBackend implementation, the gnutls-based
implementation in the glib-networking module has the name "gnutls".
</para><para>
The special value <literal>help</literal> can be used to print a list of
available implementations to standard output.
</para>
</formalpara>
......@@ -444,6 +456,9 @@ Gvfs is also heavily distributed and relies on a session bus to be present.
implementation to override the default for debugging purposes.
The memory-based implementation that is included in GIO has
the name "memory", the one in dconf has the name "dconf".
</para><para>
The special value <literal>help</literal> can be used to print a list of
available implementations to standard output.
</para>
</formalpara>
......
......@@ -700,6 +700,35 @@ try_class (GIOExtension *extension,
return NULL;
}
static void
print_help (const char *envvar,
GIOExtensionPoint *ep)
{
g_print ("Supported arguments for %s environment variable:\n", envvar);
if (g_io_extension_point_get_extensions (ep) == NULL)
g_print (" (none)\n");
else
{
GList *l;
GIOExtension *extension;
int width = 0;
for (l = g_io_extension_point_get_extensions (ep); l; l = l->next)
{
extension = l->data;
width = MAX (width, strlen (g_io_extension_get_name (extension)));
}
for (l = g_io_extension_point_get_extensions (ep); l; l = l->next)
{
extension = l->data;
g_print (" %*s - %d\n", width, g_io_extension_get_name (extension), g_io_extension_get_priority (extension));
}
}
}
/**
* _g_io_module_get_default_type:
* @extension_point: the name of an extension point
......@@ -766,6 +795,12 @@ _g_io_module_get_default_type (const gchar *extension_point,
}
use_this = envvar ? g_getenv (envvar) : NULL;
if (g_strcmp0 (use_this, "help") == 0)
{
print_help (envvar, ep);
use_this = NULL;
}
if (use_this)
{
preferred = g_io_extension_point_get_extension_by_name (ep, use_this);
......@@ -909,6 +944,12 @@ _g_io_module_get_default (const gchar *extension_point,
}
use_this = envvar ? g_getenv (envvar) : NULL;
if (g_strcmp0 (use_this, "help") == 0)
{
print_help (envvar, ep);
use_this = NULL;
}
if (use_this)
{
preferred = g_io_extension_point_get_extension_by_name (ep, use_this);
......@@ -920,7 +961,7 @@ _g_io_module_get_default (const gchar *extension_point,
goto done;
}
else
g_warning ("Can't find module '%s' specified in %s", use_this, envvar);
g_warning ("Can't find module '%s' specified in %s", use_this, envvar);
}
else
preferred = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment