/*!
* Run dialog.
*/
void 
AP_UnixDialog_Spell::runModal (XAP_Frame * pFrame)
{   
    // class the base class method to initialize some basic xp stuff
    AP_Dialog_Spell::runModal(pFrame);
   
    bool bRes = nextMisspelledWord();
   
    if (bRes) { // we need to prepare the dialog
        GtkWidget * mainWindow = _constructWindow();
        UT_ASSERT(mainWindow);

        // Populate the window's data items
        _populateWindowData();
      
        abiSetupModalDialog(GTK_DIALOG(mainWindow), pFrame, this, GTK_RESPONSE_CLOSE);

        // now loop while there are still misspelled words
        while (bRes) {
     
            // show word in main window
            makeWordVisible();
     
			gpointer inst = gtk_tree_view_get_selection (GTK_TREE_VIEW (m_lvSuggestions));
			g_signal_handler_block (inst, m_listHandlerID);
            // update dialog with new misspelled word info/suggestions
            _updateWindow();
			g_signal_handler_unblock (inst, m_listHandlerID);

			// run into the GTK event loop for this window
	    gint response = abiRunModalDialog (GTK_DIALOG(mainWindow), false);
	    UT_DEBUGMSG (("ROB: response='%d'\n", response));
            switch(response) {

	            case SPELL_RESPONSE_CHANGE:
	                onChangeClicked (); break;
	            case SPELL_RESPONSE_CHANGE_ALL:
	                onChangeAllClicked (); break;
	            case SPELL_RESPONSE_IGNORE:
	                onIgnoreClicked (); break;
	            case SPELL_RESPONSE_IGNORE_ALL:
	                onIgnoreAllClicked (); break;
	            case SPELL_RESPONSE_ADD:
	                onAddClicked (); break;
	            default:
					m_bCancelled = TRUE;
		            _purgeSuggestions();
					gtk_widget_destroy (m_wDialog);
					return;
            }

            _purgeSuggestions();
          
            // get the next unknown word
            bRes = nextMisspelledWord();
        }
      
        abiDestroyWidget(mainWindow);
    }
}
void AP_UnixDialog_Styles::runModal(XAP_Frame * pFrame)
{

//
// Get View and Document pointers. Place them in member variables
//

	setFrame(pFrame);
	setView(static_cast<FV_View *>(pFrame->getCurrentView()));
	UT_ASSERT(getView());

	setDoc(getView()->getLayout()->getDocument());

	UT_ASSERT(getDoc());

	// Build the window's widgets and arrange them
	m_windowMain = _constructWindow();
	UT_ASSERT(m_windowMain);

	abiSetupModalDialog(GTK_DIALOG(m_windowMain), pFrame, this, GTK_RESPONSE_CLOSE);

	// *** this is how we add the gc for the para and char Preview's ***
	// attach a new graphics context to the drawing area

	UT_ASSERT(m_wParaPreviewArea && gtk_widget_get_window(m_wParaPreviewArea));

	// make a new Unix GC
	DELETEP (m_pParaPreviewWidget);
	{
		GR_UnixCairoAllocInfo ai(m_wParaPreviewArea);
		m_pParaPreviewWidget =
		    (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai);
	}

	// let the widget materialize

	GtkAllocation allocation;
	gtk_widget_get_allocation(m_wParaPreviewArea, &allocation);
	_createParaPreviewFromGC(m_pParaPreviewWidget,
				 static_cast<UT_uint32>(allocation.width), 
				 static_cast<UT_uint32>(allocation.height));
	
	
	UT_ASSERT(m_wCharPreviewArea && gtk_widget_get_window(m_wCharPreviewArea));

	// make a new Unix GC
	DELETEP (m_pCharPreviewWidget);
	{
		GR_UnixCairoAllocInfo ai(m_wCharPreviewArea);
		m_pCharPreviewWidget =
		    (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai);
	}

	// let the widget materialize

	gtk_widget_get_allocation(m_wCharPreviewArea, &allocation);
	_createCharPreviewFromGC(m_pCharPreviewWidget,
				 static_cast<UT_uint32>(allocation.width), 
				 static_cast<UT_uint32>(allocation.height));

	// Populate the window's data items
	_populateWindowData();

	// the expose event of the preview
	g_signal_connect(G_OBJECT(m_wParaPreviewArea),
#if GTK_CHECK_VERSION(3,0,0)
			 "draw",
#else
			 "expose_event",
#endif
			 G_CALLBACK(s_paraPreview_draw),
			 reinterpret_cast<gpointer>(this));

	g_signal_connect(G_OBJECT(m_wCharPreviewArea),
#if GTK_CHECK_VERSION(3,0,0)
			 "draw",
#else
			 "expose_event",
#endif
			 G_CALLBACK(s_charPreview_draw),
			 reinterpret_cast<gpointer>(this));
	
	// connect the select_row signal to the clist
	g_signal_connect (G_OBJECT (gtk_tree_view_get_selection(GTK_TREE_VIEW(m_tvStyles))), "changed",
			  G_CALLBACK (s_tvStyles_selection_changed), reinterpret_cast<gpointer>(this));
	
	// main loop for the dialog
	gint response;
	while(true)
    {
		response = abiRunModalDialog(GTK_DIALOG(m_windowMain), false);
	    if (response == GTK_RESPONSE_APPLY)
			event_Apply();
	    else
		{
			event_Close();
			break; // exit the loop
		}
	}

	DELETEP (m_pParaPreviewWidget);
	DELETEP (m_pCharPreviewWidget);
	
	abiDestroyWidget(m_windowMain);
}
/*!
 * Runs the dialog \me as a modal dialog
 * 1) Connect focus to toplevel frame
 * 2) Centers dialog over toplevel window
 * 3) Connects F1 to help system
 * 4) Makes dialog modal
 * 5) Sets the default button to defaultResponse, sets ESC to close
 * 6) Returns value of gtk_dialog_run(me)
 * 7) If \destroyDialog is true, destroys the dialog, else you have to call abiDestroyWidget()
 */
