Esempio n. 1
0
int
main (int argc, char **argv)
{
	libgoffice_init ();

	test_general_format ();

	libgoffice_shutdown ();

	return 0;
}
int
main (int argc, char *argv[])
{

    MyFlowArrow *arrow;
    MySystem *system;

    JsonGenerator *gen = json_generator_new ();
    JsonNode *node, *root;
    JsonArray *array;
    gchar *data;
    gsize len;

    gtk_init (NULL, NULL);
    libgoffice_init ();

    root = json_node_new (JSON_NODE_ARRAY);

    array = json_array_new ();

    arrow =
        g_object_new (MY_TYPE_FLOW_ARROW,
                      "x0", 100.0,
                      "x1", 200.0,
                      "y0", 200.0,
                      "y1", 300.0,
                      "energy-quantity", -22.0, 
                      "anchor", MY_ANCHOR_NORTH,
                      "label-text", "test", NULL);

    node = json_gobject_serialize (G_OBJECT (arrow));
    json_array_add_element (array, node);

    system = g_object_new (MY_TYPE_SYSTEM, "x", 100.0, "y", 200.0, NULL);
    node = json_gobject_serialize (G_OBJECT (system));
    json_array_add_element (array, node);

    json_node_set_array (root, array);

    json_generator_set_root (gen, root);
    json_generator_set_pretty (gen, TRUE);

    data = json_generator_to_data (gen, &len);

    g_print ("%s\n", data);

    libgoffice_shutdown ();

    return 0;
}
Esempio n. 3
0
void
gnm_shutdown (void)
{
	GSList *plugin_states;

	gnm_app_clipboard_clear (TRUE);

	plugin_states = go_plugins_shutdown ();
	if (NULL != plugin_states) {
		gnm_conf_set_plugins_file_states (plugin_states);
		g_slist_free_full (plugin_states, g_free);
	}

	stf_shutdown ();
	gnm_xml_sax_write_shutdown ();
	gnm_xml_sax_read_shutdown ();

	gnm_autofill_shutdown ();
	print_shutdown ();
	gnm_func_shutdown_ ();

	gnm_rendered_value_shutdown ();
	dependent_types_shutdown ();
	gui_clipboard_shutdown ();
	clipboard_shutdown ();
	gnm_sheet_cell_shutdown ();
	gnm_expr_deriv_shutdown_ ();
	gnm_expr_shutdown_ ();
	parse_util_shutdown ();
	value_shutdown ();

	// The style leak printer may access font/border/color info so
	// shut styles down first.
	gnm_style_shutdown ();
	gnm_font_shutdown ();
	gnm_border_shutdown ();
	gnm_color_shutdown ();

	gnm_conf_shutdown ();

	_gnm_unregister_resource ();
	libgoffice_shutdown ();
	go_plugin_services_shutdown ();
	g_object_unref (gnm_app_get_app ());
	gutils_shutdown ();
}
Esempio n. 4
0
ABI_FAR_CALL
int abi_plugin_unregister (XAP_ModuleInfo * mi)
{
    mi->name = 0;
    mi->desc = 0;
    mi->version = 0;
    mi->author = 0;
    mi->usage = 0;

    IE_Imp::unregisterImporter (m_impSniffer);
    delete m_impSniffer;
    m_impSniffer = 0;

    IE_Imp::unregisterImporter (m_impCSniffer);
    delete m_impCSniffer;
    m_impCSniffer = 0;

    pGOChartManager->removeContextualMenu ();
    XAP_App * pApp = XAP_App::getApp();
    pApp->unRegisterEmbeddable(pGOChartManager->getObjectType());
    DELETEP(pGOChartManager);
	GSList *l = mime_types;
	while (l)
	{
		if (go_components_support_clipboard ((const char*)l->data))
			pApp->deleteClipboardFmt((const char*)l->data);
		l = l->next;
	}
	std::list<std::string>::iterator i, end = uids.end();
	for (i = uids.begin(); i != end; i++)
		pApp->unRegisterEmbeddable((*i).c_str());
	uids.clear();
	if (pGOComponentManager) {
		pApp->unRegisterEmbeddable(pGOComponentManager->getObjectType());
		DELETEP(pGOComponentManager);
	}
    AbiGOffice_removeFromMenus();
	go_component_set_default_command_context (NULL);
	g_object_unref (cc);
	go_plugins_shutdown();
	libgoffice_shutdown();

    return 1;
}
Esempio n. 5
0
int
main (int argc, char *argv[])
{
	GtkWidget *window;
	GODemoPrivate *priv;
	const gchar *ui_file;

	gtk_init (&argc, &argv);
	/* Initialize libgoffice */
	libgoffice_init ();
	/* Initialize plugins manager */
	go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_resize (GTK_WINDOW (window), 800, 800);
	gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
	gtk_window_set_title (GTK_WINDOW (window), "GOffice demo");
	g_signal_connect (window, "destroy", gtk_main_quit, NULL);

	priv = g_new0 (GODemoPrivate, 1);
#define GO_DEMO_UI  "go-demo.ui"
	ui_file = "./" GO_DEMO_UI;
	if (!g_file_test (ui_file, G_FILE_TEST_EXISTS))
		ui_file = "../" GO_DEMO_UI;
	if (!g_file_test (ui_file, G_FILE_TEST_EXISTS)) {
		g_warning ("Unable to load file %s", GO_DEMO_UI);
		return 0;
	}
	priv->xml = gtk_builder_new ();
	gtk_builder_add_from_file (priv->xml, ui_file, NULL);
#undef GO_DEMO_GLADE

	priv->toplevel = go_gtk_builder_get_widget (priv->xml, "toplevel");
	gtk_container_add (GTK_CONTAINER (window), priv->toplevel);

	priv->menu_item_quit = GTK_ACTION (gtk_builder_get_object (priv->xml, "menu_item_quit"));
	g_signal_connect (priv->menu_item_quit, "activate",
			G_CALLBACK (on_quit), window);

	priv->btn_regen = go_gtk_builder_get_widget (priv->xml, "btn_regen");
	g_signal_connect (priv->btn_regen, "clicked",
			G_CALLBACK (btn_regen_clicked), priv);

	priv->notebook_data = go_gtk_builder_get_widget (priv->xml, "notebook_data");
	init_data_widgets (priv);
	gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook_data), 1);

	priv->notebook_charts = go_gtk_builder_get_widget (priv->xml, "notebook_charts");
	generate_all_charts (GTK_NOTEBOOK (priv->notebook_charts));

	gtk_widget_show_all (GTK_WIDGET (window));

	gtk_main ();

	g_object_unref (priv->xml);
	g_free (priv);

	/* Clean libgoffice stuff */
	libgoffice_shutdown ();
	return 0;
}
Esempio n. 6
0
int
main (int argc, char *argv[])
{
	GtkWidget *window, *box, *w;
	GogChart *chart;
	GogGraph *graph;
	GogLabel *label;
	GogPlot *pie;
	GogSeries *series;
	GOStyle *style;
	GOData *data;
	GError *error;
	PangoFontDescription *desc;
	char const *title = "Some statistics";
	char const * const legends[] = {"first", "second", "third", "fourth"};
	double values[] = {10., 20., 30., 40.};

	gtk_init (&argc, &argv);
	/* Initialize libgoffice */
	libgoffice_init ();
	/* Initialize plugins manager */
	go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_resize (GTK_WINDOW (window), 300, 340);
	gtk_window_set_title (GTK_WINDOW (window), "pie demo");
	g_signal_connect (window, "destroy", gtk_main_quit, NULL);

	box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
	w = gtk_button_new_from_stock (GTK_STOCK_QUIT);
	g_signal_connect_swapped (w, "clicked", G_CALLBACK (on_quit), window);
	gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 0);

	w = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_box_pack_end (GTK_BOX (box), w, FALSE, FALSE, 2);

	/* Create a graph widget and add it to the GtkVBox */
	w = go_graph_widget_new (NULL);
	gtk_box_pack_end (GTK_BOX (box), w, TRUE, TRUE, 0);
	/* Get the embedded graph */
	graph = go_graph_widget_get_graph (GO_GRAPH_WIDGET (w));
	/* Add a title */
	label = (GogLabel *) g_object_new (GOG_TYPE_LABEL, NULL);
	data = go_data_scalar_str_new (title, FALSE);
	gog_dataset_set_dim (GOG_DATASET (label), 0, data, NULL);
	gog_object_add_by_name (GOG_OBJECT (graph), "Title", GOG_OBJECT (label));
	/* Change the title font */
	style = go_styled_object_get_style (GO_STYLED_OBJECT (label));
	desc = pango_font_description_from_string ("Sans bold 16");
	go_style_set_font_desc (style, desc);
	/* Get the chart created by the widget initialization */
	chart = go_graph_widget_get_chart (GO_GRAPH_WIDGET (w));
	/* Create a pie plot and add it to the chart */
	pie = (GogPlot *) gog_plot_new_by_name ("GogPiePlot");
	gog_object_add_by_name (GOG_OBJECT (chart), "Plot", GOG_OBJECT (pie));
	/* Create a series for the plot and populate it with some simple data */
	series = gog_plot_new_series (pie);
	data = go_data_vector_str_new (legends, 4, NULL);
	gog_series_set_dim (series, 0, data, &error);
	data = go_data_vector_val_new (values, 4, NULL);
	gog_series_set_dim (series, 1, data, &error);
	/* Add a legend to the chart */
	gog_object_add_by_name (GOG_OBJECT (chart), "Legend", NULL);

	gtk_container_add (GTK_CONTAINER (window), box);
	gtk_widget_show_all (GTK_WIDGET (window));

	w = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
	gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);

	gtk_main ();

	/* Clean libgoffice stuff */
	libgoffice_shutdown ();
	return 0;
}
void XAP_UnixApp::shutdown()
{
	libgoffice_shutdown();
}
Esempio n. 8
0
void main_win_32 (  int argc, char **argv )
{
#ifdef _WIN32
    GtkWidget *vbox;
    gboolean first_use = FALSE;
    cmdline_options  opt;
    gint status = CMDLINE_SYNTAX_OK;    /* be optimistic ;-) */

    /* Retrieve exception information and store them under grisbi.rpt file!
     * see http://jrfonseca.dyndns.org/projects/gnu-win32/software/drmingw/index.html for more information */
    LoadLibrary("exchndl.dll");

    /* we store the path of the running file to use it for pixmaps, help and locales .... */
    win32_set_app_path(argv[0]);

     /* needed to be able to use the "common" installation of GTK libraries */
    win32_make_sure_the_gtk2_dlls_path_is_in_PATH();

    /* initialisation des différents répertoires */
    gsb_dirs_init ( );

    bindtextdomain ( PACKAGE, gsb_dirs_get_locale_dir ( ) );
    bind_textdomain_codeset ( PACKAGE, "UTF-8" );
    textdomain ( PACKAGE );

    /* Setup locale/gettext */
    setlocale( LC_ALL, NULL );

    gsb_locale_init ( );

    /* initialisation libgoffice */
    libgoffice_init ( );
    /* Initialize plugins manager */
    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);

    gtk_init ( &argc, &argv );

    win32_parse_gtkrc ( "gtkrc" );

    /* parse command line parameter, exit with correct error code when needed */
    if ( !parse_options (argc, argv, &opt, &status ) )
        exit ( status );

    /* initialise les données de l'application */
    first_use = gsb_grisbi_init_app ( );

    /* create the toplevel window and the main menu */
    vbox = gsb_main_create_main_window ( );
    gsb_grisbi_create_main_menu ( vbox );
    main_window_set_size_and_position ( );

    gtk_widget_show ( run.window );

