[epiphany] Define the names of the history and bookmarks files in just one place



commit ceab3ce08927ec45bb880371b7f31041a5192851
Author: Xan Lopez <xan igalia com>
Date:   Wed Dec 12 13:09:39 2012 +0100

    Define the names of the history and bookmarks files in just one place

 embed/ephy-embed-shell.c       |    3 ++-
 lib/ephy-file-helpers.c        |    2 +-
 lib/ephy-profile-migrator.c    |    6 +++---
 lib/ephy-profile-utils.h       |    4 ++++
 src/bookmarks/ephy-bookmarks.c |    5 +++--
 tests/ephy-bookmarks-test.c    |    3 ++-
 6 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c
index 9821d4f..ea45a14 100644
--- a/embed/ephy-embed-shell.c
+++ b/embed/ephy-embed-shell.c
@@ -31,6 +31,7 @@
 #include "ephy-encodings.h"
 #include "ephy-file-helpers.h"
 #include "ephy-history-service.h"
+#include "ephy-profile-utils.h"
 #include "ephy-snapshot-service.h"
 
 #include <glib/gi18n.h>
@@ -124,7 +125,7 @@ ephy_embed_shell_get_global_history_service (EphyEmbedShell *shell)
   if (shell->priv->global_history_service == NULL) {
     char *filename;
 
-    filename = g_build_filename (ephy_dot_dir (), "ephy-history.db", NULL);
+    filename = g_build_filename (ephy_dot_dir (), EPHY_HISTORY_FILE, NULL);
     shell->priv->global_history_service = ephy_history_service_new (filename);
     g_free (filename);
     g_return_val_if_fail (shell->priv->global_history_service, NULL);
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 898e218..b21b8a7 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -353,7 +353,7 @@ ephy_file_helpers_init (const char *profile_dir,
 	if (steal_data_from_profile && profile_dir)
 	{
 		int i;
-		char *files_to_copy[] = { "ephy-history.db", "ephy-bookmarks.xml" };
+		char *files_to_copy[] = { EPHY_HISTORY_FILE, EPHY_BOOKMARKS_FILE };
 		
 		for (i = 0; i < G_N_ELEMENTS (files_to_copy); i++)
 		{
diff --git a/lib/ephy-profile-migrator.c b/lib/ephy-profile-migrator.c
index c7cf494..e757cbd 100644
--- a/lib/ephy-profile-migrator.c
+++ b/lib/ephy-profile-migrator.c
@@ -559,11 +559,11 @@ migrate_history (void)
   char buffer[1024];
   HistoryParseData parse_data;
 
-  gchar *temporary_file = g_build_filename (ephy_dot_dir (), "ephy-history.db", NULL);
+  gchar *temporary_file = g_build_filename (ephy_dot_dir (), EPHY_HISTORY_FILE, NULL);
   /* Do nothing if the history file already exists. Safer than wiping
    * it out. */
   if (g_file_test (temporary_file, G_FILE_TEST_EXISTS)) {
-    g_warning ("Did not migrate Epiphany's history, the ephy-history.db file already exists");
+    g_warning ("Did not migrate Epiphany's history, the %s file already exists", EPHY_HISTORY_FILE);
     g_free (temporary_file);
     return;
   }
@@ -779,7 +779,7 @@ migrate_new_urls_table (void)
   char *filename;
   GError *error = NULL;
 
-  filename = g_build_filename (ephy_dot_dir (), "ephy-history.db", NULL);
+  filename = g_build_filename (ephy_dot_dir (), EPHY_HISTORY_FILE, NULL);
   history_database = ephy_sqlite_connection_new ();
   ephy_sqlite_connection_open (history_database, filename, &error);
 
diff --git a/lib/ephy-profile-utils.h b/lib/ephy-profile-utils.h
index 5a9b844..1e9d071 100644
--- a/lib/ephy-profile-utils.h
+++ b/lib/ephy-profile-utils.h
@@ -28,6 +28,10 @@
 
 #define EPHY_PROFILE_MIGRATION_VERSION 8
 
+#define EPHY_HISTORY_FILE       "ephy-history.db"
+#define EPHY_BOOKMARKS_FILE     "ephy-bookmarks.xml"
+#define EPHY_BOOKMARKS_FILE_RDF "bookmarks.rdf"
+
 int ephy_profile_utils_get_migration_version (void);
 
 gboolean ephy_profile_utils_set_migration_version (int version);
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 67917bc..ac41a64 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -32,6 +32,7 @@
 #include "ephy-history-service.h"
 #include "ephy-node-common.h"
 #include "ephy-prefs.h"
+#include "ephy-profile-utils.h"
 #include "ephy-settings.h"
 #include "ephy-shell.h"
 #include "ephy-signal-accumulator.h"
@@ -957,10 +958,10 @@ ephy_bookmarks_init (EphyBookmarks *eb)
 	eb->priv->db = db;
 
 	eb->priv->xml_file = g_build_filename (ephy_dot_dir (),
-					       "ephy-bookmarks.xml",
+					       EPHY_BOOKMARKS_FILE,
 					       NULL);
 	eb->priv->rdf_file = g_build_filename (ephy_dot_dir (),
-					       "bookmarks.rdf",
+					       EPHY_BOOKMARKS_FILE_RDF,
 					       NULL);
 
 	/* Bookmarks */
diff --git a/tests/ephy-bookmarks-test.c b/tests/ephy-bookmarks-test.c
index ca1f780..06be0e3 100644
--- a/tests/ephy-bookmarks-test.c
+++ b/tests/ephy-bookmarks-test.c
@@ -23,8 +23,9 @@
 
 #include "ephy-debug.h"
 #include "ephy-file-helpers.h"
+#include "ephy-profile-utils.h"
 
-const char* bookmarks_paths[] = { "ephy-bookmarks.xml", "bookmarks.rdf", NULL };
+const char* bookmarks_paths[] = { EPHY_BOOKMARKS_FILE, EPHY_BOOKMARKS_FILE_RDF, NULL };
 
 static void
 clear_bookmark_files (void)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]