[evolution] GalViewCollection: Add a "user-directory" property.



commit 844510797455940352cf08bc7ca1388a594a00af
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jul 5 14:33:32 2013 -0400

    GalViewCollection: Add a "user-directory" property.
    
    Just readable for now, but I plan to make it also construct-only.
    
    (Despite the precendence, I prefer "user" over "local" for the name.)
    
    New functions:
    
      gal_view_collection_get_user_directory()

 .../evolution-util/evolution-util-sections.txt     |    1 +
 e-util/gal-view-collection.c                       |   38 +++++++++++++++++++-
 e-util/gal-view-collection.h                       |    2 +
 3 files changed, 40 insertions(+), 1 deletions(-)
---
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt 
b/doc/reference/evolution-util/evolution-util-sections.txt
index 1e789f1..4572161 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -4591,6 +4591,7 @@ GalViewCollectionItem
 GalViewCollection
 gal_view_collection_new
 gal_view_collection_get_system_directory
+gal_view_collection_get_user_directory
 gal_view_collection_set_storage_directories
 gal_view_collection_add_factory
 gal_view_collection_get_count
diff --git a/e-util/gal-view-collection.c b/e-util/gal-view-collection.c
index bc98c4f..19d1546 100644
--- a/e-util/gal-view-collection.c
+++ b/e-util/gal-view-collection.c
@@ -30,7 +30,8 @@
 
 enum {
        PROP_0,
-       PROP_SYSTEM_DIRECTORY
+       PROP_SYSTEM_DIRECTORY,
+       PROP_USER_DIRECTORY
 };
 
 enum {
@@ -134,6 +135,13 @@ gal_view_collection_get_property (GObject *object,
                                gal_view_collection_get_system_directory (
                                GAL_VIEW_COLLECTION (object)));
                        return;
+
+               case PROP_USER_DIRECTORY:
+                       g_value_set_string (
+                               value,
+                               gal_view_collection_get_user_directory (
+                               GAL_VIEW_COLLECTION (object)));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -205,6 +213,17 @@ gal_view_collection_class_init (GalViewCollectionClass *class)
                        G_PARAM_READABLE |
                        G_PARAM_STATIC_STRINGS));
 
+       g_object_class_install_property (
+               object_class,
+               PROP_USER_DIRECTORY,
+               g_param_spec_string (
+                       "user-directory",
+                       "User Directory",
+                       "Directory from which to load user-created views",
+                       NULL,
+                       G_PARAM_READABLE |
+                       G_PARAM_STATIC_STRINGS));
+
        signals[CHANGED] = g_signal_new (
                "changed",
                G_OBJECT_CLASS_TYPE (object_class),
@@ -249,6 +268,22 @@ gal_view_collection_get_system_directory (GalViewCollection *collection)
 }
 
 /**
+ * gal_view_collection_get_user_directory:
+ * @collection: a #GalViewCollection
+ *
+ * Returns the directory from which user-created views were loaded.
+ *
+ * Returns: the user directory for @collection
+ **/
+const gchar *
+gal_view_collection_get_user_directory (GalViewCollection *collection)
+{
+       g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
+
+       return collection->local_dir;
+}
+
+/**
  * gal_view_collection_set_storage_directories
  * @collection: The view collection to initialize
  * @system_dir: The location of the system built in views
@@ -272,6 +307,7 @@ gal_view_collection_set_storage_directories (GalViewCollection *collection,
        collection->local_dir = g_strdup (local_dir);
 
        g_object_notify (G_OBJECT (collection), "system-directory");
+       g_object_notify (G_OBJECT (collection), "user-directory");
 }
 
 /**
diff --git a/e-util/gal-view-collection.h b/e-util/gal-view-collection.h
index 83678b0..ab5c54c 100644
--- a/e-util/gal-view-collection.h
+++ b/e-util/gal-view-collection.h
@@ -96,6 +96,8 @@ GalViewCollection *
                gal_view_collection_new         (void);
 const gchar *  gal_view_collection_get_system_directory
                                                (GalViewCollection *collection);
+const gchar *  gal_view_collection_get_user_directory
+                                               (GalViewCollection *collection);
 
 /* Set up the view collection.  Call these two functions
  * before ever doing load or save and never call them again. */


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