#if IS_DEVELOPMENT_VERSION == 1
    dialog_message ( "development-version", VERSION );
#endif

    gsb_grisbi_load_file_if_necessary ( &opt );

    if ( first_use && !nom_fichier_comptes )
        gsb_assistant_first_run ();
    else
        display_tip ( FALSE );

    gtk_main ();

    /* sauvegarde les raccourcis claviers */
    gtk_accel_map_save ( gsb_dirs_get_accelerator_filename () );

    gsb_locale_shutdown ( );
    gsb_dirs_shutdown ( );

    /* liberation libgoffice */
    libgoffice_shutdown ( );

#if GSB_GMEMPROFILE
    g_mem_profile();
#endif

    exit ( 0 );

#endif /* WIN_32 */
}
Esempio n. 9
0
void main_mac_osx ( int argc, char **argv )
{
#ifdef GTKOSXAPPLICATION
    GtkWidget *vbox;
    GtkWidget *menubar;
    GdkPixbuf *pixbuf;
    cmdline_options  opt;
    gboolean first_use = FALSE;
    gint status = CMDLINE_SYNTAX_OK;
    GtkOSXApplication *theApp;

    devel_debug ("main_mac_osx");

#if IS_DEVELOPMENT_VERSION == 1
    gsb_grisbi_print_environment_var ( );
#endif

    gtk_init ( &argc, &argv );

    /* initialisation libgoffice */
    libgoffice_init ( );
    /* Initialize plugins manager */
    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);

    /* init the app */
    theApp = g_object_new ( GTK_TYPE_OSX_APPLICATION, NULL );

    /* initialisation des différents répertoires */
    gsb_dirs_init ( );

    bindtextdomain ( PACKAGE,  gsb_dirs_get_locale_dir ( ) );
    bind_textdomain_codeset ( PACKAGE, "UTF-8" );
    textdomain ( PACKAGE );

    /* Setup locale/gettext */
    setlocale (LC_ALL, "");
    gsb_locale_init ( );

    /* on commence par détourner le signal SIGSEGV */
    gsb_grisbi_trappe_signal_sigsegv ( );

    /* parse command line parameter, exit with correct error code when needed */
    if ( !parse_options (argc, argv, &opt, &status ) )
        exit ( status );

    /* initialise les données de l'application */
    first_use = gsb_grisbi_init_app ( );

    vbox = gsb_main_create_main_window ( );
    {
        gboolean falseval = FALSE;
        gboolean trueval = TRUE;

        g_signal_connect ( theApp,
                        "NSApplicationDidBecomeActive",
                        G_CALLBACK ( grisbi_osx_app_active_cb ),
                        &trueval );
        g_signal_connect ( theApp,
                        "NSApplicationWillResignActive",
                        G_CALLBACK ( grisbi_osx_app_active_cb ),
                        &falseval);
        g_signal_connect ( theApp,
                        "NSApplicationBlockTermination",
                        G_CALLBACK ( gsb_main_grisbi_close ),
                        NULL);
        g_signal_connect ( theApp,
                        "NSApplicationWillTerminate",
                        G_CALLBACK ( main_window_destroy_event ),
                        NULL );
    }
    menubar = gsb_grisbi_create_main_menu ( vbox );
    grisbi_osx_init_menus ( main_window, menubar );
    main_window_set_size_and_position ( );

    gtk_widget_show ( run.window );

