[vinagre] Use vinagre_dirs_xxx() functions where applicable



commit fdbe68322fa3d7c008cc0ea102f734bae96a44a1
Author: Jonh Wendell <jwendell gnome org>
Date:   Tue Jun 8 16:22:49 2010 -0300

    Use vinagre_dirs_xxx() functions where applicable

 vinagre/vinagre-app.c                 |   20 +++-----------------
 vinagre/vinagre-bookmarks-migration.c |    8 +++++---
 vinagre/vinagre-bookmarks.c           |    8 ++++++--
 vinagre/vinagre-cache-prefs.c         |    9 ++++++---
 vinagre/vinagre-connect.c             |   13 +++++++++----
 vinagre/vinagre-window.c              |    8 +++++---
 6 files changed, 34 insertions(+), 32 deletions(-)
---
diff --git a/vinagre/vinagre-app.c b/vinagre/vinagre-app.c
index b54969d..acb858b 100644
--- a/vinagre/vinagre-app.c
+++ b/vinagre/vinagre-app.c
@@ -27,6 +27,7 @@
 
 #include "vinagre-app.h"
 #include "vinagre-utils.h"
+#include "vinagre-dirs.h"
 
 #define VINAGRE_APP_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), VINAGRE_TYPE_APP, VinagreAppPrivate))
 
@@ -59,27 +60,12 @@ vinagre_app_class_init (VinagreAppClass *klass)
   g_type_class_add_private (object_class, sizeof(VinagreAppPrivate));
 }
 