gint abiRunModalDialog(GtkDialog * me, XAP_Frame *pFrame, XAP_Dialog * pDlg,
					   gint defaultResponse, bool destroyDialog, AtkRole role)
{
  abiSetupModalDialog(me, pFrame, pDlg, defaultResponse);
  return abiRunModalDialog(me, destroyDialog, role);
}
void  AP_UnixDialog_Styles::modifyRunModal(void)
{
//
// OK Construct the new dialog and make it modal.
//
//
// pointer to the widget is stored in m_wModifyDialog
//
// Center our new dialog in its parent and make it a transient

	_constructModifyDialog();

//
// populate the dialog with useful info
//
    if(!_populateModify())
	{
	  abiDestroyWidget(m_wModifyDialog);
		return;
	}

        abiSetupModalDialog(GTK_DIALOG(m_wModifyDialog), getFrame(), this, BUTTON_MODIFY_CANCEL);

	// make a new Unix GC

	DELETEP (m_pAbiPreviewWidget);
	GR_UnixCairoAllocInfo ai(gtk_widget_get_window(m_wModifyDrawingArea));
	m_pAbiPreviewWidget =
	    (GR_CairoGraphics*) XAP_App::getApp()->newGraphics(ai);
	
	// let the widget materialize

	GtkAllocation allocation;
	gtk_widget_get_allocation(m_wModifyDrawingArea, &allocation);
	_createAbiPreviewFromGC(m_pAbiPreviewWidget,
				static_cast<UT_uint32>(allocation.width),
				static_cast<UT_uint32>(allocation.height));
	
	_populateAbiPreview(isNew());

	bool inputValid;
	do 
	{
		switch(abiRunModalDialog(GTK_DIALOG(m_wModifyDialog), false))
		{
			case BUTTON_MODIFY_OK:
				inputValid = event_Modify_OK(); 
				break;
			default:
				event_Modify_Cancel(); 
				inputValid = true;
				break ;
		}		
	} while (!inputValid);
	
	if(m_wModifyDialog && GTK_IS_WIDGET(m_wModifyDialog)) 
	{
//
// Free the old glists
//
		m_gbasedOnStyles.clear();
		m_gfollowedByStyles.clear();
		m_gStyleType.clear();
	    gtk_widget_destroy(m_wModifyDialog);
	}
//
// Have to delete this now since the destructor is not run till later
//	
	destroyAbiPreview();
	DELETEP(m_pAbiPreviewWidget);
}
void XAP_UnixDialog_FileOpenSaveAs::runModal(XAP_Frame * pFrame)
{
    const XAP_StringSet * pSS = m_pApp->getStringSet();
    std::string szTitle;
    std::string szFileTypeLabel;

    switch (m_id)
    {
    case XAP_DIALOG_ID_INSERT_PICTURE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_IP_Title, szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileOpenTypeLabel, szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_FILE_OPEN:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_OpenTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileOpenTypeLabel,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_FILE_IMPORT:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_ImportTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileOpenTypeLabel,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_INSERTMATHML:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_InsertMath,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileInsertMath,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_INSERTOBJECT:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_InsertObject,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileInsertObject,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_INSERT_FILE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_InsertTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileOpenTypeLabel,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    case XAP_DIALOG_ID_FILE_SAVEAS:
    case XAP_DIALOG_ID_FILE_SAVE_IMAGE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_SaveAsTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileSaveTypeLabel,szFileTypeLabel);
        m_bSave = true;
        break;
    }
    case XAP_DIALOG_ID_FILE_EXPORT:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_ExportTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileSaveTypeLabel,szFileTypeLabel);
        m_bSave = true;
        break;
    }
    case XAP_DIALOG_ID_PRINTTOFILE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_PrintToFileTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FilePrintTypeLabel,szFileTypeLabel);
        m_bSave = true;
        break;
    }
    case XAP_DIALOG_ID_RECORDTOFILE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_RecordToFileTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_RecordToFileLabel,szFileTypeLabel);
        m_bSave = true;
        break;
    }
    case XAP_DIALOG_ID_REPLAYFROMFILE:
    {
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_ReplayFromFileTitle,szTitle);
        pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_ReplayFromFileLabel,szFileTypeLabel);
        m_bSave = false;
        break;
    }
    default:
        UT_ASSERT(UT_SHOULD_NOT_HAPPEN);
        m_bSave = false;
        break;
    }

    // NOTE: we use our string mechanism to localize the dialog's
    // NOTE: title and the error/confirmation message boxes.  we
    // NOTE: let GTK take care of the localization of the actual
    // NOTE: buttons and labels on the FileSelection dialog.

    // Get the GtkWindow of the parent frame
    XAP_UnixFrameImpl * pUnixFrameImpl = static_cast<XAP_UnixFrameImpl *>(pFrame->getFrameImpl());
    GtkWidget * parent = pUnixFrameImpl->getTopLevelWindow();

    if(parent && (GTK_WIDGET_TOPLEVEL(parent) != TRUE))
    {
        parent = gtk_widget_get_toplevel (parent);
    }

