create a class Edn::File that manage the modification of the falineme to get the real filename in the system ==> dit not work corectly...
This commit is contained in:
@@ -93,17 +93,25 @@ MainWindows::~MainWindows(void)
|
||||
}
|
||||
|
||||
|
||||
void MainWindows::SetTitle(Edn::String &fileName, bool isModify)
|
||||
void MainWindows::SetTitle(Edn::File &fileName, bool isModify)
|
||||
{
|
||||
Edn::String tmp = "";
|
||||
if (fileName != "") {
|
||||
tmp += fileName;
|
||||
if (fileName.GetShortFilename() != "") {
|
||||
tmp += fileName.GetShortFilename();
|
||||
tmp += " - ";
|
||||
tmp += fileName.GetFolder();
|
||||
tmp += " - ";
|
||||
}
|
||||
tmp += "Edn";
|
||||
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
|
||||
}
|
||||
|
||||
void MainWindows::SetNoTitle(void)
|
||||
{
|
||||
Edn::String tmp = "Edn";
|
||||
gtk_window_set_title(GTK_WINDOW(m_mainWindow), tmp.c_str());
|
||||
}
|
||||
|
||||
void MainWindows::OnMessage(int32_t id, int32_t dataID)
|
||||
{
|
||||
switch (id)
|
||||
@@ -112,12 +120,11 @@ void MainWindows::OnMessage(int32_t id, int32_t dataID)
|
||||
// change Title :
|
||||
// TODO : String error when remove the error with -1;
|
||||
if (-1 == dataID) {
|
||||
Edn::String plop = "";
|
||||
SetTitle(plop, false );
|
||||
SetNoTitle();
|
||||
} else {
|
||||
Buffer *mybuf = BufferManager::getInstance()->Get(dataID);
|
||||
if (NULL != mybuf) {
|
||||
Edn::String plop = mybuf->GetName();
|
||||
Edn::File plop = mybuf->GetFileName();
|
||||
SetTitle(plop, mybuf->IsModify() );
|
||||
}
|
||||
}
|
||||
|
@@ -53,7 +53,8 @@ class MainWindows: public Singleton<MainWindows>, public MsgBroadcast
|
||||
static bool OnQuit(GtkWidget *widget, gpointer data);
|
||||
|
||||
private:
|
||||
void SetTitle(Edn::String &fileName, bool isModify);
|
||||
void SetTitle(Edn::File &fileName, bool isModify);
|
||||
void SetNoTitle(void);
|
||||
// main windows widget :
|
||||
GtkWidget * m_mainWindow;
|
||||
BufferView m_BufferView;
|
||||
|
@@ -101,9 +101,9 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
||||
if( -1 != m_currentBufferID
|
||||
&& true == myBufferManager->Exist(m_currentBufferID) )
|
||||
{
|
||||
Edn::String fileFolder = myBufferManager->Get(m_currentBufferID)->GetFolder();
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), fileFolder.c_str());
|
||||
//gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER(dialog), "Untitled document");
|
||||
Edn::File fileName = myBufferManager->Get(m_currentBufferID)->GetFileName();
|
||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), fileName.GetFolder().c_str());
|
||||
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), fileName.GetShortFilename().c_str());
|
||||
}
|
||||
if (gtk_dialog_run(GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
@@ -132,7 +132,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
||||
}
|
||||
Buffer *myBuffer = BufferManager::getInstance()->Get(idSelected);
|
||||
Edn::String tmpString = "Save as file : ";
|
||||
tmpString += myBuffer->GetShortName().c_str();
|
||||
tmpString += myBuffer->GetFileName().GetShortFilename().c_str();
|
||||
GtkWidget *dialog = gtk_file_chooser_dialog_new( tmpString.c_str(), NULL,
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
GTK_STOCK_CANCEL, // button text
|
||||
@@ -145,7 +145,7 @@ void WindowsManager::OnMessage(int32_t id, int32_t dataID)
|
||||
Edn::String myfilename;
|
||||
myfilename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (dialog));
|
||||
|
||||
myBuffer->SetName(myfilename);
|
||||
myBuffer->SetFileName(myfilename);
|
||||
myBuffer->Save();
|
||||
|
||||
SendMessage(EDN_MSG__CURRENT_CHANGE_BUFFER_ID, idSelected);
|
||||
|
Reference in New Issue
Block a user