-static gchar *
-get_accel_file (void)
-{
-  const gchar *home;
-
-  home = g_get_user_config_dir ();
-
-  if (home)
-    return g_build_filename (home,
-			     "vinagre",
-			     "accels",
-			     NULL);
-  return NULL;
-}
-
 static void
 load_accels (void)
 {
   gchar *filename;
 
-  filename = get_accel_file ();
+  filename = vinagre_dirs_get_user_accels_file ();
   if (!filename)
     return;
 
@@ -92,7 +78,7 @@ save_accels (void)
 {
   gchar *filename;
 
-  filename = get_accel_file ();
+  filename = vinagre_dirs_get_user_accels_file ();
   if (!filename)
     return;
 
diff --git a/vinagre/vinagre-bookmarks-migration.c b/vinagre/vinagre-bookmarks-migration.c
index 7628eaa..97ca7ab 100644
--- a/vinagre/vinagre-bookmarks-migration.c
+++ b/vinagre/vinagre-bookmarks-migration.c
@@ -35,6 +35,7 @@
 #include "vinagre-bookmarks.h"
 #include "vinagre-plugin.h"
 #include "vinagre-plugins-engine.h"
+#include "vinagre-dirs.h"
 
 static void
 fill_xml (GSList *list, xmlTextWriter *writer)
@@ -206,7 +207,7 @@ create_list (GKeyFile *kf)
 void
 vinagre_bookmarks_migration_migrate (const gchar *filename)
 {
-  gchar    *old;
+  gchar    *old, *dir;
   GKeyFile *kf;
   GError   *error;
   GSList   *entries;
@@ -220,10 +221,11 @@ vinagre_bookmarks_migration_migrate (const gchar *filename)
       return;
     }
 
-  old = g_build_filename (g_get_user_data_dir (),
-			  "vinagre",
+  dir = vinagre_dirs_get_user_data_dir ();
+  old = g_build_filename (dir,
 			  VINAGRE_BOOKMARKS_FILE_OLD,
 			  NULL);
+  g_free (dir);
   if (!g_file_test (old, G_FILE_TEST_EXISTS))
     {
       g_free (old);
diff --git a/vinagre/vinagre-bookmarks.c b/vinagre/vinagre-bookmarks.c
index eaae97d..2db27cb 100644
--- a/vinagre/vinagre-bookmarks.c
+++ b/vinagre/vinagre-bookmarks.c
@@ -30,6 +30,7 @@
 #include "vinagre-connection.h"
 #include "vinagre-plugin.h"
 #include "vinagre-plugins-engine.h"
+#include "vinagre-dirs.h"
 
 struct _VinagreBookmarksPrivate
 {
@@ -61,13 +62,16 @@ static void
 vinagre_bookmarks_init (VinagreBookmarks *book)
 {
   GFile *gfile;
+  gchar *dir;
 
   book->priv = G_TYPE_INSTANCE_GET_PRIVATE (book, VINAGRE_TYPE_BOOKMARKS, VinagreBookmarksPrivate);
   book->priv->entries = NULL;
-  book->priv->filename = g_build_filename (g_get_user_data_dir (),
-			                   "vinagre",
+
+  dir = vinagre_dirs_get_user_data_dir ();
+  book->priv->filename = g_build_filename (dir,
 			                   VINAGRE_BOOKMARKS_FILE,
 			                   NULL);
+  g_free (dir);
 
   if (!g_file_test (book->priv->filename, G_FILE_TEST_EXISTS))
     vinagre_bookmarks_migration_migrate (book->priv->filename);
diff --git a/vinagre/vinagre-cache-prefs.c b/vinagre/vinagre-cache-prefs.c
index d0515d9..22a85fc 100644
--- a/vinagre/vinagre-cache-prefs.c
+++ b/vinagre/vinagre-cache-prefs.c
@@ -20,6 +20,7 @@
 
 #include <glib/gi18n.h>
 #include "vinagre-cache-prefs.h"
+#include "vinagre-dirs.h"
 
 static GKeyFile *keyfile = NULL;
 static char* filename = NULL;
@@ -27,11 +28,13 @@ static char* filename = NULL;
 void
 vinagre_cache_prefs_init (void)
 {
+  gchar *dir = vinagre_dirs_get_user_cache_dir ();
+
   keyfile = g_key_file_new ();
-  filename = g_build_filename (g_get_user_cache_dir (),
-                               "vinagre",
+  filename = g_build_filename (dir,
                                "vinagre-prefs-cache.ini",
                                NULL);
+  g_free (dir);
 
   g_key_file_load_from_file (keyfile, filename, 0, NULL);
 }
@@ -41,7 +44,7 @@ save_file (void)
 {
   GError *error = NULL;
   gchar *data = g_key_file_to_data (keyfile, NULL, NULL);
-  gchar *dir = g_build_filename (g_get_user_cache_dir (), "vinagre", NULL);
+  gchar *dir = vinagre_dirs_get_user_cache_dir ();
 
   g_mkdir_with_parents (dir, 0700);
 
diff --git a/vinagre/vinagre-connect.c b/vinagre/vinagre-connect.c
index e42ccb8..660cb74 100644
--- a/vinagre/vinagre-connect.c
+++ b/vinagre/vinagre-connect.c
@@ -38,6 +38,7 @@
 #include "vinagre-cache-prefs.h"
 #include "vinagre-plugins-engine.h"
 #include "vinagre-plugin.h"
+#include "vinagre-dirs.h"
 
 typedef struct {
   GtkBuilder *xml;
@@ -68,10 +69,14 @@ enum {
 
 static gchar*
 history_filename () {
-  return g_build_filename (g_get_user_data_dir (),
-			   "vinagre",
-			   "history",
-			   NULL);
+  gchar *dir, *filename;
+
+  dir = vinagre_dirs_get_user_data_dir ();
+  filename =  g_build_filename (dir,
+				"history",
+				NULL);
+  g_free (dir);
+  return filename;
 }
 
 static void
diff --git a/vinagre/vinagre-window.c b/vinagre/vinagre-window.c
index fc0bc3c..f36309d 100644
--- a/vinagre/vinagre-window.c
+++ b/vinagre/vinagre-window.c
@@ -42,6 +42,7 @@
 #include "vinagre-bookmarks-entry.h"
 #include "vinagre-plugin.h"
 #include "vinagre-plugins-engine.h"
+#include "vinagre-dirs.h"
 
 #ifdef VINAGRE_ENABLE_AVAHI
 #include "vinagre-mdns.h"
@@ -704,12 +705,13 @@ create_notebook (VinagreWindow *window)
 static gboolean
 vinagre_window_check_first_run (VinagreWindow *window)
 {
-  gchar *filename;
+  gchar *dir, *filename;
 
-  filename = g_build_filename (g_get_user_data_dir (),
-			       "vinagre",
+  dir = vinagre_dirs_get_user_data_dir ();
+  filename = g_build_filename (dir,
 			       "first_run",
 			       NULL);
+  g_free (dir);
 
   if (!g_file_test (filename, G_FILE_TEST_EXISTS))
     {



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