From 695e0dba7040a9693d4f08b404753ae910d9182b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 5 Jul 2013 14:25:31 -0400 Subject: GalViewCollection: Add a "system-directory" property. Just readable for now, but I plan to make it also construct-only. New functions: gal_view_collection_get_system_directory() --- e-util/gal-view-collection.c | 53 ++++++++++++++++++++++++++++++++++++++++++++ e-util/gal-view-collection.h | 2 ++ 2 files changed, 55 insertions(+) (limited to 'e-util') diff --git a/e-util/gal-view-collection.c b/e-util/gal-view-collection.c index dadbbfb251..bc98c4fa95 100644 --- a/e-util/gal-view-collection.c +++ b/e-util/gal-view-collection.c @@ -28,6 +28,11 @@ #include "e-unicode.h" #include "e-xml-utils.h" +enum { + PROP_0, + PROP_SYSTEM_DIRECTORY +}; + enum { CHANGED, LAST_SIGNAL @@ -116,6 +121,24 @@ gal_view_generate_id (GalViewCollection *collection, } } +static void +gal_view_collection_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_SYSTEM_DIRECTORY: + g_value_set_string ( + value, + gal_view_collection_get_system_directory ( + GAL_VIEW_COLLECTION (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + static void gal_view_collection_dispose (GObject *object) { @@ -167,9 +190,21 @@ gal_view_collection_class_init (GalViewCollectionClass *class) GObjectClass *object_class; object_class = G_OBJECT_CLASS (class); + object_class->get_property = gal_view_collection_get_property; object_class->dispose = gal_view_collection_dispose; object_class->finalize = gal_view_collection_finalize; + g_object_class_install_property ( + object_class, + PROP_SYSTEM_DIRECTORY, + g_param_spec_string ( + "system-directory", + "System Directory", + "Directory from which to load built-in views", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + signals[CHANGED] = g_signal_new ( "changed", G_OBJECT_CLASS_TYPE (object_class), @@ -197,6 +232,22 @@ gal_view_collection_new (void) return g_object_new (GAL_TYPE_VIEW_COLLECTION, NULL); } +/** + * gal_view_collection_get_system_directory: + * @collection: a #GalViewCollection + * + * Returns the directory from which built-in views were loaded. + * + * Returns: the system directory for @collection + **/ +const gchar * +gal_view_collection_get_system_directory (GalViewCollection *collection) +{ + g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL); + + return collection->system_dir; +} + /** * gal_view_collection_set_storage_directories * @collection: The view collection to initialize @@ -219,6 +270,8 @@ gal_view_collection_set_storage_directories (GalViewCollection *collection, collection->system_dir = g_strdup (system_dir); collection->local_dir = g_strdup (local_dir); + + g_object_notify (G_OBJECT (collection), "system-directory"); } /** diff --git a/e-util/gal-view-collection.h b/e-util/gal-view-collection.h index 4025bf9a5c..83678b02d7 100644 --- a/e-util/gal-view-collection.h +++ b/e-util/gal-view-collection.h @@ -94,6 +94,8 @@ struct _GalViewCollectionItem { GType gal_view_collection_get_type (void) G_GNUC_CONST; GalViewCollection * gal_view_collection_new (void); +const gchar * gal_view_collection_get_system_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