ABI_FAR_CALL int abi_plugin_register (XAP_ModuleInfo * mi) { mi->name = "AbiGOffice"; mi->desc = "The plugin enables Gnome Office Charts and components to be displayed in AbiWord"; mi->version = ABI_VERSION_STRING; mi->author = "Jean Bréfort <*****@*****.**>"; mi->usage = "No Usage"; // Add to AbiWord's plugin importers m_impSniffer = new IE_Imp_Object_Sniffer(); IE_Imp::registerImporter (m_impSniffer); m_impCSniffer = new IE_Imp_Component_Sniffer(); IE_Imp::registerImporter (m_impCSniffer); // Add to AbiWord's plugin listeners XAP_App * pApp = XAP_App::getApp(); pGOChartManager = new GR_GOChartManager(NULL); pGOChartManager->buildContextualMenu (); pApp->registerEmbeddable(pGOChartManager); /* Initialize libgoffice */ libgoffice_init (); cc = GO_CMD_CONTEXT (g_object_new (ABI_CMD_CONTEXT_TYPE, NULL)); go_component_set_default_command_context (cc); /* Initialize plugins manager */ go_plugins_init (cc, NULL, NULL, NULL, TRUE, GO_TYPE_PLUGIN_LOADER_MODULE); /* Ensure some types are created */ GO_TYPE_DATA_SCALAR_STR; GO_TYPE_DATA_VECTOR_STR; GO_TYPE_DATA_SCALAR_VAL; GO_TYPE_DATA_VECTOR_VAL; GO_TYPE_DATA_MATRIX_VAL; // Add to AbiWord's menus. mime_types = go_components_get_mime_types (); if (mime_types && mime_types->data) { pGOComponentManager = new GR_GOComponentManager(NULL); pApp->registerEmbeddable(pGOComponentManager); } g_slist_foreach (mime_types, (GFunc) register_mime_cb, pApp); AbiGOffice_addToMenus(); return 1; }
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; }
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 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 */ }
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 */ }
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 ); }