int
main (int argc, char *argv[])
{
    GOptionContext *context;
    GError *error = NULL;

    setlocale (LC_ALL, "");
    bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
    textdomain (GETTEXT_PACKAGE);

    context = g_option_context_new ("- dawati status panel");
    g_option_context_add_main_entries (context, status_options, GETTEXT_PACKAGE);
    g_option_context_add_group (context, clutter_get_option_group_without_init ());
    g_option_context_add_group (context, cogl_get_option_group ());
    g_option_context_add_group (context, gtk_get_option_group (FALSE));

    if (!g_option_context_parse (context, &argc, &argv, &error))
    {
        g_critical (G_STRLOC ": Error parsing option: %s", error->message);
        g_clear_error (&error);
    }

    g_option_context_free (context);

    mpl_panel_clutter_init_with_gtk (&argc, &argv);

    mx_style_load_from_file (mx_style_get_default (),
                             THEMEDIR "/panel.css",
                             &error);

    if (error)
    {
        g_critical ("Unable to load style: %s", error->message);
        g_clear_error (&error);
    }

    panel = g_new0 (DawatiStatusPanel, 1);

    if (status_standalone)
        setup_standalone (panel);
    else
        setup_panel (panel);

    clutter_main ();


    return EXIT_SUCCESS;
}
示例#2
0
文件: main.c 项目: brownsr/muffin
/**
 * meta_get_option_context: (skip)
 *
 * Returns a #GOptionContext initialized with muffin-related options.
 * Parse the command-line args with this before calling meta_init().
 *
 * Return value: the #GOptionContext
 */
