aboutsummaryrefslogtreecommitdiffstats
path: root/vncviewer/ServerDialog.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vncviewer/ServerDialog.cxx')
-rw-r--r--vncviewer/ServerDialog.cxx21
1 files changed, 9 insertions, 12 deletions
diff --git a/vncviewer/ServerDialog.cxx b/vncviewer/ServerDialog.cxx
index ec1e40e4..144f31a7 100644
--- a/vncviewer/ServerDialog.cxx
+++ b/vncviewer/ServerDialog.cxx
@@ -38,7 +38,6 @@
#include <os/os.h>
#include <rfb/Exception.h>
#include <rfb/LogWriter.h>
-#include <rfb/util.h>
#include "fltk/layout.h"
#include "ServerDialog.h"
@@ -62,8 +61,6 @@ ServerDialog::ServerDialog()
Fl_Button *button;
Fl_Box *divider;
- usedDir = NULL;
-
x = OUTER_MARGIN;
y = OUTER_MARGIN;
@@ -120,8 +117,6 @@ ServerDialog::ServerDialog()
ServerDialog::~ServerDialog()
{
- if (usedDir)
- free(usedDir);
}
@@ -168,10 +163,11 @@ void ServerDialog::handleLoad(Fl_Widget* /*widget*/, void* data)
{
ServerDialog *dialog = (ServerDialog*)data;
- if (!dialog->usedDir)
- dialog->usedDir = strDup(os::getuserhomedir());
+ if (dialog->usedDir.empty())
+ dialog->usedDir = os::getuserhomedir();
- Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir, _("TigerVNC configuration (*.tigervnc)"),
+ Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir.c_str(),
+ _("TigerVNC configuration (*.tigervnc)"),
0, _("Select a TigerVNC configuration file"));
file_chooser->preview(0);
file_chooser->previewButton->hide();
@@ -207,10 +203,11 @@ void ServerDialog::handleSaveAs(Fl_Widget* /*widget*/, void* data)
ServerDialog *dialog = (ServerDialog*)data;
const char* servername = dialog->serverName->value();
const char* filename;
- if (!dialog->usedDir)
- dialog->usedDir = strDup(os::getuserhomedir());
+ if (dialog->usedDir.empty())
+ dialog->usedDir = os::getuserhomedir();
- Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir, _("TigerVNC configuration (*.tigervnc)"),
+ Fl_File_Chooser* file_chooser = new Fl_File_Chooser(dialog->usedDir.c_str(),
+ _("TigerVNC configuration (*.tigervnc)"),
2, _("Save the TigerVNC configuration to file"));
file_chooser->preview(0);
@@ -405,6 +402,6 @@ void ServerDialog::saveServerHistory()
void ServerDialog::updateUsedDir(const char* filename)
{
char * name = strdup(filename);
- usedDir = strdup(dirname(name));
+ usedDir = dirname(name);
free(name);
}