int main (int argc, char *argv[]) { char *locale_dir = NULL; #ifdef GW_DEBUG_MODE #ifdef HAVE_GTK20 g_mem_set_vtable ( glib_mem_profiler_table); #endif gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "application is starting ==> memory status : "); g_mem_profile ( ); #endif #ifdef ENABLE_NLS #ifdef GW_DEBUG_MODE gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "NLS enabled"); #endif setlocale ( LC_ALL, ""); if ( (locale_dir = gw_package_get_locale_dir ( )) != NULL) { #ifdef GW_DEBUG_MODE gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "Locale is %s", locale_dir); #endif bindtextdomain ( PACKAGE, locale_dir); textdomain ( PACKAGE); g_free ( locale_dir); } #endif gtk_set_locale ( ); // g_log_set_handler ( "Gtk", G_LOG_LEVEL_WARNING, (GLogFunc) gtk_false, NULL); // g_log_set_handler ( "Gtk", G_LOG_LEVEL_WARNING, g_log_default_handler, NULL); gtk_init ( &argc, &argv); #ifdef GW_DEBUG_MODE gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "application is initializing ==> memory status : "); g_mem_profile ( ); #endif gw_am_init ( argc, argv); #ifdef GW_DEBUG_MODE gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "application is loading catalog ==> memory status : "); g_mem_profile ( ); #endif /* Enter the main loop */ gtk_main ( ); #ifdef GW_DEBUG_MODE gw_am_log_msg ( 0, __FILE__, __LINE__, __PRETTY_FUNCTION__, "application is exited ==> memory status : "); g_mem_profile ( ); #endif return 0; }
static void test_profiler (void) { if (g_test_subprocess ()) { gpointer p; g_mem_set_vtable (glib_mem_profiler_table); p = g_malloc (100); p = g_realloc (p, 200); g_free (p); p = g_malloc0 (1000); g_free (p); p = g_try_malloc (2000); p = g_try_realloc (p, 3000); g_free (p); p = g_malloc (0); p = g_malloc0 (0); p = g_realloc (NULL, 0); p = g_try_malloc (0); p = g_try_realloc (NULL, 0); g_mem_profile (); exit (0); } g_test_trap_subprocess (NULL, 0, 0); g_test_trap_assert_passed (); g_test_trap_assert_stdout ("*GLib Memory statistics*"); }
static gpointer profiler_calloc (gsize n_blocks, gsize n_block_bytes) { gsize l = n_blocks * n_block_bytes; gsize *p; #ifdef G_ENABLE_DEBUG if (g_trap_malloc_size == l) G_BREAKPOINT (); #endif /* G_ENABLE_DEBUG */ p = calloc (1, sizeof (gsize) * 2 + l); if (p) { p[0] = 0; /* free count */ p[1] = l; /* length */ profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, TRUE); p += 2; } else { profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, FALSE); g_mem_profile (); } return p; }
int main (int argc, char **argv) { int ret; g_mem_set_vtable (glib_mem_profiler_table); ret = rsvg_tools_main (&argc, &argv); g_mem_profile (); return ret; }
static gpointer profiler_malloc (gsize n_bytes) { gpointer mem = profiler_try_malloc (n_bytes); if (!mem) g_mem_profile (); return mem; }
static gpointer profiler_realloc (gpointer mem, gsize n_bytes) { mem = profiler_try_realloc (mem, n_bytes); if (!mem) g_mem_profile (); return mem; }
int main (int argc, char *argv[]) { g_mem_set_vtable (glib_mem_profiler_table); #if !GLIB_CHECK_VERSION (2, 35, 0) g_type_init (); #endif test_query_events (); /* Print memory usage data */ g_mem_profile (); return 0; }
/* Clean up */ static void cleanup(){ AppData *app_data; app_data = app_data_aux_ptr; config_destroy(&app_data->config); g_list_foreach(app_data->hosts, (GFunc)g_object_unref, NULL); g_queue_foreach(app_data->queue, (GFunc)g_object_unref, NULL); g_list_free(app_data->hosts); g_queue_free(app_data->queue); g_slice_free(AppData, app_data); syslog(LOG_NOTICE, "Exiting now"); exit(0); g_mem_profile(); }
/* * All exit functions should go here. * This function will be called right before the process is terminated. */ int server_exit(void) { g_mem_profile(); DBG_LOG(SEVERE, MOD_SYSTEM, "System is shutting down"); DBG_LOG(ALARM, MOD_SYSTEM, "nvsd system is shutting down"); /* Core thread join */ #if 0 for(i = 0; i < glob_num_core_threads; i++) { g_thread_join(nkn_sched_threads[i]); } #endif // 0 free( nkn_sched_threads); exit_counters(); virt_cache_server_exit(); nvsd_mgmt_deinit(); if(net_use_nkn_stack) nkn_unload_netstack(); // Initialize the user space net stack log_thread_end(); exit(0); }
/** * CGstMediaManager::~CGstMediaManager() * * Destructor */ CGstMediaManager::~CGstMediaManager() { #if JFXMEDIA_DEBUG g_print ("CGstMediaManager::~CGstMediaManager()\n"); #endif m_bStopGlibLogFunc = true; if (NULL != m_pRunloopCond) { g_cond_free(m_pRunloopCond); m_pRunloopCond = NULL; } if (NULL != m_pRunloopMutex) { g_mutex_free(m_pRunloopMutex); m_pRunloopMutex = NULL; } if (NULL != m_pMainLoop) { g_main_loop_quit (m_pMainLoop); g_main_loop_unref(m_pMainLoop); m_pMainLoop = NULL; } if (NULL != m_pMainContext) { g_main_context_unref(m_pMainContext); m_pMainContext = NULL; } gst_deinit(); #if ENABLE_LOWLEVELPERF && TARGET_OS_MAC g_mem_profile (); #endif }
static gpointer profiler_calloc (gsize n_blocks, gsize n_block_bytes) { gsize l = n_blocks * n_block_bytes; gsize *p; p = calloc (1, sizeof (gsize) * 2 + l); if (p) { p[0] = 0; /* free count */ p[1] = l; /* length */ profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, TRUE); p += 2; } else { profiler_log (PROFILER_ALLOC | PROFILER_ZINIT, l, FALSE); g_mem_profile (); } return p; }
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 ); }
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 */ }
int main(const int ac, const char* av[]) { poptContext optCon=0; gint rc; gint status = 0; const gchar* arg; struct error* err; #ifdef __DEBUG g_mem_set_vtable(glib_mem_profiler_table); #endif err = e_new(); /* check if we have enough privileges */ #ifndef __WIN32__ unsetenv("LD_LIBRARY_PATH"); #else putenv("LD_LIBRARY_PATH"); putenv("LD_LIBRARY_PATH="); #endif /* load blacklists from SPKG_CONFDIR */ gchar** bl_symopts = load_blacklist(SPKG_CONFDIR "/symopts_blacklist"); if (bl_symopts) cmd_opts.bl_symopts = bl_symopts; /* preset ROOT */ cmd_opts.root = getenv("ROOT"); /* initialize popt context */ optCon = poptGetContext("spkg", ac, av, opts, 0); poptSetOtherOptionHelp(optCon, "<command> [options] [packages...]"); /* parse options */ while ((rc = poptGetNextOpt(optCon)) != -1) { if (rc == 1) verbose++; else if (rc == 2) quiet++; if (rc < -1) { fprintf(stderr, "ERROR: Invalid argument: %s (%s)\n", poptStrerror(rc), poptBadOption(optCon, POPT_BADOPTION_NOALIAS)); goto err_1; } } /* these are help handlers */ if (help) { printf( PACKAGE_STRING "\n" "\n" "Written by Ondrej Jirman, 2005-2006.\n" "\n" "This is free software. Not like a beer or like in a \"freedom\",\n" "but like in \"I don't care what you are going to do with it.\"\n" "\n" ); poptPrintHelp(optCon, stdout, 0); printf( "\n" "Examples:\n" " spkg -i <packages> [--install]\n" " spkg -u <packages> [--upgrade]\n" " spkg -vd <packages> [--verbose --remove]\n" " spkg -l kde* [--list]\n" " spkg -vnu <packages> [--upgrade --verbose --dry-run]\n" "\n" "Official website: http://spkg.megous.com\n" "Bug reports can be sent to <*****@*****.**>.\n" ); goto out; } if (usage) { printf("Usage: spkg [-i|-u|-d|-l] [--root=ROOT] [-n] [-s] [-q] [-v] [packages...]\n"); goto out; } if (version) { printf("%s\n", PACKAGE_STRING); goto out; } /* check verbosity options */ if (verbose && quiet) { fprintf(stderr, "ERROR: Verbose or quiet?\n"); goto err_1; } cmd_opts.verbosity += verbose; cmd_opts.verbosity -= quiet; /* check command options */ switch (command) { case CMD_INSTALL: if (!cmd_opts.dryrun && !is_root()) goto err_noroot; if (poptPeekArg(optCon) == 0) goto err_nopackages; break; case CMD_UPGRADE: if (!cmd_opts.dryrun && !is_root()) goto err_noroot; if (poptPeekArg(optCon) == 0) goto err_nopackages; break; case CMD_REMOVE: if (!cmd_opts.dryrun && !is_root()) goto err_noroot; if (poptPeekArg(optCon) == 0) goto err_nopackages; break; case CMD_LIST: break; case 0: if (poptPeekArg(optCon) == 0) { printf("Usage: spkg [-i|-u|-d|-l] [--root=ROOT] [-n] [-s] [-q] [-v] [packages...]\n"); goto out; } if (!cmd_opts.dryrun && !is_root()) goto err_noroot; command = CMD_UPGRADE; install_new = TRUE; break; default: fprintf(stderr, "ERROR: Schizofrenic command usage.\n"); goto err_1; } /* init signal trap */ if (sig_trap(err)) goto err_2; /* open db */ gboolean readonly = cmd_opts.dryrun || !is_root(); if (db_open(cmd_opts.root, readonly, err)) goto err_2; switch (command) { case CMD_INSTALL: { while ((arg = poptGetArg(optCon)) != 0 && !sig_break) { if (cmd_install(arg, &cmd_opts, err)) { if (e_errno(err) & CMD_EXIST) { gchar* pkgname = parse_pkgname(arg, 5); _inform("Skipping package %s (package with same base name is already installed)...", pkgname ? pkgname : arg); g_free(pkgname); e_clean(err); } else { e_print(err); e_clean(err); status = 2; } } } } break; case CMD_UPGRADE: { while ((arg = poptGetArg(optCon)) != 0 && !sig_break) { if (cmd_upgrade(arg, &cmd_opts, err)) { if (install_new && (e_errno(err) & CMD_NOTEX)) { e_clean(err); if (cmd_install(arg, &cmd_opts, err)) { e_print(err); e_clean(err); status = 2; } } else if (e_errno(err) & CMD_NOTEX) { gchar* pkgname = parse_pkgname(arg, 5); _inform("Skipping package %s (package with same base name is NOT installed)...", pkgname ? pkgname : arg); g_free(pkgname); e_clean(err); } else if (e_errno(err) & CMD_EXIST) { gchar* pkgname = parse_pkgname(arg, 5); _inform("Skipping package %s (already uptodate)...", pkgname ? pkgname : arg); g_free(pkgname); e_clean(err); } else { e_print(err); e_clean(err); status = 2; } } } } break; case CMD_REMOVE: { while ((arg = poptGetArg(optCon)) != 0 && !sig_break) { if (cmd_remove(arg, &cmd_opts, err)) { e_print(err); e_clean(err); status = 2; } } } break; case CMD_LIST: { GSList* arglist = NULL; while ((arg = poptGetArg(optCon)) != 0) arglist = g_slist_append(arglist, g_strdup(arg)); if (cmd_list(arglist, &cmd_opts, err)) { e_print(err); e_clean(err); status = 2; } g_slist_foreach(arglist, (GFunc)g_free, 0); g_slist_free(arglist); } break; } db_close(); out: poptFreeContext(optCon); e_free(err); #ifdef __DEBUG g_mem_profile(); #endif /* 0 = all ok * 1 = command line error * 2 = package manager error */ return status; err_1: status = 1; goto out; err_2: status = 2; e_print(err); goto out; err_nopackages: fprintf(stderr, "ERROR: No packages specified.\n"); goto err_1; err_noroot: fprintf(stderr, "ERROR: You need root privileges to run this command. Try using --dry-run.\n"); goto err_1; }
/* * _sig_usr2_handler: * @sig: the signal number, which is usually SIGUSR2. * * A signal handler for SIGUSR2 signal. Dump a summary of memory usage to stderr. */ static void _sig_usr2_handler (int sig) { g_mem_profile (); }
int main (int argc, char **argv) { const char *pid_file = NULL; const char *run_file = NULL; const char *url = APTERYX_SERVER; bool background = false; pthread_mutexattr_t callback_recursive; FILE *fp; int i; /* Parse options */ while ((i = getopt (argc, argv, "hdmbp:r:l:")) != -1) { switch (i) { case 'd': apteryx_debug = true; background = false; break; case 'b': background = true; break; case 'p': pid_file = optarg; break; case 'r': run_file = optarg; break; case 'l': url = optarg; break; case 'm': g_mem_set_vtable (glib_mem_profiler_table); break; case '?': case 'h': default: help (); return 0; } } /* Handle SIGTERM/SIGINT/SIGPIPE gracefully */ signal (SIGTERM, (__sighandler_t) termination_handler); signal (SIGINT, (__sighandler_t) termination_handler); signal (SIGPIPE, SIG_IGN); /* Daemonize */ if (background && fork () != 0) { /* Parent */ return 0; } /* Create pid file */ if (background && pid_file) { fp = fopen (pid_file, "w"); if (!fp) { ERROR ("Failed to create PID file %s\n", pid_file); goto exit; } fprintf (fp, "%d\n", getpid ()); fclose (fp); } /* Initialise the database */ db_init (); /* Initialise callbacks to clients */ cb_init (); /* Configuration Set/Get */ config_init (); /* Create a lock for currently-validating */ pthread_mutexattr_init (&callback_recursive); pthread_mutexattr_settype (&callback_recursive, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init (&validating, &callback_recursive); /* Init the RPC for the server instance */ rpc = rpc_init ((ProtobufCService *)&apteryx_server_service, &apteryx__client__descriptor, RPC_TIMEOUT_US); if (rpc == NULL) { ERROR ("Failed to initialise RPC service\n"); goto exit; } /* Create server and process requests */ if (!rpc_server_bind (rpc, url, url)) { ERROR ("Failed to start rpc service\n"); goto exit; } /* Init the RPC for the proxy client */ proxy_rpc = rpc_init (NULL, &apteryx__server__descriptor, RPC_TIMEOUT_US); if (proxy_rpc == NULL) { ERROR ("Failed to initialise proxy RPC service\n"); goto exit; } /* Create run file */ if (run_file) { fp = fopen (run_file, "w"); if (!fp) { ERROR ("Failed to create RUN file %s\n", run_file); goto exit; } fclose (fp); } /* Loop while running */ while (running) { pause (); } exit: DEBUG ("Exiting\n"); /* Cleanup callbacks */ cb_shutdown (); db_shutdown (); if (proxy_rpc) { rpc_shutdown (proxy_rpc); } if (rpc) { rpc_server_release (rpc, url); rpc_shutdown (rpc); } /* Remove the pid file */ if (background && pid_file) unlink (pid_file); /* Remove the run file */ if (run_file) unlink (run_file); /* Memory profiling */ g_mem_profile (); return 0; }
int main(int argc, char *argv[]) { GError *err = NULL; GOptionContext *opt_ctxt; GMainLoop *loop; PlcIoComm *io_comm; GIOStream *ser_io; #ifdef MEMPROFILE g_mem_set_vtable (glib_mem_profiler_table); #endif app_init(&app_ctxt); /*g_type_init();*/ opt_ctxt = g_option_context_new (" - Scratch helper for PLCS2 extension"); g_option_context_add_main_entries(opt_ctxt, app_options, NULL); if (!g_option_context_parse(opt_ctxt, &argc, &argv, &err)) { g_printerr("Failed to parse options: %s\n", err->message); app_cleanup(&app_ctxt); return EXIT_FAILURE; } g_option_context_free(opt_ctxt); if (!app_ctxt.config_filename) { g_printerr("No configuration file\n"); app_cleanup(&app_ctxt); return EXIT_FAILURE; } if (!read_config_file(&app_ctxt, &err)) { g_printerr("Failed to read config file: %s\n", err->message); g_clear_error(&err); app_cleanup(&app_ctxt); return EXIT_FAILURE; } if (app_ctxt.daemon) { if (!go_daemon(&app_ctxt, &err)) { g_printerr("Failed to start as daemon: %s\n", err->message); g_clear_error(&err); app_cleanup(&app_ctxt); return EXIT_FAILURE; } } ser_io = serial_device_open(app_ctxt.serial_device, 38400, 8, ParityNone, &err); if (!ser_io) { g_critical("Failed to open serial device: %s\n", err->message); app_cleanup(&app_ctxt); g_clear_error(&err); return EXIT_FAILURE; } io_comm = plc_io_comm_new(ser_io, &err); g_object_unref(ser_io); if (!io_comm) { g_critical("Failed to setup communication with PLC: %s\n", err->message); app_cleanup(&app_ctxt); g_clear_error(&err); return EXIT_FAILURE; } app_ctxt.websocket_server = (WebsocketServer*)plc_io_server_new(io_comm); g_object_unref(io_comm); configure_websocket_server(&app_ctxt); if (!websocket_server_start(app_ctxt.websocket_server, &err)) { g_critical("Failed to setup server: %s\n", err->message); app_cleanup(&app_ctxt); g_clear_error(&err); return EXIT_FAILURE; } loop = g_main_loop_new(NULL, FALSE); g_unix_signal_add(SIGINT, sigint_handler, loop); g_unix_signal_add(SIGTERM, sigint_handler, loop); g_debug("Starting"); g_main_loop_run(loop); g_main_loop_unref(loop); g_message("Exiting"); app_cleanup(&app_ctxt); #ifdef MEMPROFILE g_mem_profile (); #endif return EXIT_SUCCESS; }
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 */ }