static const gchar * _ev_win32_get_locale_dir (HMODULE module) { if (locale_dir) return locale_dir; gchar *install_dir = NULL, *utf8_locale_dir; gchar *retval = NULL; if (evdocument_dll != NULL) install_dir = g_win32_get_package_installation_directory_of_module (module); if (install_dir) { utf8_locale_dir = g_build_filename (install_dir, "share", "locale", NULL); locale_dir = g_win32_locale_filename_from_utf8 (utf8_locale_dir); g_free (install_dir); g_free (utf8_locale_dir); } if (!locale_dir) locale_dir = g_strdup (""); return locale_dir; }
static const char * get_atk_locale_dir (void) { static gchar *atk_localedir = NULL; if (!atk_localedir) { const gchar *p; gchar *root, *temp; /* ATK_LOCALEDIR might end in either /lib/locale or * /share/locale. Scan for that slash. */ p = ATK_LOCALEDIR + strlen (ATK_LOCALEDIR); while (*--p != '/') ; while (*--p != '/') ; root = g_win32_get_package_installation_directory_of_module (atk_dll); temp = g_build_filename (root, p, NULL); g_free (root); /* atk_localedir is passed to bindtextdomain() which isn't * UTF-8-aware. */ atk_localedir = g_win32_locale_filename_from_utf8 (temp); g_free (temp); } return atk_localedir; }
/** * _glib_get_locale_dir: * * Return the path to the share\locale or lib\locale subfolder of the * GLib installation folder. The path is in the system codepage. We * have to use system codepage as bindtextdomain() doesn't have a * UTF-8 interface. */ gchar * _glib_get_locale_dir (void) { gchar *install_dir = NULL, *locale_dir; gchar *retval = NULL; if (glib_dll != NULL) install_dir = g_win32_get_package_installation_directory_of_module (glib_dll); if (install_dir) { /* * Append "/share/locale" or "/lib/locale" depending on whether * autoconfigury detected GNU gettext or not. */ const char *p = GLIB_LOCALE_DIR + strlen (GLIB_LOCALE_DIR); while (*--p != '/') ; while (*--p != '/') ; locale_dir = g_build_filename (install_dir, p, NULL); retval = g_win32_locale_filename_from_utf8 (locale_dir); g_free (install_dir); g_free (locale_dir); } if (retval) return retval; else return g_strdup (""); }
static void setup (void) { gchar *full_prefix; gchar *cp_prefix; G_LOCK (mutex); if (localedir != NULL) { G_UNLOCK (mutex); return; } /* This requires that the libeutil DLL is installed in $bindir */ full_prefix = g_win32_get_package_installation_directory_of_module(hmodule); cp_prefix = g_win32_locale_filename_from_utf8(full_prefix); localedir = replace_prefix (cp_prefix, EVOLUTION_LOCALEDIR); g_free (cp_prefix); prefix = g_strdup (full_prefix); /* It makes sense to have some of the paths overridable with * environment variables. */ bindir = replace_prefix (full_prefix, EVOLUTION_BINDIR); datadir = replace_prefix (full_prefix, EVOLUTION_DATADIR); ecpsdir = replace_prefix (full_prefix, EVOLUTION_ECPSDIR); etspecdir = replace_prefix (full_prefix, EVOLUTION_ETSPECDIR); galviewsdir = replace_prefix (full_prefix, EVOLUTION_GALVIEWSDIR); helpdir = replace_prefix (full_prefix, EVOLUTION_HELPDIR); if (g_getenv ("EVOLUTION_ICONDIR") && g_file_test (g_getenv ("EVOLUTION_ICONDIR"), G_FILE_TEST_IS_DIR)) icondir = g_getenv ("EVOLUTION_ICONDIR"); else icondir = replace_prefix (full_prefix, EVOLUTION_ICONDIR); if (g_getenv ("EVOLUTION_IMAGESDIR") && g_file_test (g_getenv ("EVOLUTION_IMAGESDIR"), G_FILE_TEST_IS_DIR)) imagesdir = g_getenv ("EVOLUTION_IMAGESDIR"); else imagesdir = replace_prefix (full_prefix, EVOLUTION_IMAGESDIR); libdir = replace_prefix (full_prefix, EVOLUTION_LIBDIR); libexecdir = replace_prefix (full_prefix, EVOLUTION_LIBEXECDIR); moduledir = replace_prefix (full_prefix, EVOLUTION_MODULEDIR); plugindir = replace_prefix (full_prefix, EVOLUTION_PLUGINDIR); privdatadir = replace_prefix (full_prefix, EVOLUTION_PRIVDATADIR); ruledir = replace_prefix (full_prefix, EVOLUTION_RULEDIR); sounddir = replace_prefix (full_prefix, EVOLUTION_SOUNDDIR); sysconfdir = replace_prefix (full_prefix, EVOLUTION_SYSCONFDIR); toolsdir = replace_prefix (full_prefix, EVOLUTION_TOOLSDIR); uidir = replace_prefix (full_prefix, EVOLUTION_UIDIR); g_free (full_prefix); G_UNLOCK (mutex); }
static gchar * _ghex_win32_locale_dir (void) { gchar *install_dir; gchar *locale_dir = NULL; gchar *utf8_locale_dir; install_dir = g_win32_get_package_installation_directory_of_module (NULL); if (install_dir) { utf8_locale_dir = g_build_filename (install_dir, "share", "locale", NULL); locale_dir = g_win32_locale_filename_from_utf8 (utf8_locale_dir); g_free (install_dir); g_free (utf8_locale_dir); } return locale_dir; }
/** * gimp_locale_directory: * * Returns the top directory for GIMP locale files. If the environment * variable GIMP2_LOCALEDIR exists, that is used. It should be an * absolute pathname. Otherwise, on Unix the compile-time defined * directory is used. On Windows, the installation directory as deduced * from the executable's full filename is used. * * The returned string is owned by GIMP and must not be modified or * freed. The returned string is in the encoding used for filenames by * the C library, which isn't necessarily UTF-8. (On Windows, unlike * the other similar functions here, the return value from this * function is in the system codepage, never in UTF-8. It can thus be * passed directly to the bindtextdomain() function from libintl which * does not handle UTF-8.) * * Returns: The top directory for GIMP locale files. */ const gchar * gimp_locale_directory (void) { static gchar *gimp_locale_dir = NULL; if (! gimp_locale_dir) { gchar *tmp = _gimp_reloc_find_locale_dir (LOCALEDIR); gimp_locale_dir = gimp_env_get_dir ("GIMP2_LOCALEDIR", tmp); g_free (tmp); #ifdef G_OS_WIN32 tmp = g_win32_locale_filename_from_utf8 (gimp_locale_dir); g_free (gimp_locale_dir); gimp_locale_dir = tmp; #endif } return gimp_locale_dir; }
static gchar* _inf_gettext_get_locale_dir(void) { #ifdef G_OS_WIN32 gchar* root; gchar* temp; gchar* result; root = g_win32_get_package_installation_directory_of_module(_inf_dll_handle); temp = g_build_filename(root, "share", "locale", NULL); g_free(root); result = g_win32_locale_filename_from_utf8(temp); g_free(temp); return result; #else return g_strdup(INF_LOCALEDIR); #endif }
static const gchar * get_localedir (void) { gchar *temp; temp = g_build_filename (gdk_pixbuf_get_toplevel (), "share/locale", NULL); #ifdef G_OS_WIN32 { gchar *retval; /* The localedir is passed to bindtextdomain() which isn't * UTF-8-aware. */ retval = g_win32_locale_filename_from_utf8 (temp); g_free (temp); return retval; } #else return temp; #endif }
static void gimp_fonts_add_directories (FcConfig *config, GList *path) { GList *list; g_return_if_fail (config != NULL); for (list = path; list; list = list->next) { gchar *dir = g_file_get_path (list->data); #ifdef G_OS_WIN32 gchar *tmp = g_win32_locale_filename_from_utf8 (dir); g_free (dir); dir = tmp; #endif FcConfigAppFontAddDir (config, (const FcChar8 *) dir); g_free (dir); } }
static VALUE rg_s_locale_filename_from_utf8(VALUE self, VALUE utf8_filename) { return CSTR2RVAL_FREE(g_win32_locale_filename_from_utf8(RVAL2CSTR(utf8_filename))); }
static void run ( const gchar *name, gint nparams, const GimpParam *param, gint *nreturn_vals, GimpParam **return_vals) { static GimpParam values[3]; GimpRunMode run_mode; GimpPDBStatusType status = GIMP_PDB_SUCCESS; SeparateContext mysc; //enum separate_function func = SEP_NONE; run_mode = param[0].data.d_int32; /* setup for localization */ INIT_I18N (); cmsErrorAction( LCMS_ERROR_IGNORE ); mysc.filename = NULL; if( nparams != ( run_mode == GIMP_RUN_NONINTERACTIVE ? 2 : 1 ) ) status = GIMP_PDB_CALLING_ERROR; else if( run_mode == GIMP_RUN_NONINTERACTIVE ) { if( param[1].type != GIMP_PDB_STRING || strlen( param[1].data.d_string ) == 0 ) status = GIMP_PDB_CALLING_ERROR; else mysc.filename = g_strdup( param[1].data.d_string ); } else { gint size = gimp_get_data_size( "plug-in-separate-import/lastpath" ); if( size ) { mysc.filename = g_malloc( size ); gimp_get_data( "plug-in-separate-import/lastpath", mysc.filename ); } } if( status == GIMP_PDB_SUCCESS && ( run_mode == GIMP_RUN_NONINTERACTIVE || separate_import_dialog( &mysc ) ) ) { gint i, j, x, y; TIFF *in; guint32 width, height, stripSize, stripCount, stripHeight; gint16 bps, spp, step, planerConfig, photometric, inkset, resolutionUnit; float xres, yres; const gchar *layerNames[] = { "C", "M", "Y", "K" }; guchar *buf, *maskbuf[4], *srcbuf, *destbuf[4], *iccProfile; gint32 layers[5], masks[4]; GimpDrawable *drw[4]; GimpPixelRgn rgn[4]; GimpRGB primaries[4] = { { .180, .541, .870, 1.0 }, { .925, .149, .388, 1.0 }, { .929, .862, .129, 1.0 }, { 0, 0, 0, 1.0 } }; gchar *str = NULL; gchar *baseName = g_path_get_basename( gimp_filename_to_utf8( mysc.filename ) ); #ifdef G_OS_WIN32 { gchar *_filename = NULL; // win32 filename encoding(not UTF-8) _filename = g_win32_locale_filename_from_utf8( mysc.filename ); in = TIFFOpen( _filename ? _filename : mysc.filename, "r" ); g_free( _filename ); } #else in = TIFFOpen( mysc.filename, "r" ); #endif if( !in ) { str = g_strdup_printf( _( "Cannot open : \"%s\"" ), baseName ); gimp_message( str ); g_free( str ); status = GIMP_PDB_EXECUTION_ERROR; } else { if( ( TIFFGetField( in, TIFFTAG_BITSPERSAMPLE, &bps ) == FALSE || ( bps != 8 && bps != 16 ) ) || ( TIFFGetField( in, TIFFTAG_SAMPLESPERPIXEL, &spp ) == FALSE || spp != 4 ) || ( TIFFGetField( in, TIFFTAG_PHOTOMETRIC, &photometric ) == FALSE || photometric != PHOTOMETRIC_SEPARATED ) || ( TIFFGetField( in, TIFFTAG_PLANARCONFIG, &planerConfig ) == FALSE || planerConfig != PLANARCONFIG_CONTIG ) || ( TIFFGetField( in, TIFFTAG_INKSET, &inkset ) == TRUE && inkset != INKSET_CMYK ) ) { str = g_strdup_printf( _( "\"%s\" is unsupported." ), baseName ); gimp_message( str ); g_free( str ); status = GIMP_PDB_EXECUTION_ERROR; } else { stripCount = TIFFNumberOfStrips( in ); stripSize = TIFFStripSize( in ); TIFFGetField( in, TIFFTAG_IMAGEWIDTH, &width ); TIFFGetField( in, TIFFTAG_IMAGELENGTH, &height ); TIFFGetField( in, TIFFTAG_ROWSPERSTRIP, &stripHeight ); TIFFGetField( in, TIFFTAG_RESOLUTIONUNIT, &resolutionUnit ); TIFFGetField( in, TIFFTAG_XRESOLUTION, &xres ); TIFFGetField( in, TIFFTAG_YRESOLUTION, &yres ); #if 0 str = g_strdup_printf( "Photometric : %d BPS : %d SPP : %d\nInkset : %d StripCount : %d", photometric, bps, spp, inkset, stripCount ); gimp_message( str ); g_free( str ); #endif step = ( bps == 16 ) ? 2 : 1; buf = g_malloc( stripSize ); values[1].data.d_image = gimp_image_new( width, height, GIMP_RGB ); gimp_image_set_resolution( values[1].data.d_image, xres, yres ); gimp_context_push(); for( i = 0; i < 4; i++ ) { layers[i] = gimp_layer_new( values[1].data.d_image, layerNames[i], width, height, GIMP_RGBA_IMAGE, 100.0, GIMP_DARKEN_ONLY_MODE ); gimp_context_set_foreground( &primaries[i] ); gimp_drawable_fill( layers[i], GIMP_FOREGROUND_FILL ); gimp_image_add_layer( values[1].data.d_image, layers[i], i ); masks[i] = gimp_layer_create_mask( layers[i], GIMP_ADD_BLACK_MASK ); gimp_layer_add_mask( layers[i], masks[i] ); drw[i] = gimp_drawable_get( masks[i] ); maskbuf[i] = g_malloc( width * stripHeight ); } gimp_context_pop(); layers[4] = gimp_layer_new( values[1].data.d_image, _( "Background" ), width, height, GIMP_RGB_IMAGE, 100.0, GIMP_NORMAL_MODE ); gimp_drawable_fill( layers[4], GIMP_WHITE_FILL ); gimp_image_add_layer( values[1].data.d_image, layers[4], 4 ); str = g_strdup_printf( _( "Reading \"%s\"..." ), baseName ); gimp_progress_init( str ); g_free( str ); for( i = 0; i < stripCount; i++ ) { guint32 size = TIFFReadEncodedStrip( in, i, buf, stripSize ); guint32 rowCount = ( size < stripSize ? height % stripHeight : stripHeight ); srcbuf = buf; if( bps == 16 ) srcbuf++; for( j = 0; j < 4; j++ ) { gimp_pixel_rgn_init( &( rgn[j] ), drw[j], 0, stripHeight * i, width, rowCount, FALSE, FALSE ); destbuf[j] = maskbuf[j]; } for( y = 0; y < rowCount; y++ ) { for( x = 0; x < width; x++ ) { *destbuf[0]++ = *srcbuf; srcbuf += step; *destbuf[1]++ = *srcbuf; srcbuf += step; *destbuf[2]++ = *srcbuf; srcbuf += step; *destbuf[3]++ = *srcbuf; srcbuf += step; //srcbuf += spp > 4 ? spp - 4 : 0; } } gimp_pixel_rgn_set_rect( &( rgn[0] ), maskbuf[0], 0, stripHeight * i, width, rowCount ); gimp_pixel_rgn_set_rect( &( rgn[1] ), maskbuf[1], 0, stripHeight * i, width, rowCount ); gimp_pixel_rgn_set_rect( &( rgn[2] ), maskbuf[2], 0, stripHeight * i, width, rowCount ); gimp_pixel_rgn_set_rect( &( rgn[3] ), maskbuf[3], 0, stripHeight * i, width, rowCount ); gimp_progress_update( (gdouble)i / stripCount ); } g_free( buf ); for( i = 0; i < 4; i++ ) { g_free( maskbuf[i] ); gimp_drawable_detach( drw[i] ); } #ifdef ENABLE_COLOR_MANAGEMENT if ( TIFFGetField( in, TIFFTAG_ICCPROFILE, &width, &iccProfile ) ) { GimpParasite *parasite; parasite = gimp_parasite_new( CMYKPROFILE, 0, width, iccProfile ); gimp_image_parasite_attach( values[1].data.d_image, parasite ); gimp_parasite_free( parasite ); //g_free( iccProfile ); // This causes clash on TIFFClose( in ). } #endif } TIFFClose( in ); } g_free( baseName ); } else status = GIMP_PDB_CANCEL; *return_vals = values; values[0].type = GIMP_PDB_STATUS; values[0].data.d_status = status; if( status == GIMP_PDB_SUCCESS ) { *nreturn_vals = 2; values[1].type = GIMP_PDB_IMAGE; if( run_mode != GIMP_RUN_NONINTERACTIVE ) { gimp_image_undo_enable( values[1].data.d_image ); gimp_display_new( values[1].data.d_image ); gimp_displays_flush(); } gimp_set_data( "plug-in-separate-import/lastpath", mysc.filename, strlen( mysc.filename ) + 1 ); } else *nreturn_vals = 1; g_free( mysc.filename ); }
static void load_single_dir (GalViewCollection *collection, char *dir, gboolean local) { xmlDoc *doc = NULL; xmlNode *root; xmlNode *child; char *filename = g_build_filename(dir, "galview.xml", NULL); char *default_view; if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { #ifdef G_OS_WIN32 gchar *locale_filename = g_win32_locale_filename_from_utf8 (filename); if (locale_filename != NULL) doc = xmlParseFile (locale_filename); g_free (locale_filename); #else doc = xmlParseFile (filename); #endif } if (!doc) { g_free (filename); return; } root = xmlDocGetRootElement(doc); for (child = root->xmlChildrenNode; child; child = child->next) { gchar *id; gboolean found = FALSE; int i; if (!strcmp ((char *)child->name, "text")) continue; id = e_xml_get_string_prop_by_name(child, (const unsigned char *)"id"); for (i = 0; i < collection->view_count; i++) { if (!strcmp(id, collection->view_data[i]->id)) { if (!local) collection->view_data[i]->built_in = TRUE; found = TRUE; break; } } if (!found) { for (i = 0; i < collection->removed_view_count; i++) { if (!strcmp(id, collection->removed_view_data[i]->id)) { if (!local) collection->removed_view_data[i]->built_in = TRUE; found = TRUE; break; } } } if (!found) { GalViewCollectionItem *item = load_single_file (collection, dir, local, child); if (item->filename && *item->filename) { collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1); collection->view_data[collection->view_count] = item; collection->view_count ++; } else {
gint camel_init (const gchar *configdir, gboolean nss_init) { CamelCertDB *certdb; gchar *path; if (initialised) return 0; bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); camel_debug_init (); if (nss_init) { static gchar v2_enabled = -1, weak_ciphers = -1; gchar *nss_configdir = NULL; gchar *nss_sql_configdir = NULL; SECStatus status = SECFailure; #if NSS_VMAJOR < 3 || (NSS_VMAJOR == 3 && NSS_VMINOR < 14) /* NSS pre-3.14 has most of the ciphers disabled, thus enable * weak ciphers, if it's compiled against such */ weak_ciphers = 1; #endif /* check camel-tcp-stream-ssl.c for the same "CAMEL_SSL_V2_ENABLE" */ if (v2_enabled == -1) v2_enabled = g_strcmp0 (g_getenv ("CAMEL_SSL_V2_ENABLE"), "1") == 0 ? 1 : 0; if (weak_ciphers == -1) weak_ciphers = g_strcmp0 (g_getenv ("CAMEL_SSL_WEAK_CIPHERS"), "1") == 0 ? 1 : 0; if (nss_initlock == NULL) { PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10); nss_initlock = PR_NewLock (); } PR_Lock (nss_initlock); if (NSS_IsInitialized ()) goto skip_nss_init; #ifndef G_OS_WIN32 nss_configdir = g_strdup (configdir); #else nss_configdir = g_win32_locale_filename_from_utf8 (configdir); #endif if (nss_has_system_db ()) { nss_sql_configdir = g_strdup ("sql:" NSS_SYSTEM_DB ); } else { /* On Windows, we use the Evolution configdir. On other * operating systems we use ~/.pki/nssdb/, which is where * the user-specific part of the "shared system db" is * stored and is what Chrome uses too. * * We have to create the configdir if it does not exist, * to prevent camel from bailing out on first run. */ #ifdef G_OS_WIN32 g_mkdir_with_parents (configdir, 0700); nss_sql_configdir = g_strconcat ( "sql:", nss_configdir, NULL); #else gchar *user_nss_dir = g_build_filename ( g_get_home_dir (), ".pki/nssdb", NULL ); if (g_mkdir_with_parents (user_nss_dir, 0700)) g_warning ( "Failed to create SQL " "database directory %s: %s\n", user_nss_dir, strerror (errno)); nss_sql_configdir = g_strconcat ( "sql:", user_nss_dir, NULL); g_free (user_nss_dir); #endif } #if NSS_VMAJOR > 3 || (NSS_VMAJOR == 3 && NSS_VMINOR >= 12) /* See: https://wiki.mozilla.org/NSS_Shared_DB, * particularly "Mode 3A". Note that the target * directory MUST EXIST. */ status = NSS_InitWithMerge ( nss_sql_configdir, /* dest dir */ "", "", /* new DB name prefixes */ SECMOD_DB, /* secmod name */ nss_configdir, /* old DB dir */ "", "", /* old DB name prefixes */ nss_configdir, /* unique ID for old DB */ "Evolution S/MIME", /* UI name for old DB */ 0); /* flags */ if (status == SECFailure) { g_warning ( "Failed to initialize NSS SQL database in %s: NSS error %d", nss_sql_configdir, PORT_GetError ()); /* Fall back to opening the old DBM database */ } #endif /* Support old versions of libnss, pre-sqlite support. */ if (status == SECFailure) status = NSS_InitReadWrite (nss_configdir); if (status == SECFailure) { /* Fall back to using volatile dbs? */ status = NSS_NoDB_Init (nss_configdir); if (status == SECFailure) { g_free (nss_configdir); g_free (nss_sql_configdir); g_warning ("Failed to initialize NSS"); PR_Unlock (nss_initlock); return -1; } } nss_initialized = TRUE; skip_nss_init: NSS_SetDomesticPolicy (); if (weak_ciphers) { PRUint16 indx; /* enable SSL3/TLS cipher-suites */ for (indx = 0; indx < SSL_NumImplementedCiphers; indx++) { if (!SSL_IS_SSL2_CIPHER (SSL_ImplementedCiphers[indx]) && SSL_ImplementedCiphers[indx] != SSL_RSA_WITH_NULL_SHA && SSL_ImplementedCiphers[indx] != SSL_RSA_WITH_NULL_MD5) SSL_CipherPrefSetDefault (SSL_ImplementedCiphers[indx], PR_TRUE); } } SSL_OptionSetDefault (SSL_ENABLE_SSL2, v2_enabled ? PR_TRUE : PR_FALSE); SSL_OptionSetDefault (SSL_V2_COMPATIBLE_HELLO, PR_FALSE); SSL_OptionSetDefault (SSL_ENABLE_SSL3, PR_TRUE); SSL_OptionSetDefault (SSL_ENABLE_TLS, PR_TRUE); PR_Unlock (nss_initlock); g_free (nss_configdir); g_free (nss_sql_configdir); } path = g_strdup_printf ("%s/camel-cert.db", configdir); certdb = camel_certdb_new (); camel_certdb_set_filename (certdb, path); g_free (path); /* if we fail to load, who cares? it'll just be a volatile certdb */ camel_certdb_load (certdb); /* set this certdb as the default db */ camel_certdb_set_default (certdb); g_object_unref (certdb); initialised = TRUE; return 0; }
void gnc_file_ofx_import (void) { extern int ofx_PARSER_msg; extern int ofx_DEBUG_msg; extern int ofx_WARNING_msg; extern int ofx_ERROR_msg; extern int ofx_INFO_msg; extern int ofx_STATUS_msg; char *selected_filename; char *default_dir; LibofxContextPtr libofx_context = libofx_get_new_context(); ofx_PARSER_msg = false; ofx_DEBUG_msg = false; ofx_WARNING_msg = true; ofx_ERROR_msg = true; ofx_INFO_msg = true; ofx_STATUS_msg = false; DEBUG("gnc_file_ofx_import(): Begin...\n"); default_dir = gnc_get_default_directory(GNC_PREFS_GROUP); selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"), NULL, default_dir, GNC_FILE_DIALOG_IMPORT); g_free(default_dir); if (selected_filename != NULL) { #ifdef G_OS_WIN32 gchar *conv_name; #endif /* Remember the directory as the default. */ default_dir = g_path_get_dirname(selected_filename); gnc_set_default_directory(GNC_PREFS_GROUP, default_dir); g_free(default_dir); /*strncpy(file,selected_filename, 255);*/ DEBUG("Filename found: %s", selected_filename); /* Create the Generic transaction importer GUI. */ gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42); /* Look up the needed preferences */ auto_create_commodity = gnc_prefs_get_bool (GNC_PREFS_GROUP_IMPORT, GNC_PREF_AUTO_COMMODITY); /* Initialize libofx */ /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/ ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0); ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0); ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0); /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/ #ifdef G_OS_WIN32 conv_name = g_win32_locale_filename_from_utf8(selected_filename); g_free(selected_filename); selected_filename = conv_name; #endif DEBUG("Opening selected file"); libofx_proc_file(libofx_context, selected_filename, AUTODETECT); g_free(selected_filename); } if (ofx_created_commodites) { /* FIXME: Present some result window about the newly created * commodities */ g_warning("Created %d new commodities during import", g_list_length(ofx_created_commodites)); g_list_free(ofx_created_commodites); ofx_created_commodites = NULL; } else { //g_warning("No new commodities created"); } }