#if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON
    m_FC = GTK_FILE_CHOOSER( hildon_file_chooser_dialog_new(GTK_WINDOW(parent),
                             (!m_bSave ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE))
                           );
#else
    m_FC = GTK_FILE_CHOOSER( gtk_file_chooser_dialog_new (szTitle.c_str(),
                             GTK_WINDOW(parent),
                             (!m_bSave ? GTK_FILE_CHOOSER_ACTION_OPEN : GTK_FILE_CHOOSER_ACTION_SAVE),
                             GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                             (m_bSave ? GTK_STOCK_SAVE : GTK_STOCK_OPEN), GTK_RESPONSE_ACCEPT,
                             (gchar*)NULL)
                           );
#endif

    gtk_file_chooser_set_local_only(m_FC, FALSE);

    abiSetupModalDialog(GTK_DIALOG(m_FC), pFrame, this, GTK_RESPONSE_ACCEPT);
    GtkWidget * filetypes_pulldown = NULL;

    std::string s;

    /*
      Add a drop-down list of known types to facilitate a file-types selection.
      We store an indexer in the user data for each menu item in the popup, so
      we can read the type we need to return.
    */

    if (m_id == XAP_DIALOG_ID_INSERT_PICTURE)
    {
        GtkWidget * preview = createDrawingArea ();
        gtk_widget_show (preview);
        m_preview = preview;
        gtk_widget_set_size_request (preview, PREVIEW_WIDTH, PREVIEW_HEIGHT);

        // place the preview area inside a container to get a nice border
        GtkWidget * preview_hbox = gtk_hbox_new(FALSE, 0);
        gtk_container_set_border_width  (GTK_CONTAINER(preview_hbox), 4);
        gtk_box_pack_start(GTK_BOX(preview_hbox), preview, TRUE, TRUE, 0);

        // attach the preview area to the dialog
        gtk_file_chooser_set_preview_widget (m_FC, preview_hbox);
        gtk_file_chooser_set_preview_widget_active (m_FC, true);

        // connect some signals
        g_signal_connect (m_FC, "update_preview",
                          G_CALLBACK (file_selection_changed), static_cast<gpointer>(this));

        g_signal_connect (preview, "expose_event",
                          G_CALLBACK (s_preview_exposed), static_cast<gpointer>(this));
    }

#if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON
    filetypes_pulldown = gtk_combo_box_new();
    gtk_widget_show(filetypes_pulldown);
    GtkWidget * pulldown_hbox = filetypes_pulldown;
