summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-19 15:20:34 +0100
committerinfirit <[email protected]>2014-11-19 15:44:09 +0100
commit10d6972d37355198a63309142ae9875fdcc222f6 (patch)
treeeb447d06bb1a668f241c44c07895622558f3ab5b /src/main.c
parent5591da29a5027de4f8ec5c967d2d0ff6ba579af0 (diff)
downloadengrampa-10d6972d37355198a63309142ae9875fdcc222f6.tar.bz2
engrampa-10d6972d37355198a63309142ae9875fdcc222f6.tar.xz
use g_get_user_config_dir instead of using .config/mate
Also provide an automatic migration mechanism. Based on FR commit: 7fd220a834f16b260da8f5ddc1250c43b9dbefd8 From: Paolo Bacchilega <[email protected]>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index 94729a5..520f3df 100644
--- a/src/main.c
+++ b/src/main.c
@@ -833,28 +833,38 @@ fr_restore_session (EggSMClient *client)
}
static void
-prepare_app (void)
+migrate_options_directory (void)
{
- char *uri;
- char *extract_to_uri = NULL;
- char *add_to_uri = NULL;
- EggSMClient *client = NULL;
+ char *old_directory_path;
+ GFile *old_directory;
+ GFile *new_directory;
- /* create the config dir if necessary. */
+ old_directory_path = get_home_relative_path (".config/mate/engrampa/options");
+ old_directory = g_file_new_for_path (old_directory_path);
+ new_directory = get_user_config_subdirectory (ADD_FOLDER_OPTIONS_DIR, FALSE);
+ if (g_file_query_exists (old_directory, NULL) && ! g_file_query_exists (new_directory, NULL)) {
+ GFile *parent;
- uri = get_home_relative_uri (RC_DIR);
+ parent = g_file_get_parent (new_directory);
+ if (make_directory_tree (parent, 0700, NULL))
+ g_file_move (old_directory, new_directory, 0, NULL, NULL, NULL, NULL);
- if (uri_is_file (uri)) { /* before the MateConf port this was a file, now it's folder. */
- GFile *file;
-
- file = g_file_new_for_uri (uri);
- g_file_delete (file, NULL, NULL);
- g_object_unref (file);
+ g_object_unref (parent);
}
- ensure_dir_exists (uri, 0700, NULL);
- g_free (uri);
+ g_object_unref (new_directory);
+ g_object_unref (old_directory);
+ g_free (old_directory_path);
+}
+
+static void
+prepare_app (void)
+{
+ char *extract_to_uri = NULL;
+ char *add_to_uri = NULL;
+ EggSMClient *client = NULL;
+ migrate_options_directory ();
register_commands ();
compute_supported_archive_types ();