Exemplo n.º 1
0
FILE *Inkscape::IO::fopen_utf8name( char const *utf8name, char const *mode )
{
    static gint counter = 0;
    FILE* fp = NULL;

    DEBUG_MESSAGE( dumpOne, "entering fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

#ifndef WIN32
    DEBUG_MESSAGE( dumpOne, "           STEP 0              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
    gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL );
    if ( filename )
    {
        DEBUG_MESSAGE( dumpOne, "           STEP 1              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        fp = std::fopen(filename, mode);
        DEBUG_MESSAGE( dumpOne, "           STEP 2              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        g_free(filename);
        DEBUG_MESSAGE( dumpOne, "           STEP 3              ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );
        filename = 0;
    }
#else
    Glib::ustring how( mode );
    how.append("b");
    DEBUG_MESSAGE( dumpOne, "   calling is_os_wide()       ( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

    fp = g_fopen(utf8name, how.c_str());
#endif

    DEBUG_MESSAGE( dumpOne, "leaving fopen_utf8name( '%s', '%s' )[%d]", utf8name, mode, (counter++) );

    return fp;
}
Exemplo n.º 2
0
/**Checks if directory of file exists, useful
 * because inkscape doesn't create directories.*/
bool Inkscape::IO::file_directory_exists( char const *utf8name ){
    bool exists = true;

    if ( utf8name) {
        gchar *filename = NULL;
        if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) {
            /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable.
               If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to
               use simple g_file_test.  Then add g_return_val_if_fail(g_utf_validate(...), false)
               to beginning of this function. */
            filename = g_strdup(utf8name);
            // Looks like g_get_home_dir isn't safe.
            //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!");
        } else {
            filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL );
        }
        if ( filename ) {
            gchar *dirname = g_path_get_dirname(filename);
            exists = Inkscape::IO::file_test( dirname, G_FILE_TEST_EXISTS);
            g_free(filename);
            g_free(dirname);
            filename = NULL;
            dirname = NULL;
        } else {
            g_warning( "Unable to convert filename in IO:file_test" );
        }
    }

    return exists;

}
Exemplo n.º 3
0
int Inkscape::IO::mkdir_utf8name( char const *utf8name )
{
    static gint counter = 0;
    int retval = -1;

    DEBUG_MESSAGE( dumpMk, "entering mkdir_utf8name( '%s' )[%d]", utf8name, (counter++) );

#ifndef WIN32
    DEBUG_MESSAGE( dumpMk, "           STEP 0              ( '%s' )[%d]", utf8name, (counter++) );
    gchar *filename = g_filename_from_utf8( utf8name, -1, NULL, NULL, NULL );
    if ( filename )
    {
        DEBUG_MESSAGE( dumpMk, "           STEP 1              ( '%s' )[%d]", utf8name, (counter++) );
        retval = ::mkdir(filename, S_IRWXU | S_IRGRP | S_IXGRP);
        DEBUG_MESSAGE( dumpMk, "           STEP 2              ( '%s' )[%d]", utf8name, (counter++) );
        g_free(filename);
        DEBUG_MESSAGE( dumpMk, "           STEP 3              ( '%s' )[%d]", utf8name, (counter++) );
        filename = 0;
    }
#else
    DEBUG_MESSAGE( dumpMk, "   calling is_os_wide()       ( '%s' )[%d]", utf8name, (counter++) );

    // Mode should be ingnored inside of glib on the way in
    retval = g_mkdir( utf8name, 0 );
#endif

    DEBUG_MESSAGE( dumpMk, "leaving mkdir_utf8name( '%s' )[%d]", utf8name, (counter++) );

    return retval;
}
Exemplo n.º 4
0
bool Inkscape::IO::file_is_writable( char const *utf8name)
{
    bool success = true;

    if ( utf8name) {
        gchar *filename = NULL;
        if (utf8name && !g_utf8_validate(utf8name, -1, NULL)) {
            /* FIXME: Trying to guess whether or not a filename is already in utf8 is unreliable.
               If any callers pass non-utf8 data (e.g. using g_get_home_dir), then change caller to
               use simple g_file_test.  Then add g_return_val_if_fail(g_utf_validate(...), false)
               to beginning of this function. */
            filename = g_strdup(utf8name);
            // Looks like g_get_home_dir isn't safe.
            //g_warning("invalid UTF-8 detected internally. HUNT IT DOWN AND KILL IT!!!");
        } else {
            filename = g_filename_from_utf8 ( utf8name, -1, NULL, NULL, NULL );
        }
        if ( filename ) {
            struct stat st;
            if (g_file_test (filename, G_FILE_TEST_EXISTS)){ 
                if (g_lstat (filename, &st) == 0) {
                    success = ((st.st_mode & S_IWRITE) != 0);
                }
            }
            g_free(filename);
            filename = NULL;
        } else {
            g_warning( "Unable to convert filename in IO:file_test" );
        }
    }

    return success;
}
Exemplo n.º 5
0
Arquivo: main.c Projeto: hsgg/quark
static void
config_load (GConfClient *gconf)
{
    GSList *paths, *it;

    main_set_loop_at_end (gconf_client_get_bool (gconf, LOOP_PLAYLIST, NULL));
    main_set_random_order (gconf_client_get_bool (gconf, RANDOM_ORDER, NULL));

    paths = gconf_client_get_list (gconf, PLAYLIST, GCONF_VALUE_STRING, NULL);
    for (it = paths; it; it = g_slist_next (it)) {
        GError *e = NULL;
        gchar *p = g_filename_from_utf8 (it->data, -1, NULL, NULL, &e);
        if (p) { playlist_append_single (p); g_free(p); }
        if (e) {
            g_warning ("Error loading playlist: %s", e->message);
            g_error_free(e);
        }
        g_free(it->data);
    }
    g_slist_free(paths);

    /* don't need another copy of the playlist in memory, and
       gconf_client_clear_cache makes a nice segfault when I try save stuff
       later. This value can't be edited while quark is running anyways.
    */
    gconf_client_unset (gconf, PLAYLIST, NULL);

    playlist_seek (gconf_client_get_int (gconf, PLAYLIST_POSITION, NULL));
}
Exemplo n.º 6
0
static void
gimp_file_entry_check_filename (GimpFileEntry *entry)
{
  gchar    *utf8;
  gchar    *filename;
  gboolean  exists;

  if (! entry->check_valid || ! entry->file_exists)
    return;

  utf8 = gtk_editable_get_chars (GTK_EDITABLE (entry->entry), 0, -1);
  filename = g_filename_from_utf8 (utf8, -1, NULL, NULL, NULL);
  g_free (utf8);

  if (entry->dir_only)
    exists = g_file_test (filename, G_FILE_TEST_IS_DIR);
  else
    exists = g_file_test (filename, G_FILE_TEST_IS_REGULAR);

  g_free (filename);

  gtk_image_set_from_icon_name (GTK_IMAGE (entry->file_exists),
                                exists ? "gtk-yes" : "gtk-no",
                                GTK_ICON_SIZE_BUTTON);
}
Exemplo n.º 7
0
gboolean
gjs_string_to_filename(JSContext    *context,
                       const jsval   filename_val,
                       char        **filename_string_p)
{
    GError *error;
    gchar *tmp, *filename_string;

    /* gjs_string_to_filename verifies that filename_val is a string */

    if (!gjs_string_to_utf8(context, filename_val, &tmp)) {
        /* exception already set */
        return JS_FALSE;
    }

    error = NULL;
    filename_string = g_filename_from_utf8(tmp, -1, NULL, NULL, &error);
    if (!filename_string) {
        gjs_throw_g_error(context, error);
        g_free(tmp);
        return FALSE;
    }

    *filename_string_p = filename_string;
    g_free(tmp);
    return TRUE;
}
Exemplo n.º 8
0
/** Return the value of a filename-type data node.
 * @param data The data node to read from.
 * @return The filename value found in the node.  If the node is not a
 *  filename node, an error message is displayed and NULL is returned.
 *  The resulting string is in the local filesystem's encoding rather than
 *  UTF-8, and should be freed after use.
 * @bug data_string() can return NULL, what does g_filename_from_utf8 do then?
 */
char *
data_filename(DataNode data)
{
  char *utf8 = data_string(data);
  char *filename = g_filename_from_utf8(utf8, -1, NULL, NULL, NULL);
  g_free(utf8);
  return filename;
}
Exemplo n.º 9
0
/**
 * \brief utf8 version of fopen (see fopen for more detail about mode)
 * 
 * convert utf8 file path into the locale OS charset before calling fopen
 *
 * \param utf8filename file to open path coded using utf8 charset
 * \param mode fopen mode argument
 *
 * \return file descriptor returned by fopen
 */
G_MODULE_EXPORT FILE* utf8_fopen (const gchar *utf8filename, gchar *mode )
{
#ifdef _MSC_VER
    return fopen ( g_locale_from_utf8 ( utf8filename, -1, NULL, NULL, NULL ), mode );
#else
	return fopen ( g_filename_from_utf8 ( utf8filename, -1, NULL, NULL, NULL ), mode );
#endif
}
Exemplo n.º 10
0
/**
 * \brief utf8 version of remove (see remove for more detail about mode)
 * 
 * convert utf8 file path into the locale OS charset before calling remove
 *
 * \param utf8filename file to remove path coded using utf8 charset
 *
 * \return remove returned value
 */
gint utf8_remove ( const gchar *utf8filename )
{
#ifdef _MSC_VER
    return remove ( g_locale_from_utf8 ( utf8filename, -1, NULL, NULL, NULL ) );
#else
    return remove ( g_filename_from_utf8 ( utf8filename,-1,NULL,NULL,NULL ) );
#endif
}
Exemplo n.º 11
0
/**
 * Returns the path to the key store file.
 */
gchar *get_config_filename(void) {
    char *filename_fs, *filename_utf8;

    filename_utf8 = g_build_filename(hexchat_get_info(ph, "configdir"), "addon_fishlim.conf", NULL);
    filename_fs = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL, NULL);

    g_free (filename_utf8);
    return filename_fs;
}
Exemplo n.º 12
0
static void fs_fsFNameList_select_row( GtkWidget * widget, gint row, gint column,
                                       GdkEventButton *bevent, gpointer user_data)
{
 gtk_clist_get_text( GTK_CLIST(widget ),row,1,&fsSelectedFile );
 g_free( fsSelectedFileUtf8 );
 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
 if( bevent && bevent->type == GDK_BUTTON_PRESS )  gtk_button_released( GTK_BUTTON( fsOk ) );
}
Exemplo n.º 13
0
// Open Dlg for file selection
bool
showSelectFileBox(const std::string &title,
                  std::string &selectedFile,
                  const bool &fileOptions/*=true*/)
{
  // Create the selector
  GtkWidget *file_selector = gtk_file_selection_new(title.c_str());

  // Set current filename
  if (selectedFile!="")
  {
    // Converts a filename from UTF-8 to on-disk encoding, and sets it in the
    // GtkFileSelection.
    gchar *on_disk_filename;

    on_disk_filename = g_filename_from_utf8(selectedFile.c_str(), -1, NULL, NULL,
              NULL);

    gtk_file_selection_set_filename (GTK_FILE_SELECTION (file_selector),
            on_disk_filename);
    g_free(on_disk_filename);
  }

  if (fileOptions)
    gtk_file_selection_show_fileop_buttons(GTK_FILE_SELECTION(file_selector));
  else
    gtk_file_selection_hide_fileop_buttons(GTK_FILE_SELECTION(file_selector));

  // Display that dialog
  gtk_widget_show (file_selector);

  gint result=runModalBox(file_selector);

  if (result==GTK_RESPONSE_OK)
  {
  // Retrieve selected file
    const gchar *on_disk_filename;
    gchar *filename;

    on_disk_filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (file_selector));
    filename = g_filename_to_utf8 (on_disk_filename, -1, NULL, NULL, NULL);

    if (filename)
    {
      selectedFile=filename;
      g_free(filename);
    }

    gtk_widget_destroy(file_selector);
    return true;
  }
  else
  {
    gtk_widget_destroy(file_selector);
    return false;
  }
}
Exemplo n.º 14
0
static void fs_fsFNameList_select_row( GtkCList * clist, gint row, gint column,
                                       GdkEvent * event, gpointer user_data)
{
 fsCurrFNameListSelected = row;
 gtk_clist_get_text( clist,row,1,&fsSelectedFile );
 g_free( fsSelectedFileUtf8 );
 fsSelectedFileUtf8 = g_filename_from_utf8( fsSelectedFile, -1, NULL, NULL, NULL );
 if ( fsSelectedFileUtf8 ) fsSelectedFile = fsSelectedFileUtf8;
 if( event && event->type == GDK_BUTTON_PRESS )  gtk_button_released( GTK_BUTTON( fsOk ) );
}
Exemplo n.º 15
0
Arquivo: main.c Projeto: jcape/gnoMint
void __recent_add_utf8_filename (const gchar *utf8_filename)
{
        GtkRecentData *recent_data;
        gchar         *filename;
        gchar         *uri;
	gchar         *pwd;

        static gchar *groups[2] = {
                "gnomint",
                NULL
        };


        recent_data = g_slice_new (GtkRecentData);

        recent_data->display_name = NULL;
        recent_data->description  = NULL;
        recent_data->mime_type    = GNOMINT_MIME_TYPE;
        recent_data->app_name     = (gchar *) g_get_application_name ();
        recent_data->app_exec     = g_strjoin (" ", g_get_prgname (), "%f", NULL);
        recent_data->groups       = groups;
        recent_data->is_private = FALSE;

        filename = g_filename_from_utf8 (utf8_filename, -1, NULL, NULL, NULL);
        if ( filename != NULL )
        {

		if (! g_path_is_absolute (filename)) {
			gchar *absolute_filename;

			pwd = g_get_current_dir ();
			absolute_filename = g_build_filename (pwd, filename, NULL);
			g_free (pwd);
			g_free (filename);
			filename = absolute_filename;
		}


                uri = g_filename_to_uri (filename, NULL, NULL);
                if ( uri != NULL )
                {

                        gtk_recent_manager_add_full (recent_manager, uri, recent_data);
                        g_free (uri);

                }
                g_free (filename);

        }

        g_free (recent_data->app_exec);
        g_slice_free (GtkRecentData, recent_data);

}
static char *
get_first_volume_name (const char           *name,
		       const char           *pattern,
		       FirstVolumeExtension  extension_type)
{
	char   *volume_name = NULL;
	GRegex *re;

	re = g_regex_new (pattern, G_REGEX_CASELESS, 0, NULL);
	if (g_regex_match (re, name, 0, NULL)) {
		char **parts;
		int    l, i;

		parts = g_regex_split (re, name, 0);
		l = strlen (parts[2]);
		switch (extension_type) {
		case FIRST_VOLUME_IS_000:
			for (i = 0; i < l; i++)
				parts[2][i] = '0';
			break;

		case FIRST_VOLUME_IS_001:
			for (i = 0; i < l; i++)
				parts[2][i] = (i < l - 1) ? '0' : '1';
			break;

		case FIRST_VOLUME_IS_RAR:
			if (g_str_has_suffix (parts[1], "r")) {
				parts[2][0] = 'a';
				parts[2][1] = 'r';
			}
			else {
				parts[2][0] = 'A';
				parts[2][1] = 'R';
			}
			break;
		}

		volume_name = g_strjoinv ("", parts);

		g_strfreev (parts);
	}
	g_regex_unref (re);

	if (volume_name != NULL) {
		char *tmp;

		tmp = volume_name;
		volume_name = g_filename_from_utf8 (tmp, -1, NULL, NULL, NULL);
		g_free (tmp);
	}

	return volume_name;
}
Exemplo n.º 17
0
char *
ve_filename_from_utf8 (const char *str)
{
	char *ret = g_filename_from_utf8 (str, -1, NULL, NULL, NULL);
	if (ret == NULL) {
		g_warning ("string not in proper utf8 encoding: \"%s\"", str);
		return g_strdup (str);
	} else {
		return ret;
	}
}
Exemplo n.º 18
0
static void fs_fsPathCombo_changed( GtkEditable * editable,
                                    gpointer user_data )
{
 const unsigned char * str;
 gchar * dirname;

 str=gtk_entry_get_text( GTK_ENTRY( user_data ) );
 dirname = g_filename_from_utf8( str, -1, NULL, NULL, NULL );
 if ( chdir( dirname ? (const unsigned char *)dirname : str ) != -1 ) CheckDir( fsFNameList );
 g_free( dirname );
}
Exemplo n.º 19
0
static gchar *mh_filename_from_utf8(const gchar *path)
{
	gchar *real_path = g_filename_from_utf8(path, -1, NULL, NULL, NULL);

	if (!real_path) {
		g_warning("mh_filename_from_utf8: failed to convert character set\n");
		real_path = g_strdup(path);
	}

	return real_path;
}
Exemplo n.º 20
0
int   ug_file_is_exist (const char* filename)
{
	gchar *name;
	int    result;

	name = g_filename_from_utf8 (filename, -1, NULL, NULL, NULL);
	result = access (name, F_OK);
	g_free (name);
	if (result == -1)
		return FALSE;
	return TRUE;
}
Exemplo n.º 21
0
/** Wrapper around g_dir_open, but taking a utf8name as first argument. */
GDir *
Inkscape::IO::dir_open(gchar const *const utf8name, guint const flags, GError **const error)
{
    gchar *const opsys_name = g_filename_from_utf8(utf8name, -1, NULL, NULL, error);
    if (opsys_name) {
        GDir *ret = g_dir_open(opsys_name, flags, error);
        g_free(opsys_name);
        return ret;
    } else {
        return NULL;
    }
}
Exemplo n.º 22
0
/* Converts a filename from UTF-8 to on-disk encoding, and sets it in a
   GtkFileSelection. */
void
util_set_file_selection_filename (GtkWidget *filesel,
					const gchar *filename_utf8)
{
  gchar *on_disk_filename;

  on_disk_filename = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL,
					   NULL);
  gtk_file_selection_set_filename (GTK_FILE_SELECTION (filesel),
				   on_disk_filename);
  g_free (on_disk_filename);
}
Exemplo n.º 23
0
static gchar *
read_string (const uint8_t *ptr, const uint8_t **endp)
{
    gchar *s;
    int len = read_leb128 (ptr, &ptr);

    s = g_filename_from_utf8 ((const char *) ptr, len, NULL, NULL, NULL);
    ptr += len;
    if (endp)
        *endp = ptr;
    return s;
}
Exemplo n.º 24
0
Arquivo: lua.c Projeto: Cynede/hexchat
static script_info *create_script(char const *file)
{
	int base;
	char *filename_fs;
	lua_State *L;
	script_info *info = g_new0(script_info, 1);
	info->hooks = g_ptr_array_new_with_free_func((GDestroyNotify)free_hook);
	info->unload_hooks = g_ptr_array_new_with_free_func((GDestroyNotify)free_hook);
	info->filename = g_strdup(expand_path(file));
	L = luaL_newstate();
	info->state = L;
	if(!L)
	{
		hexchat_print(ph, "\00304Could not allocate memory for the script");
		destroy_script(info);
		return NULL;
	}
	prepare_state(L, info);
	lua_rawgeti(L, LUA_REGISTRYINDEX, info->traceback);
	base = lua_gettop(L);
	filename_fs = g_filename_from_utf8(info->filename, -1, NULL, NULL, NULL);
	if(!filename_fs)
	{
		hexchat_printf(ph, "Invalid filename: %s", info->filename);
		destroy_script(info);
		return NULL;
	}
	if(luaL_loadfile(L, filename_fs))
	{
		g_free(filename_fs);
		hexchat_printf(ph, "Lua syntax error: %s", luaL_optstring(L, -1, ""));
		destroy_script(info);
		return NULL;
	}
	g_free(filename_fs);
	info->status |= STATUS_ACTIVE;
	if(lua_pcall(L, 0, 0, base))
	{
		char const *error = lua_tostring(L, -1);
		hexchat_printf(ph, "Lua error: %s", error ? error : "(non-string error)");
		destroy_script(info);
		return NULL;
	}
	lua_pop(L, 1);
	if(!info->name)
	{
		hexchat_printf(ph, "Lua script didn't register with hexchat.register");
		destroy_script(info);
		return NULL;
	}
	return info;
}
Exemplo n.º 25
0
int   ug_file_is_dir (const char* dir)
{
	struct stat s;
	gchar *cp_dir;
	int    result;

	cp_dir = g_filename_from_utf8 (dir, -1, NULL, NULL, NULL);
	result = stat (cp_dir, &s) == 0;
	g_free (cp_dir);
	if (result == 0)
		return S_ISDIR (s.st_mode);
	return FALSE;
}
Exemplo n.º 26
0
static char *
escape(char *str)
{
    gchar *res = NULL;
    gchar *s;

    s = g_strdup(str);
    g_strdelimit(s, "/", '-'); /* remove slashes */
    res = g_filename_from_utf8(s, -1, NULL, NULL, NULL);
    g_free(s);

    return res ? res : g_strdup(str);
}
Exemplo n.º 27
0
/** \brief A function to open the error log file. */
void
Extension::error_file_open (void)
{
    gchar * ext_error_file = profile_path(EXTENSION_ERROR_LOG_FILENAME);
    gchar * filename = g_filename_from_utf8( ext_error_file, -1, NULL, NULL, NULL );
    error_file.open(filename);
    if (!error_file.is_open()) {
        g_warning(_("Could not create extension error log file '%s'"),
                  filename);
    }
    g_free(filename);
    g_free(ext_error_file);
};
Exemplo n.º 28
0
char *
_gtk_label_get_filename_text (GtkLabel   *label)
{
	const char *utf8_text;
	char       *text;

	utf8_text = gtk_label_get_text (label);
	if (utf8_text == NULL)
		return NULL;

	text = g_filename_from_utf8 (utf8_text, -1, NULL, NULL, NULL);

	return text;
}
Exemplo n.º 29
0
char *
_gtk_entry_get_filename_text (GtkEntry   *entry)
{
	const char *utf8_text;
	char       *text;

	utf8_text = gtk_entry_get_text (entry);
	if (utf8_text == NULL)
		return NULL;

	text = g_filename_from_utf8 (utf8_text, -1, NULL, NULL, NULL);

	return text;
}
Exemplo n.º 30
0
static void import_ok_cb(GtkWidget *widget, gpointer data)
{
	const gchar *utf8mbox, *destdir;
	FolderItem *dest;
	gchar *mbox;

	utf8mbox = gtk_entry_get_text(GTK_ENTRY(file_entry));
	destdir = gtk_entry_get_text(GTK_ENTRY(dest_entry));

	if (utf8mbox && !*utf8mbox) {
		alertpanel_error(_("Source mbox filename can't be left empty."));
		gtk_widget_grab_focus(file_entry);
		return;
	}
	if (destdir && !*destdir) {
		if (alertpanel(_("Import mbox file"), _("Destination folder is not set.\nImport mbox file to the Inbox folder?"),
						GTK_STOCK_OK, GTK_STOCK_CANCEL, NULL, ALERTFOCUS_FIRST)
			== G_ALERTALTERNATE) {
			gtk_widget_grab_focus(dest_entry);
			return;
		}
	}

	mbox = g_filename_from_utf8(utf8mbox, -1, NULL, NULL, NULL);
	if (!mbox) {
		g_warning("import_ok_cb(): failed to convert character set.");
		mbox = g_strdup(utf8mbox);
	}

	if (!destdir || !*destdir) {
		dest = folder_find_item_from_path(INBOX_DIR);
	} else {
		dest = folder_find_item_from_identifier
			(destdir);
	}

	if (!dest) {
		alertpanel_error(_("Can't find the destination folder."));
		gtk_widget_grab_focus(dest_entry);
		g_free(mbox);
		return;
	} else {
		import_ok = proc_mbox(dest, mbox, FALSE, NULL);
	}

	g_free(mbox);

	if (gtk_main_level() > 1)
		gtk_main_quit();
}