#else
    // hbox for our pulldown menu (GTK does its pulldown this way */
    GtkWidget * pulldown_hbox = gtk_hbox_new(FALSE, 15);
    gtk_widget_show(pulldown_hbox);

    // pulldown label
    GtkWidget * filetypes_label = gtk_label_new_with_mnemonic(convertMnemonics(szFileTypeLabel).c_str());
    gtk_label_set_justify(GTK_LABEL(filetypes_label), GTK_JUSTIFY_RIGHT);
    gtk_misc_set_alignment(GTK_MISC(filetypes_label), 1.0, 0.5);
    gtk_widget_show(filetypes_label);
    gtk_box_pack_start(GTK_BOX(pulldown_hbox), filetypes_label, TRUE, TRUE, 0);

    // pulldown menu
    filetypes_pulldown = gtk_combo_box_new();
    gtk_widget_show(filetypes_pulldown);
    gtk_box_pack_end(GTK_BOX(pulldown_hbox), filetypes_pulldown, TRUE, TRUE, 0);
    gtk_label_set_mnemonic_widget(GTK_LABEL(filetypes_label), filetypes_pulldown);
#endif
    //
    // add the filters to the dropdown list
    //
    GtkComboBox* combo = GTK_COMBO_BOX(filetypes_pulldown);
    XAP_makeGtkComboBoxText(combo, G_TYPE_INT);

    // Auto-detect is always an option, but a special one, so we use
    // a pre-defined constant for the type, and don't use the user-supplied
    // types yet.
    pSS->getValueUTF8(XAP_STRING_ID_DLG_FOSA_FileTypeAutoDetect,s);
    XAP_appendComboBoxTextAndInt(combo, s.c_str(), XAP_DIALOG_FILEOPENSAVEAS_FILE_TYPE_AUTO);

    UT_sint32 activeItemIndex = -1;

    // add list items
    {
        UT_ASSERT(g_strv_length((gchar **) m_szSuffixes) == g_strv_length((gchar **) m_szDescriptions));

        // measure one list, they should all be the same length
        UT_uint32 end = g_strv_length((gchar **) m_szDescriptions);

        for (UT_uint32 i = 0; i < end; i++)
        {
            // If this type is default, save its index (i) for later use
            if (m_nTypeList[i] == m_nDefaultFileType)
                activeItemIndex = i;

            XAP_appendComboBoxTextAndInt(combo, m_szDescriptions[i], m_nTypeList[i]);
//
// Attach a callback when it is activated to change the file suffix
//
//			g_signal_connect(G_OBJECT(thismenuitem), "activate",
//							 G_CALLBACK(s_filetypechanged),
//							 reinterpret_cast<gpointer>(this));
        }
    }

    m_wFileTypes_PullDown = filetypes_pulldown;
    // dialog; open dialog always does auto-detect
    // TODO: should this also apply to the open dialog?
    if (m_id == XAP_DIALOG_ID_FILE_SAVEAS || m_id == XAP_DIALOG_ID_FILE_SAVE_IMAGE)
    {
        gtk_combo_box_set_active(combo, activeItemIndex + 1);
    }
    else
    {
        gtk_combo_box_set_active(combo, 0);
    }

#if defined(EMBEDDED_TARGET) && EMBEDDED_TARGET == EMBEDDED_TARGET_HILDON
    hildon_file_chooser_dialog_add_extra ((HildonFileChooserDialog*)m_FC,
                                          pulldown_hbox);
#else
    gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER(m_FC), pulldown_hbox);
