[PATCH] Change storage location of config/data files

6 views
Skip to first unread message

Dave Foster

unread,
Sep 4, 2006, 8:36:35 PM9/4/06
to Agave Development
Yeah, it's a small patch, but I am on a crusade against pollution of
dot-dirs in the home dir. Currently it calls the unwrapped glib
function "g_get_user_data_dir()", which i am surprised is not in Glibmm
(i'll look into that soon).

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.

Dave Foster

unread,
Sep 4, 2006, 8:37:40 PM9/4/06
to Agave Development
diff --git a/src/gcs-conf.cc b/src/gcs-conf.cc
index 73855f6..5e5673f 100644
--- a/src/gcs-conf.cc
+++ b/src/gcs-conf.cc
@@ -39,7 +39,7 @@ namespace gcs
const Glib::ustring Conf::KEY_WINDOW_WIDTH = Conf::APP_DIR +
"/window_width";
const Glib::ustring Conf::KEY_WINDOW_HEIGHT = Conf::APP_DIR +
"/window_height";

- 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();

Jonathon Jongsma

unread,
Sep 4, 2006, 9:34:12 PM9/4/06
to colorsch...@googlegroups.com


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

Dave Foster

unread,
Sep 4, 2006, 11:29:42 PM9/4/06
to colorsch...@googlegroups.com
On Mon, 2006-09-04 at 20:34 -0500, Jonathon Jongsma wrote:

> 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

Jonathon Jongsma

unread,
Sep 5, 2006, 12:10:17 AM9/5/06
to colorsch...@googlegroups.com
On 9/4/06, Dave Foster <dave....@gmail.com> wrote:
>

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

Dave Foster

unread,
Sep 5, 2006, 9:02:35 AM9/5/06
to colorsch...@googlegroups.com
Cool, sounds good.

Is there a way to browse the git repo from a browser?  I'm at work and I do not have access to my machine today, decided to leave it off..  Wanted to check out that change.

dave

Jonathon Jongsma

unread,
Sep 5, 2006, 9:40:09 AM9/5/06
to colorsch...@googlegroups.com
On 9/5/06, Dave Foster <dave....@gmail.com> wrote:
> Cool, sounds good.
>
> Is there a way to browse the git repo from a browser? I'm at work and I do
> not have access to my machine today, decided to leave it off.. Wanted to
> check out that change.
>
> dave

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

migrate_confdir.patch

Dave Foster

unread,
Sep 5, 2006, 9:54:24 AM9/5/06
to colorsch...@googlegroups.com
Ok, that looks good.  I think I may have seen some glib wrappers for the func calls you are doing to test existance.  I'll look at those later (if you don't beat me to it!).

As for the patch, I would have definetely sent it via attachment but the google groups interface does not allow for that.  I could just send from here I suppose next time, dunno why I didn't think of that.

dave

On 9/5/06, Jonathon Jongsma <jonathon...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages