コード例 #1
0
ファイル: mex-main.c プロジェクト: ocrete/media-explorer
/**
 * mex_init:
 * @argc: pointer to the argument list count
 * @argv: pointer to the argument list vector
 *
 * Utility function to initialize the Media Explorer library.
 *
 * This function should be called before calling any other GLib functions. If
 * this is not an option, your program must initialise the GLib thread system
 * using g_thread_init() before any other GLib functions are called.
 *
 * Return value: %TRUE on success, %FALSE on failure.
 *
 *
 * Since: 0.2
 */
gboolean
mex_init (int    *argc,
          char ***argv)
{
  if (mex_is_initialized)
    return TRUE;

  if (!g_thread_supported ())
    g_thread_init (NULL);

  mex_grilo_init (argc, argv);

  mex_base_init (argc, argv);

  mex_is_initialized = TRUE;

  return TRUE;
}
コード例 #2
0
/**
 * mex_init:
 * @argc: pointer to the argument list count
 * @argv: pointer to the argument list vector
 *
 * Utility function to initialize the Media Explorer library.
 *
 * This function should be called before calling any other GLib functions. If
 * this is not an option, your program must initialise the GLib thread system
 * using g_thread_init() before any other GLib functions are called.
 *
 * Return value: %TRUE on success, %FALSE on failure.
 *
 *
 * Since: 0.2
 */
gboolean
mex_init (int    *argc,
          char ***argv)
{
  gboolean retval;

  if (mex_is_initialized)
    return TRUE;

  if (!g_thread_supported ())
    g_thread_init (NULL);

  retval = clutter_init (argc, argv);

  mex_base_init (argc, argv);

  mex_is_initialized = TRUE;

  return retval;
}
コード例 #3
0
/**
 * mex_init_with_args:
 * @argc: a pointer to the number of command line arguments.
 * @argv: a pointer to the array of command line arguments.
 * @parameter_string: a string which is displayed in
 *    the first line of <option>--help</option> output, after
 *    <literal><replaceable>programname</replaceable> [OPTION...]</literal>
 * @entries: a %NULL-terminated array of #GOptionEntry<!-- -->s
 *    describing the options of your program
 * @translation_domain: a translation domain to use for translating
 *    the <option>--help</option> output for the options in @entries
 *    with gettext(), or %NULL
 * @error: a return location for errors
 *
 * This function does the same work as mex_init(). Additionally, it
 * allows you to add your own command line options, and it automatically
 * generates nicely formatted --help output. Clutter's #GOptionGroup
 * is added to the set of available options.
 *
 * This function should be called before calling any other GLib functions. If
 * this is not an option, your program must initialise the GLib thread system
 * using g_thread_init() before any other GLib functions are called.
 *
 * Return value: %TRUE on success, %FALSE on failure.
 *
 * Since: 0.2
 */
gboolean
mex_init_with_args (int            *argc,
                    char         ***argv,
                    const char     *parameter_string,
                    GOptionEntry   *entries,
                    const char     *translation_domain,
                    GError        **error)
{
  GOptionContext *context;
  gboolean res;

  if (mex_is_initialized)
    return TRUE;

  if (!g_thread_supported ())
    g_thread_init (NULL);

  context = g_option_context_new (parameter_string);

  g_option_context_add_group (context, clutter_get_option_group ());

  if (entries)
    g_option_context_add_main_entries (context, entries, translation_domain);

  res = g_option_context_parse (context, argc, argv, error);
  g_option_context_free (context);

  if (!res)
        return FALSE;

  mex_base_init (argc, argv);

  mex_is_initialized = TRUE;

  return TRUE;
}