#endif

    // connect the signals for OK and CANCEL and the requisite clean-close signals
    g_signal_connect(G_OBJECT(m_FC),
                     "delete-event",
                     G_CALLBACK(s_delete_clicked),
                     this);

    g_signal_connect(G_OBJECT(m_FC),
                     "key_press_event",
                     G_CALLBACK(fsel_key_event), &m_answer);

    g_signal_connect (G_OBJECT (m_FC),
                      "response",
                      G_CALLBACK(dialog_response), &m_answer);

    g_signal_connect (G_OBJECT (m_FC),
                      "file-activated",
                      G_CALLBACK(s_file_activated), &m_answer);

    g_signal_connect(G_OBJECT(filetypes_pulldown), "changed",
                     G_CALLBACK(s_filetypechanged),
                     reinterpret_cast<gpointer>(this));

    // use the persistence info and/or the suggested filename
    // to properly seed the dialog.

    gchar * szPersistDirectory = NULL;	// we must g_free this

    if (!m_szInitialPathname || !*m_szInitialPathname)
    {
        // the caller did not supply initial pathname
        // (or supplied an empty one).  see if we have
        // some persistent info.

        UT_ASSERT(!m_bSuggestName);
        if (m_szPersistPathname)
        {
            // we have a pathname from a previous use,
            // extract the directory portion and start
            // the dialog there (but without a filename).

            szPersistDirectory = UT_go_dirname_from_uri(m_szPersistPathname, FALSE);
            gtk_file_chooser_set_current_folder_uri(m_FC, szPersistDirectory);
        }
        else
        {
            // no initial pathname given and we don't have
            // a pathname from a previous use, so just let
            // it come up in the current working directory.
        }
    }
    else
    {
        // we have an initial pathname (the name of the document
        // in the frame that we were invoked on).  if the caller
        // wanted us to suggest a filename, use the initial
        // pathname as is.  if not, use the directory portion of
        // it.

        if (m_bSuggestName)
        {
            xxx_UT_DEBUGMSG(("Iniitial filename is %s \n",m_szInitialPathname));
#if 0
            if (!g_path_is_absolute (m_szInitialPathname)) { // DAL: todo: is this correct?
                gchar *dir = g_get_current_dir ();
                gchar *file = m_szInitialPathname;
                gchar *filename = g_build_filename (dir, file, (gchar *)NULL);
                m_szInitialPathname = UT_go_filename_to_uri(filename);
                g_free(filename);
                g_free (dir);
                g_free (file);
            }
#endif
            if(m_id == XAP_DIALOG_ID_FILE_SAVEAS)
            {
                std::string szInitialSuffix = UT_pathSuffix(m_szInitialPathname);
                std::string szSaveTypeSuffix = IE_Exp::preferredSuffixForFileType(m_nDefaultFileType).utf8_str();
                if(!szInitialSuffix.empty() && !szSaveTypeSuffix.empty()
                        && (szSaveTypeSuffix != szInitialSuffix))
                {
                    std::string sFileName = m_szInitialPathname;
                    std::string::size_type i = sFileName.find_last_of('.');

                    if(i != std::string::npos)
                    {
                        // erase to the end()
                        sFileName.erase(i);
                        sFileName += szSaveTypeSuffix;
                        FREEP(m_szInitialPathname);
                        m_szInitialPathname = g_strdup(sFileName.c_str());
                    }
                }
            }
            if (UT_go_path_is_uri(m_szInitialPathname) || UT_go_path_is_path(m_szInitialPathname))
            {
                gtk_file_chooser_set_uri(m_FC, m_szInitialPathname);
            }
        }
        else
        {
            if (UT_go_path_is_uri(m_szInitialPathname) || UT_go_path_is_path(m_szInitialPathname))
            {
                szPersistDirectory = UT_go_dirname_from_uri(m_szInitialPathname, FALSE);
                gtk_file_chooser_set_current_folder_uri(m_FC, szPersistDirectory);
            }
            else
            {
                // we are dealing with a plain filename, not an URI or path, so
                // just let it come up in the current working directory.
            }
        }
    }

    // center the dialog
    xxx_UT_DEBUGMSG(("before center IS WIDGET_TOP_LEVL %d \n",(GTK_WIDGET_TOPLEVEL(parent))));
    xxx_UT_DEBUGMSG(("before center IS WIDGET WINDOW %d \n",(GTK_IS_WINDOW(parent))));
    centerDialog(parent, GTK_WIDGET(m_FC));
    xxx_UT_DEBUGMSG(("After center IS WIDGET WINDOW %d \n",(GTK_IS_WINDOW(parent))));

    gtk_widget_show(GTK_WIDGET(m_FC));
    gtk_grab_add(GTK_WIDGET(m_FC));

    bool bResult = _run_gtk_main(pFrame,filetypes_pulldown);

    if (bResult)
    {
        UT_ASSERT(m_szFinalPathnameCandidate);

        // store final path name and file type
        m_szFinalPathname = g_strdup(m_szFinalPathnameCandidate);

        FREEP(m_szFinalPathnameCandidate);

        // what a long ugly line of code
        m_nFileType = XAP_comboBoxGetActiveInt(GTK_COMBO_BOX(filetypes_pulldown));
    }

    if (m_FC != NULL) {
        gtk_grab_remove (GTK_WIDGET(m_FC));
        gtk_widget_destroy (GTK_WIDGET(m_FC));
        m_FC = NULL;
        FREEP(szPersistDirectory);
    }

    return;
}