#if IS_DEVELOPMENT_VERSION == 1
    dialog_message ( "development-version", VERSION );
#endif

    gsb_grisbi_load_file_if_necessary ( &opt );

    if ( first_use && !nom_fichier_comptes )
        gsb_assistant_first_run ();
    else
        display_tip ( FALSE );

    if ( quartz_application_get_bundle_id ( ) == NULL )
    {
        pixbuf = gdk_pixbuf_new_from_file ( g_build_filename
                        (gsb_dirs_get_pixmaps_dir ( ), "grisbi-logo.png", NULL), NULL );
        if ( pixbuf )
            gtk_osxapplication_set_dock_icon_pixbuf ( theApp, pixbuf );
    }

    gtk_osxapplication_set_use_quartz_accelerators ( theApp, TRUE );

    gtk_osxapplication_ready ( theApp );

    gtk_main ();

    /* sauvegarde les raccourcis claviers */
    gtk_accel_map_save ( gsb_dirs_get_accelerator_filename () );

    g_object_unref ( theApp );

    gsb_locale_shutdown ( );
    gsb_dirs_shutdown ( );

    /* liberation libgoffice */
    libgoffice_shutdown ( );

#if GSB_GMEMPROFILE
    g_mem_profile();
#endif

    exit ( 0 );

