Example #1
0
void OSIPhone::initialize_core() {

	OS_Unix::initialize_core();
	SemaphoreIphone::make_default();

	set_data_dir(data_dir);
};
Example #2
0
int
main(int argc, char** argv)
{
  ChmSee *chmsee;
  const gchar* filename = NULL;
  const gchar* datadir = NULL;
  GError* error = NULL;
  gboolean option_version = FALSE;

#if defined(__linux__)
  if (!gcry_check_version(NULL)) {
    fprintf(stderr, "failed to initialize gcrypt\n");
    exit(1);
  }
  gcry_control (GCRYCTL_SET_THREAD_CBS,&gcry_threads_pthread);
  gcry_control (GCRYCTL_DISABLE_SECMEM, 0);
#endif

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


  GOptionEntry options[] = {
		  {"version", 0,
				  0, G_OPTION_ARG_NONE, &option_version,
				  _("Display the version and exit"),
				  NULL
		  },
		  {"verbose", 'v',
				  G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (void*)callback_verbose,
				  _("be verbose, repeat 3 times to get all info"),
				  NULL
		  },
		  {"quiet", 'q',
				  G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, (void*)callback_quiet,
				  _("be quiet, repeat 2 times to disable all info"),
				  NULL
		  },
		  {"datadir", 0,
				  G_OPTION_FLAG_FILENAME, G_OPTION_ARG_FILENAME, &datadir,
				  "choose data dir, default is " CHMSEE_DATA_DIR_DEFAULT,
				  "PATH"
		  },
		  {NULL}
  };
  if(!gtk_init_with_args(&argc, &argv,
                         "[chmfile]\n"
                         "\n"
                         "GTK+ based CHM file viewer\n"
                         "Example: chmsee FreeBSD_Handbook.chm"
                         ,
                         options,
                         g_strdup(GETTEXT_PACKAGE),
                         &error))
  {
    g_printerr("%s\n", error->message);
    return 1;
  }
  if(option_version) {
    g_print("%s\n", PACKAGE_STRING);
    return 0;
  }

  init_log(log_level);
  if(datadir != NULL) {
	  set_data_dir(datadir);
  }

  if(argc == 1) {
  } else if(argc == 2) {
    filename = argv[1];
  } else {
    g_printerr(_("more than 1 argument\n"));
    return 1;
  }

  gtk_rc_parse_string("style \"tab-close-button-style\" {\n"
    			"GtkWidget::focus-padding = 0\n"
    			"GtkWidget::focus-line-width = 0\n"
    			"xthickness = 0\n"
    			"ythickness = 0\n"
    			"}\n"
    			"widget \"*.tab-close-button\" style \"tab-close-button-style\"");

  /* i18n */
  bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
  bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);

  /* Show splash screen */
  startup_popup_new();

  /* Create main window */
  chmsee = chmsee_new(filename);

  gtk_widget_show(GTK_WIDGET (chmsee));

  gtk_main();

  return 0;
}