aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-06 02:25:31 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-06 04:40:50 +0800
commit695e0dba7040a9693d4f08b404753ae910d9182b (patch)
treee22ddb64e7f4e75a378ee147c1c58fc0de3059c6
parent552d1cc022b265d49f35566acf2f2119a09b94ba (diff)
downloadgsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar.gz
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar.bz2
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar.lz
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar.xz
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.tar.zst
gsoc2013-evolution-695e0dba7040a9693d4f08b404753ae910d9182b.zip
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()
-rw-r--r--doc/reference/evolution-util/evolution-util-sections.txt1
-rw-r--r--e-util/gal-view-collection.c53
-rw-r--r--e-util/gal-view-collection.h2
3 files changed, 56 insertions, 0 deletions
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt
index 88156b1b92..1e789f1a14 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -4590,6 +4590,7 @@ GalViewPrivate
GalViewCollectionItem
GalViewCollection
gal_view_collection_new
+gal_view_collection_get_system_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 dadbbfb251..bc98c4fa95 100644
--- a/e-util/gal-view-collection.c
+++ b/e-util/gal-view-collection.c
@@ -29,6 +29,11 @@
#include "e-xml-utils.h"
enum {
+ PROP_0,
+ PROP_SYSTEM_DIRECTORY
+};
+
+enum {
CHANGED,
LAST_SIGNAL
};
@@ -117,6 +122,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)
{
GalViewCollection *collection;
@@ -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),
@@ -198,6 +233,22 @@ gal_view_collection_new (void)
}
/**
+ * 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
* @system_dir: The location of the system built in views
@@ -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. */