[gnome-photos] utils: Add dot_dir



commit d9c18db7a51d2ccdc995467a507afdb46cbff900
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat Aug 18 23:19:14 2012 +0200

    utils: Add dot_dir

 src/photos-utils.c |   24 ++++++++++++++++++++++++
 src/photos-utils.h |    2 ++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-utils.c b/src/photos-utils.c
index d959472..9bb6738 100644
--- a/src/photos-utils.c
+++ b/src/photos-utils.c
@@ -36,6 +36,9 @@
 #include "photos-utils.h"
 
 
+static const gchar *dot_dir;
+
+
 void
 photos_utils_alpha_gtk_widget (GtkWidget *widget)
 {
@@ -112,6 +115,27 @@ photos_utils_create_symbolic_icon (const gchar *name, gint base_size)
 }
 
 
+const gchar *
+photos_utils_dot_dir (void)
+{
+  const gchar *config_dir;
+
+  if (dot_dir == NULL)
+    {
+      config_dir = g_get_user_config_dir ();
+      dot_dir = g_build_filename (config_dir, PACKAGE_TARNAME, NULL);
+    }
+
+  if (g_file_test (dot_dir, G_FILE_TEST_IS_DIR))
+    goto out;
+
+  g_mkdir_with_parents (dot_dir, 0700);
+
+ out:
+  return dot_dir;
+}
+
+
 static gboolean
 photos_utils_create_thumbnail (GIOSchedulerJob *job, GCancellable *cancellable, gpointer user_data)
 {
diff --git a/src/photos-utils.h b/src/photos-utils.h
index 0cba2d9..5091f17 100644
--- a/src/photos-utils.h
+++ b/src/photos-utils.h
@@ -35,6 +35,8 @@ void             photos_utils_alpha_gtk_widget            (GtkWidget *widget);
 
 GIcon           *photos_utils_create_symbolic_icon        (const gchar *name, gint base_size);
 
+const gchar     *photos_utils_dot_dir                     (void);
+
 GdkPixbuf       *photos_utils_embed_image_in_frame        (GdkPixbuf *source_image,
                                                            const gchar *frame_image_path,
                                                            GtkBorder *slice_width,



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