Beispiel #1
0
static void
gnm_app_init (GObject *obj)
{
	GnmApp *gnm_app = GNM_APP (obj);
	static gboolean icons_installed = FALSE;

	if (!icons_installed) {
		icons_installed = TRUE;
		install_icons (gnm_app);
	}

	gnm_app->clipboard_copied_contents = NULL;
	gnm_app->clipboard_sheet_view = NULL;

	gnm_app->workbook_list = NULL;

	if (gdk_display_get_default ()) {
		/*
		 * Only allocate a GtkRecentManager if we have a gui.
		 * This is, in part, because it currently throws an error.
		 * deep inside gtk+.
		 */
		gnm_app->recent = gtk_recent_manager_get_default ();
		g_signal_connect_object (G_OBJECT (gnm_app->recent),
					 "changed",
					 G_CALLBACK (cb_recent_changed),
					 gnm_app, 0);
	}

	app = gnm_app;
}
Beispiel #2
0
void
libgoffice_init (void)
{
	if (initialized++)
		return;

#ifdef G_OS_WIN32
	{
	gchar *dir;

#define S(s)	#s
	char const *module_name =
		"libgoffice-" S(GO_VERSION_EPOCH) "-" S(GO_VERSION_MAJOR) ".dll";
#undef S
	wchar_t *wc_module_name = g_utf8_to_utf16 (module_name, -1, NULL, NULL, NULL);
	HMODULE hmodule = GetModuleHandleW (wc_module_name);
	g_free (wc_module_name);
	dir = g_win32_get_package_installation_directory_of_module (hmodule);

	libgoffice_data_dir = g_build_filename (dir,
		"share", "goffice", GOFFICE_VERSION, NULL);
	libgoffice_icon_dir = g_build_filename (dir,
		"share", "pixmaps", "goffice", GOFFICE_VERSION, NULL);
	libgoffice_locale_dir = g_build_filename (dir,
		"share", "locale", NULL);
	libgoffice_lib_dir = g_build_filename (dir,
		"lib", "goffice", GOFFICE_VERSION, NULL);
	g_free (dir);
	}
#else
#ifdef GTKOSXAPPLICATION
    if (quartz_application_get_bundle_id ())
    {
        gchar *dir;

        dir = quartz_application_get_resource_path ();
	libgoffice_data_dir = g_build_filename (dir,
		"share", "goffice", GOFFICE_VERSION, NULL);
	libgoffice_icon_dir = g_build_filename (dir,
		"share", "pixmaps", "goffice", GOFFICE_VERSION, NULL);
	libgoffice_locale_dir = g_build_filename (dir,
		"share", "locale", NULL);
	libgoffice_lib_dir = g_build_filename (dir,
		"lib", "goffice", GOFFICE_VERSION, NULL);
	g_free (dir);
    }
#endif /* GTKOSXAPPLICATION */
#endif

	bindtextdomain (GETTEXT_PACKAGE, libgoffice_locale_dir);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	gsf_init ();

	_go_string_init ();
	_go_conf_init ();
	_go_fonts_init ();
	_go_math_init ();
	_go_rsm_init ();
	go_register_ui_files ();

	/* keep trigger happy linkers from leaving things out */
	_go_plugin_services_init ();
	_gog_plugin_services_init ();
#ifdef GOFFICE_WITH_GTK
	_goc_plugin_services_init ();
	install_icons ();
#endif
	g_type_ensure (GO_TYPE_PLUGIN_LOADER_MODULE);
	g_type_ensure (GOG_TYPE_GRAPH);
	g_type_ensure (GOG_TYPE_CHART);
	g_type_ensure (GOG_TYPE_PLOT);
	g_type_ensure (GOG_TYPE_SERIES);
	g_type_ensure (GOG_TYPE_SERIES_ELEMENT);
	g_type_ensure (GOG_TYPE_LEGEND);
	g_type_ensure (GOG_TYPE_AXIS);
	g_type_ensure (GOG_TYPE_AXIS_LINE);
	g_type_ensure (GOG_TYPE_COLOR_SCALE);
	g_type_ensure (GOG_TYPE_LABEL);
	g_type_ensure (GOG_TYPE_GRID);
	g_type_ensure (GOG_TYPE_GRID_LINE);
#ifdef GOFFICE_WITH_LASEM
	g_type_ensure (GOG_TYPE_EQUATION);
#endif
	g_type_ensure (GOG_TYPE_ERROR_BAR);
	g_type_ensure (GOG_TYPE_REG_EQN);
	g_type_ensure (GOG_TYPE_SERIES_LABELS);
	g_type_ensure (GOG_TYPE_DATA_LABEL);
	g_type_ensure (GOG_TYPE_SERIES_LINES);
	g_type_ensure (GO_TYPE_DATA_SCALAR_VAL);
	g_type_ensure (GO_TYPE_DATA_SCALAR_STR);
	g_type_ensure (GOG_3D_BOX_TYPE);
	g_type_ensure (GO_TYPE_EMF);
	g_type_ensure (GO_TYPE_PIXBUF);
	g_type_ensure (GO_TYPE_SPECTRE);
	g_type_ensure (GO_TYPE_SVG);

	_gog_themes_init ();
	_go_number_format_init ();
	_go_currency_date_format_init ();
	_go_distributions_init ();
	initialized = TRUE;
}