diff options
author | Kalev Lember <kalevlember@gmail.com> | 2015-02-03 10:47:11 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-02-13 22:45:29 +0000 |
commit | 4d8f52eeef81a4b44af36d007dbeda157c5cec3f (patch) | |
tree | 76750a45c629a6f01a31cd9bc4b6a5e79f024661 | |
parent | 538dc374c6899ae243831f134af2dbe9487bb48d (diff) |
install-plugins: Add API to suppress confirmation before searching
The new gst_install_plugins_context_set_confirm_search() API can be used
to pass a hint to modify the behaviour of the external installer
process.
https://bugzilla.gnome.org/show_bug.cgi?id=744465
-rw-r--r-- | gst-libs/gst/pbutils/install-plugins.c | 28 | ||||
-rw-r--r-- | gst-libs/gst/pbutils/install-plugins.h | 3 |
2 files changed, 31 insertions, 0 deletions
diff --git a/gst-libs/gst/pbutils/install-plugins.c b/gst-libs/gst/pbutils/install-plugins.c index 28d15e03c..bd17843d8 100644 --- a/gst-libs/gst/pbutils/install-plugins.c +++ b/gst-libs/gst/pbutils/install-plugins.c @@ -381,12 +381,35 @@ static gboolean install_in_progress; /* FALSE */ /* private struct */ struct _GstInstallPluginsContext { + gchar *confirm_search; gchar *desktop_id; gchar *startup_notification_id; guint xid; }; /** + * gst_install_plugins_context_set_confirm_search: + * @ctx: a #GstInstallPluginsContext + * @confirm_search: whether to ask for confirmation before searching for plugins + * + * This function is used to tell the external installer process whether it + * should ask for confirmation or not before searching for missing plugins. + * + * If set, this option will be passed to the installer via a + * --interaction=[show-confirm-search|hide-confirm-search] command line option. + */ +void +gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx, gboolean confirm_search) +{ + g_return_if_fail (ctx != NULL); + + if (confirm_search) + ctx->confirm_search = g_strdup ("show-confirm-search"); + else + ctx->confirm_search = g_strdup ("hide-confirm-search"); +} + +/** * gst_install_plugins_context_set_desktop_id: * @ctx: a #GstInstallPluginsContext * @desktop_id: the desktop file ID of the calling application @@ -506,6 +529,7 @@ gst_install_plugins_context_free (GstInstallPluginsContext * ctx) { g_return_if_fail (ctx != NULL); + g_free (ctx->confirm_search); g_free (ctx->desktop_id); g_free (ctx->startup_notification_id); g_free (ctx); @@ -517,6 +541,7 @@ gst_install_plugins_context_copy (GstInstallPluginsContext * ctx) GstInstallPluginsContext *ret; ret = gst_install_plugins_context_new (); + ret->confirm_search = g_strdup (ctx->confirm_search); ret->desktop_id = g_strdup (ctx->desktop_id); ret->startup_notification_id = g_strdup (ctx->startup_notification_id); ret->xid = ctx->xid; @@ -568,6 +593,9 @@ gst_install_plugins_spawn_child (const gchar * const *details, g_ptr_array_add (arr, g_strdup (gst_install_plugins_get_helper ())); /* add any additional command line args from the context */ + if (ctx != NULL && ctx->confirm_search) { + g_ptr_array_add (arr, g_strdup_printf ("--interaction=%s", ctx->confirm_search)); + } if (ctx != NULL && ctx->desktop_id != NULL) { g_ptr_array_add (arr, g_strdup_printf ("--desktop-id=%s", ctx->desktop_id)); } diff --git a/gst-libs/gst/pbutils/install-plugins.h b/gst-libs/gst/pbutils/install-plugins.h index 220b4f8e7..cd3eb0016 100644 --- a/gst-libs/gst/pbutils/install-plugins.h +++ b/gst-libs/gst/pbutils/install-plugins.h @@ -101,6 +101,9 @@ GstInstallPluginsContext * gst_install_plugins_context_new (void); void gst_install_plugins_context_free (GstInstallPluginsContext * ctx); +void gst_install_plugins_context_set_confirm_search (GstInstallPluginsContext * ctx, + gboolean confirm_search); + void gst_install_plugins_context_set_desktop_id (GstInstallPluginsContext * ctx, const gchar * desktop_id); |