[gnome-latex] latexila -> gnome-latex migration: handle projects
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex] latexila -> gnome-latex migration: handle projects
- Date: Tue, 27 Mar 2018 13:34:20 +0000 (UTC)
commit 1211e3d8f3b994b12109668859c03798b2b4616a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Mar 27 15:12:07 2018 +0200
latexila -> gnome-latex migration: handle projects
Factor out a common function to migrate a user data file.
src/liblatexila/latexila-utils.c | 59 ++++++++++++++++++++++++++++++----------
src/projects.vala | 2 +-
2 files changed, 46 insertions(+), 15 deletions(-)
---
diff --git a/src/liblatexila/latexila-utils.c b/src/liblatexila/latexila-utils.c
index 3bf73af..09ce407 100644
--- a/src/liblatexila/latexila-utils.c
+++ b/src/liblatexila/latexila-utils.c
@@ -565,22 +565,11 @@ migrate_latexila_to_gnome_latex_gsettings (void)
}
static void
-migrate_latexila_to_gnome_latex_most_used_symbols (void)
+migrate_latexila_to_gnome_latex_copy_file (GFile *latexila_file,
+ GFile *glatex_file)
{
- GFile *latexila_file;
- GFile *glatex_file;
GError *error = NULL;
- latexila_file = g_file_new_build_filename (g_get_user_data_dir (),
- "latexila",
- "most_used_symbols.xml",
- NULL);
-
- glatex_file = g_file_new_build_filename (g_get_user_data_dir (),
- "gnome-latex",
- "most_used_symbols.xml",
- NULL);
-
latexila_utils_create_parent_directories (glatex_file, &error);
if (error != NULL)
{
@@ -602,10 +591,51 @@ migrate_latexila_to_gnome_latex_most_used_symbols (void)
out:
if (error != NULL)
{
- g_warning ("Error when migrating LaTeXila to GNOME LaTeX most used symbols: %s",
+ g_warning ("Error when migrating LaTeXila to GNOME LaTeX user data file: %s",
error->message);
g_clear_error (&error);
}
+}
+
+static void
+migrate_latexila_to_gnome_latex_most_used_symbols (void)
+{
+ GFile *latexila_file;
+ GFile *glatex_file;
+
+ latexila_file = g_file_new_build_filename (g_get_user_data_dir (),
+ "latexila",
+ "most_used_symbols.xml",
+ NULL);
+
+ glatex_file = g_file_new_build_filename (g_get_user_data_dir (),
+ "gnome-latex",
+ "most_used_symbols.xml",
+ NULL);
+
+ migrate_latexila_to_gnome_latex_copy_file (latexila_file, glatex_file);
+
+ g_object_unref (latexila_file);
+ g_object_unref (glatex_file);
+}
+
+static void
+migrate_latexila_to_gnome_latex_projects (void)
+{
+ GFile *latexila_file;
+ GFile *glatex_file;
+
+ latexila_file = g_file_new_build_filename (g_get_user_data_dir (),
+ "latexila",
+ "projects.xml",
+ NULL);
+
+ glatex_file = g_file_new_build_filename (g_get_user_data_dir (),
+ "gnome-latex",
+ "projects.xml",
+ NULL);
+
+ migrate_latexila_to_gnome_latex_copy_file (latexila_file, glatex_file);
g_object_unref (latexila_file);
g_object_unref (glatex_file);
@@ -628,6 +658,7 @@ latexila_utils_migrate_latexila_to_gnome_latex (void)
{
migrate_latexila_to_gnome_latex_gsettings ();
migrate_latexila_to_gnome_latex_most_used_symbols ();
+ migrate_latexila_to_gnome_latex_projects ();
g_settings_set_boolean (settings, "latexila-to-gnome-latex-migration-done", TRUE);
}
diff --git a/src/projects.vala b/src/projects.vala
index b1010b3..2d55be8 100644
--- a/src/projects.vala
+++ b/src/projects.vala
@@ -234,7 +234,7 @@ public class Projects
private File get_xml_file ()
{
string path = Path.build_filename (Environment.get_user_data_dir (),
- "latexila", "projects.xml", null);
+ "gnome-latex", "projects.xml", null);
return File.new_for_path (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]