#endif /* GTKOSXAPPLICATION */
}
Esempio n. 10
0
void main_linux ( int argc, char **argv )
{
    GtkWidget *vbox;
    gboolean first_use = FALSE;
    cmdline_options  opt;
    gint status = CMDLINE_SYNTAX_OK;

    /* initialisation des différents répertoires */
    gsb_dirs_init ( );

    bindtextdomain ( PACKAGE, gsb_dirs_get_locale_dir ( ) );
    bind_textdomain_codeset ( PACKAGE, "UTF-8" );
    textdomain ( PACKAGE );

    /* Setup locale/gettext */
    setlocale (LC_ALL, "");
    gsb_locale_init ( );

#if IS_DEVELOPMENT_VERSION == 1
    gsb_grisbi_print_environment_var ( );
#endif

    gtk_init ( &argc, &argv );

    /* initialisation libgoffice */
    libgoffice_init ( );
    /* Initialize plugins manager */
    go_plugins_init (NULL, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE);

    /* on commence par détourner le signal SIGSEGV */
    gsb_grisbi_trappe_signal_sigsegv ( );

    /* parse command line parameter, exit with correct error code when needed */
    if ( !parse_options (argc, argv, &opt, &status ) )
        exit ( status );
    /* initialise les données de l'application */
    first_use = gsb_grisbi_init_app ( );

    /* create the toplevel window and the main menu */
    vbox = gsb_main_create_main_window ( );
    gsb_grisbi_create_main_menu ( vbox );
    main_window_set_size_and_position ( );

    gtk_widget_show ( run.window );

#if IS_DEVELOPMENT_VERSION == 1
    dialog_message ( "development-version", VERSION );
#endif

    /* check the command line, if there is something to open */
    gsb_grisbi_load_file_if_necessary ( &opt );

    if ( first_use && !nom_fichier_comptes )
        gsb_assistant_first_run ();
    else
        display_tip ( FALSE );

    gtk_main ();

    /* sauvegarde les raccourcis claviers */
    gtk_accel_map_save ( gsb_dirs_get_accelerator_filename () );

    /* libération de mémoire */
    gsb_locale_shutdown ( );
    gsb_dirs_shutdown ( );

    /* liberation libgoffice */
    libgoffice_shutdown ( );

#if GSB_GMEMPROFILE
    g_mem_profile();
#endif

    exit ( 0 );
}