Also, this cleans up two FIXMEs that had been leftin the source about
building a path in a more portable manner (instead of literal "/", use
Glib::build_filename()).
Erm, I don't see how this google interface will let me post a file, so
i'll have to reply or something.
- const Glib::ustring Conf::GCS_CONF_DIR = ".agave";
+ const Glib::ustring Conf::GCS_CONF_DIR = "agave";
const Glib::ustring Conf::FAVORITES_FILE = Conf::GCS_CONF_DIR +
"/bookmarks.gpl";
const Glib::ustring Conf::USER_PALETTE_DIR = Conf::GCS_CONF_DIR +
"/palettes";
diff --git a/src/gcs-mainwindow.cc b/src/gcs-mainwindow.cc
index 0584af3..aa97645 100644
--- a/src/gcs-mainwindow.cc
+++ b/src/gcs-mainwindow.cc
@@ -86,14 +86,13 @@ namespace gcs
m_pPane(Gtk::manage(new Gtk::HPaned())),
m_pControls(Gtk::manage(new Gtk::HBox())),
m_pSchemeBox(Gtk::manage(new Widgets::SchemeBox())),
- // FIXME: build this path in a more portable way
m_PaletteView(Gtk::manage(new Widgets::PaletteView(
- AGAVE_PALETTEDIR "/Web.gpl"))),
+
Glib::build_filename(AGAVE_PALETTEDIR,"Web.gpl")))),
m_pStatusbar(Gtk::manage(new Gtk::Statusbar())),
m_pHistory(new HistoryNavigation<tHexString>()),
m_pMainMenu(0), // will be assigned in the constructor
- // FIXME: build this path in a more portable way
- m_bookmarks_file(Glib::get_home_dir() + "/" +
Conf::FAVORITES_FILE)
+ // FIXME: look into getting g_get_user_data_dir() wrapped into
glibmm
+
m_bookmarks_file(Glib::build_filename(Glib::ustring(g_get_user_data_dir()),Conf::FAVORITES_FILE))
{
m_pBookmarkList = Gtk::manage(new
Widgets::BookmarkList(m_bookmarks_file));
init_actions();
Looks good. I was not aware of that API. I definitely like that
better than home directory dotfile pollution. I think we should
probably migrate over any old data though. Since the format is
staying the same, we could just rename the old directory to the new
path. Would you be willing to work up a patch for this, or would you
like me to?
--
jonner
> Looks good. I was not aware of that API. I definitely like that
> better than home directory dotfile pollution. I think we should
> probably migrate over any old data though. Since the format is
> staying the same, we could just rename the old directory to the new
> path. Would you be willing to work up a patch for this, or would you
> like me to?
>
Feel free :) I don't really have any ideas how to achieve that, other
than having both, checking ofr the existance.. ok so maybe I have one
idea, but it doesn't seem very elegant.
If you can't come up with anything I can have a crack at it.
dave
OK, I've pushed out your patch, and also committed another change to
migrate settings from the old config directory to the new one.
Thanks for the patch.
--
jonner
No, unfortunately, there's currently no way to browse the repository
online. I've wished there was many times, but the current hosting I
have for the project doesn't support cgi scripts so I can't install
gitweb. I'd like to do it sometime though. For now, I'll attach the
diff from after applying your patch to the current HEAD.
By the way, when you sent your patch, i had trouble applying it
because there were some line breaks added. Perhaps sending patches as
email attachments would work better.
As for my patch, there are a couple inter-related changes.
- First, I made the Conf::GCS_CONF_DIR be a full pathname so that we
no longer have to build it (e.g. by calling
Glib::build_filenmae(g_get_user_data_dir(), Conf::GCS_CONF_DIR)) every
time we want to use it.
- Second, I added a simple function to Conf that checks existence of
the configuration directories, and if the old one exists but the new
one doesn't, it just renames the old directory to the new one. This
is done at the beginning of the MainWindow constructor
- Third, I removed a couple obsolete attributes from MainWindow that
duplicated constants in Conf, but weren't actually used.
If you have a more elegant solution in mind, feel free to propose it,
but this seems to work for now :)
--
jonner