equal
deleted
inserted
replaced
142 * <para> |
142 * <para> |
143 * It is strongly recommended that vendors provide a small helper application |
143 * It is strongly recommended that vendors provide a small helper application |
144 * as interlocutor to the real installer though, even more so if command line |
144 * as interlocutor to the real installer though, even more so if command line |
145 * argument munging is required to transform the command line arguments |
145 * argument munging is required to transform the command line arguments |
146 * passed by GStreamer to the helper application into arguments that are |
146 * passed by GStreamer to the helper application into arguments that are |
147 * understood by the reeal installer. |
147 * understood by the real installer. |
148 * </para> |
148 * </para> |
149 * <para> |
149 * <para> |
150 * The helper application path defined at compile time can be overriden at |
150 * The helper application path defined at compile time can be overriden at |
151 * runtime by setting the <envar>GST_INSTALL_PLUGINS_HELPER</envar> |
151 * runtime by setting the <envar>GST_INSTALL_PLUGINS_HELPER</envar> |
152 * environment variable. This can be useful for testing/debugging purposes. |
152 * environment variable. This can be useful for testing/debugging purposes. |
368 |
368 |
369 #ifdef HAVE_SYS_WAIT_H |
369 #ifdef HAVE_SYS_WAIT_H |
370 #include <sys/wait.h> |
370 #include <sys/wait.h> |
371 #endif |
371 #endif |
372 |
372 |
|
373 #include <string.h> |
|
374 |
373 /* best effort to make things compile and possibly even work on win32 */ |
375 /* best effort to make things compile and possibly even work on win32 */ |
374 #ifndef WEXITSTATUS |
376 #ifndef WEXITSTATUS |
375 # define WEXITSTATUS(status) ((((guint)(status)) & 0xff00) >> 8) |
377 # define WEXITSTATUS(status) ((((guint)(status)) & 0xff00) >> 8) |
376 #endif |
378 #endif |
377 #ifndef WIFEXITED |
379 #ifndef WIFEXITED |
391 * @ctx: a #GstInstallPluginsContext |
393 * @ctx: a #GstInstallPluginsContext |
392 * @xid: the XWindow ID (XID) of the top-level application |
394 * @xid: the XWindow ID (XID) of the top-level application |
393 * |
395 * |
394 * This function is for X11-based applications (such as most Gtk/Qt |
396 * This function is for X11-based applications (such as most Gtk/Qt |
395 * applications on linux/unix) only. You can use it to tell the external |
397 * applications on linux/unix) only. You can use it to tell the external |
396 * the XID of your main application window, so the installer can make its |
398 * installer the XID of your main application window. That way the installer |
397 * own window transient to your application windonw during the installation. |
399 * can make its own window transient to your application window during the |
|
400 * installation. |
398 * |
401 * |
399 * If set, the XID will be passed to the installer via a --transient-for=XID |
402 * If set, the XID will be passed to the installer via a --transient-for=XID |
400 * command line option. |
403 * command line option. |
401 * |
404 * |
402 * Gtk+/Gnome application should be able to obtain the XID of the top-level |
405 * Gtk+/Gnome application should be able to obtain the XID of the top-level |
507 GST_LOG ("Using plugin install helper '%s'", helper); |
510 GST_LOG ("Using plugin install helper '%s'", helper); |
508 return helper; |
511 return helper; |
509 } |
512 } |
510 |
513 |
511 static gboolean |
514 static gboolean |
|
515 ptr_array_contains_string (GPtrArray * arr, const gchar * s) |
|
516 { |
|
517 gint i; |
|
518 |
|
519 for (i = 0; i < arr->len; ++i) { |
|
520 if (strcmp ((const char *) g_ptr_array_index (arr, i), s) == 0) |
|
521 return TRUE; |
|
522 } |
|
523 return FALSE; |
|
524 } |
|
525 |
|
526 static gboolean |
512 gst_install_plugins_spawn_child (gchar ** details, |
527 gst_install_plugins_spawn_child (gchar ** details, |
513 GstInstallPluginsContext * ctx, GPid * child_pid, gint * exit_status) |
528 GstInstallPluginsContext * ctx, GPid * child_pid, gint * exit_status) |
514 { |
529 { |
515 GPtrArray *arr; |
530 GPtrArray *arr; |
516 gboolean ret; |
531 gboolean ret; |
526 if (ctx != NULL && ctx->xid != 0) { |
541 if (ctx != NULL && ctx->xid != 0) { |
527 g_snprintf (xid_str, sizeof (xid_str), "--transient-for=%u", ctx->xid); |
542 g_snprintf (xid_str, sizeof (xid_str), "--transient-for=%u", ctx->xid); |
528 g_ptr_array_add (arr, xid_str); |
543 g_ptr_array_add (arr, xid_str); |
529 } |
544 } |
530 |
545 |
531 /* finally, add the detail strings */ |
546 /* finally, add the detail strings, but without duplicates */ |
532 while (details != NULL && details[0] != NULL) { |
547 while (details != NULL && details[0] != NULL) { |
533 g_ptr_array_add (arr, details[0]); |
548 if (!ptr_array_contains_string (arr, details[0])) |
|
549 g_ptr_array_add (arr, details[0]); |
534 ++details; |
550 ++details; |
535 } |
551 } |
536 |
552 |
537 /* and NULL-terminate */ |
553 /* and NULL-terminate */ |
538 g_ptr_array_add (arr, NULL); |
554 g_ptr_array_add (arr, NULL); |