From 844510797455940352cf08bc7ca1388a594a00af Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 5 Jul 2013 14:33:32 -0400 Subject: 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 deletion(-) diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt index 1e789f1a14..45721611fb 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 bc98c4fa95..19d15462b0 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), @@ -248,6 +267,22 @@ gal_view_collection_get_system_directory (GalViewCollection *collection) return collection->system_dir; } +/** + * 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 @@ -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 83678b02d7..ab5c54c62a 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. */ -- cgit v1.2.3