GOptionContext *
meta_get_option_context (void)
{
  GOptionContext *ctx;

  if (setlocale (LC_ALL, "") == NULL)
    meta_warning ("Locale not understood by C library, internationalization will not work\n");
  bindtextdomain (GETTEXT_PACKAGE, MUFFIN_LOCALEDIR);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");

  ctx = g_option_context_new (NULL);
  g_option_context_add_main_entries (ctx, meta_options, GETTEXT_PACKAGE);
  g_option_context_add_group (ctx, clutter_get_option_group_without_init ());
  g_option_context_add_group (ctx, cogl_get_option_group ());

  return ctx;
}
示例#3
0
int
main (int argc,
    char *argv[])
{
  GOptionContext *optcontext;
  GOptionEntry options[] = {
      { NULL }
  };
#ifdef ENABLE_DEBUG
  TpDebugSender *debug_sender;
#endif
  GError *error = NULL;
  gint retval;
  GtkSettings *gtk_settings;

  /* Init */
  g_thread_init (NULL);

#ifdef GDK_WINDOWING_X11
  /* We can't call clutter_gst_init() before gtk_clutter_init(), so no choice
   * but to intiialise X11 threading ourself */
  XInitThreads ();
#endif

  /* Clutter needs this */
  gdk_disable_multidevice ();

  optcontext = g_option_context_new (N_("- Empathy Audio/Video Client"));
  g_option_context_add_group (optcontext, gst_init_get_option_group ());
  g_option_context_add_group (optcontext, gtk_get_option_group (TRUE));
  g_option_context_add_group (optcontext, cogl_get_option_group ());
  g_option_context_add_group (optcontext,
      clutter_get_option_group_without_init ());
  g_option_context_add_group (optcontext, gtk_clutter_get_option_group ());
  g_option_context_add_main_entries (optcontext, options, GETTEXT_PACKAGE);

  if (!g_option_context_parse (optcontext, &argc, &argv, &error)) {
    g_print ("%s\nRun '%s --help' to see a full list of available command "
        "line options.\n",
        error->message, argv[0]);
    g_warning ("Error in empathy-call init: %s", error->message);
    return EXIT_FAILURE;
  }

  g_option_context_free (optcontext);

  clutter_gst_init (&argc, &argv);

  empathy_gtk_init ();
  g_set_application_name (_("Empathy Audio/Video Client"));

  /* Make empathy and empathy-call appear as the same app in gnome-shell */
  gdk_set_program_class ("Empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  gtk_settings = gtk_settings_get_default ();
  g_object_set (G_OBJECT (gtk_settings), "gtk-application-prefer-dark-theme",
      TRUE, NULL);

  app = gtk_application_new (EMPATHY_CALL_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Disable timer");

      use_timer = FALSE;
    }

  call_windows = g_hash_table_new_full (g_direct_hash, g_direct_equal,
      g_object_unref, NULL);

  /* the inactivity timeout can only be set while the application is held */
  g_application_hold (G_APPLICATION (app));
  g_application_set_inactivity_timeout (G_APPLICATION (app), TIMEOUT * 1000);
  g_application_release (G_APPLICATION (app));

  retval = g_application_run (G_APPLICATION (app), argc, argv);

  g_hash_table_unref (call_windows);
  g_object_unref (app);
  tp_clear_object (&call_factory);

#ifdef ENABLE_DEBUG
  g_object_unref (debug_sender);
#endif

  return retval;
}
示例#4
0
文件: pinpoint.c 项目: bpeel/pinpoint
int
main (int    argc,
      char **argv)
{
    PinPointRenderer *renderer;
    GOptionContext   *context;
    GError *error = NULL;
    char   *text  = NULL;

    memcpy (&default_point, &pin_default_point, sizeof (default_point));
    renderer = pp_clutter_renderer ();

    context = g_option_context_new ("- Presentations made easy");
    g_option_context_add_main_entries (context, entries, NULL);
    g_option_context_add_group (context, clutter_get_option_group_without_init ());
    g_option_context_add_group (context, cogl_get_option_group ());
    if (!g_option_context_parse (context, &argc, &argv, &error))
    {
        g_print ("option parsing failed: %s\n", error->message);
        return EXIT_FAILURE;
    }

    pinfile = argv[1];

    if (!pinfile)
    {
        g_print ("usage: %s [options] <presentation>\n", argv[0]);
        text = g_strdup ("[no-markup][transition=sheet][red]\n"
                         "--\n"
                         "usage: pinpoint [options] <presentation.txt>\n");
    }
    else
    {
        if (!g_file_get_contents (pinfile, &text, NULL, NULL))
        {
            g_print ("failed to load presentation from %s\n", pinfile);
            return -1;
        }
    }

#ifdef USE_CLUTTER_GST
    clutter_gst_init (&argc, &argv);
#else
    clutter_init (&argc, &argv);
#endif
#ifdef USE_DAX
    dax_init (&argc, &argv);
#endif

    /* select the cairo renderer if we have requested pdf output */
    if (pp_output_filename && g_str_has_suffix (pp_output_filename, ".pdf"))
    {
#ifdef HAVE_PDF
        renderer = pp_cairo_renderer ();
        /* makes more sense to default to a white "stage" colour in PDFs*/
        default_point.stage_color = "white";
#else
        g_warning ("Pinpoint was built without PDF support");
        return EXIT_FAILURE;
#endif
    }

    if (!pinfile)
        pp_rehearse = FALSE;

    if (pinfile)
    {
        GFile *file;

        file = g_file_new_for_commandline_arg (pinfile);
        pp_basedir = g_file_get_parent (file);
        g_object_unref (file);
    }

    renderer->init (renderer, pinfile);
    pp_parse_slides (renderer, text);
    g_free (text);

    if (pp_rehearse)
    {
        pp_rehearse_init ();
        printf ("Running in rehearsal mode, press ctrl+C to abort without saving timings back to %s\n", pinfile);
    }
    renderer->run (renderer);
    renderer->finalize (renderer);
    if (renderer->source)
        g_free (renderer->source);
#if 0
    if (pp_rehearse)
        pp_rehearse_save ();
#endif

    g_list_free (pp_slides);

    return 0;
}
示例#5
0
文件: sol.c 项目: mfrasca/aisleriot
static void
main_prog (void *closure, int argc, char *argv[])
{
  AppData data;
  GOptionContext *option_context;
  GError *error = NULL;
  gboolean retval;

  memset (&data, 0, sizeof (AppData));

  option_context = g_option_context_new (NULL);
  g_option_context_set_translation_domain (option_context, GETTEXT_PACKAGE);

  add_main_options (option_context, &data);

  ar_sound_enable (FALSE);

  g_option_context_add_group (option_context, gtk_get_option_group (TRUE));

#ifdef HAVE_CLUTTER
  g_option_context_add_group (option_context, cogl_get_option_group ());
  g_option_context_add_group (option_context, clutter_get_option_group_without_init ());
  g_option_context_add_group (option_context, gtk_clutter_get_option_group ());
#endif /* HAVE_CLUTTER */

  retval = g_option_context_parse (option_context, &argc, &argv, &error);
  g_option_context_free (option_context);

  if (!retval) {
    g_printerr ("%s\n", error->message);
    g_error_free (error);
    goto cleanup;
  }

  g_set_application_name (data.freecell ? _("FreeCell Solitaire") : _("AisleRiot"));

  aisleriot_conf_init ();

  /* If we are asked for a specific game, check that it is valid. */
  if (!data.freecell &&
      data.variation != NULL) {
    char *game_module = NULL;

    if (data.variation[0] != '\0') {
      game_module = ar_filename_to_game_module (data.variation);
    }

    g_free (data.variation);
    data.variation = game_module;
  }

  if (!data.freecell && !data.variation) {
    char *pref;

    pref = ar_conf_get_string_with_default (NULL, aisleriot_conf_get_key (CONF_VARIATION), DEFAULT_VARIATION);
    data.variation = ar_filename_to_game_module (pref);
    g_free (pref);
  }

  g_assert (data.variation != NULL || data.freecell);

  ar_stock_init ();

  gtk_window_set_default_icon_name (data.freecell ? "gnome-freecell" : "gnome-aisleriot");

  data.window = AISLERIOT_WINDOW (aisleriot_window_new (data.freecell));
  g_signal_connect (data.window, "destroy",
		    G_CALLBACK (gtk_main_quit), NULL);

  if (data.freecell) {
    aisleriot_window_set_game_module (data.window, FREECELL_VARIATION, NULL);
  } else {
    aisleriot_window_set_game_module (data.window, data.variation, NULL);
  }

  gtk_window_present (GTK_WINDOW (data.window));

  gtk_main ();

  aisleriot_conf_shutdown ();

cleanup:
  g_free (data.variation);

  g_settings_sync ();

  ar_runtime_shutdown ();
}