Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-studio / trunk / src / gtkmm / widget_filename.cpp
index 24743c5..a178614 100644 (file)
@@ -2,19 +2,21 @@
 /*!    \file widget_filename.cpp
 **     \brief Template File
 **
-**     $Id: widget_filename.cpp,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
+**     $Id$
 **
 **     \legal
-**     Copyright (c) 2002 Robert B. Quattlebaum Jr.
+**     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2008 Chris Moore
 **
-**     This software and associated documentation
-**     are CONFIDENTIAL and PROPRIETARY property of
-**     the above-mentioned copyright holder.
+**     This package is free software; you can redistribute it and/or
+**     modify it under the terms of the GNU General Public License as
+**     published by the Free Software Foundation; either version 2 of
+**     the License, or (at your option) any later version.
 **
-**     You may not copy, print, publish, or in any
-**     other way distribute this software without
-**     a prior written agreement with
-**     the copyright holder.
+**     This package is distributed in the hope that it will be useful,
+**     but WITHOUT ANY WARRANTY; without even the implied warranty of
+**     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+**     General Public License for more details.
 **     \endlegal
 */
 /* ========================================================================= */
@@ -32,6 +34,9 @@
 #include <gtkmm/button.h>
 #include "widget_filename.h"
 #include "app.h"
+#include "canvasview.h"
+
+#include "general.h"
 
 #endif
 
@@ -44,10 +49,6 @@ using namespace studio;
 
 /* === M A C R O S ========================================================= */
 
-#if ! defined(_)
-#define _(x)   (x)
-#endif
-
 /* === G L O B A L S ======================================================= */
 
 /* === P R O C E D U R E S ================================================= */
@@ -81,7 +82,7 @@ Widget_Filename::set_has_frame(bool x)
 
 
 void
-Widget_Filename::set_value(const string &data)
+Widget_Filename::set_value(const std::string &data)
 {
        entry_filename->set_text(data);
 }
@@ -111,6 +112,11 @@ Widget_Filename::on_button_choose_pressed()
        string filename=entry_filename->get_text();
        if(filename.empty())
                filename=".";
-       if(App::dialog_open_file(_("Choose File"),filename))
+       else
+               filename = etl::absolute_path(
+                       etl::dirname(App::get_selected_canvas_view()->get_canvas()->get_file_name()) +
+                       ETL_DIRECTORY_SEPARATOR +
+                       filename);
+       if(App::dialog_open_file(_("Choose File"), filename, MISC_DIR_PREFERENCE))
                entry_filename->set_text(filename);
 }