ESourceRevisionGuards cleanups.
authorMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Feb 2013 17:09:22 +0000 (12:09 -0500)
committerMatthew Barnes <mbarnes@redhat.com>
Mon, 4 Feb 2013 17:41:12 +0000 (12:41 -0500)
docs/reference/libedataserver/libedataserver-docs.sgml
docs/reference/libedataserver/libedataserver-sections.txt
docs/reference/libedataserver/libedataserver.types
libedataserver/e-source-revision-guards.c
libedataserver/e-source-revision-guards.h
libedataserver/e-source.c

index 2d33930..381035e 100644 (file)
@@ -40,6 +40,7 @@
     <xi:include href="xml/e-source-openpgp.xml"/>
     <xi:include href="xml/e-source-refresh.xml"/>
     <xi:include href="xml/e-source-resource.xml"/>
+    <xi:include href="xml/e-source-revision-guards.xml"/>
     <xi:include href="xml/e-source-security.xml"/>
     <xi:include href="xml/e-source-smime.xml"/>
     <xi:include href="xml/e-source-task-list.xml"/>
index d2ffd20..fbf53c7 100644 (file)
@@ -904,6 +904,26 @@ ESourceResourcePrivate
 </SECTION>
 
 <SECTION>
+<FILE>e-source-revision-guards</FILE>
+<TITLE>ESourceRevisionGuards</TITLE>
+ESourceRevisionGuards
+E_SOURCE_EXTENSION_REVISION_GUARDS
+e_source_revision_guards_get_enabled
+e_source_revision_guards_set_enabled
+<SUBSECTION Standard>
+E_SOURCE_REVISION_GUARDS
+E_IS_SOURCE_REVISION_GUARDS
+E_TYPE_SOURCE_REVISION_GUARDS
+E_SOURCE_REVISION_GUARDS_CLASS
+E_IS_SOURCE_REVISION_GUARDS_CLASS
+E_SOURCE_REVISION_GUARDS_GET_CLASS
+ESourceRevisionGuardsClass
+e_source_revision_guards_get_type
+<SUBSECTION Private>
+ESourceRevisionGuardsPrivate
+</SECTION>
+
+<SECTION>
 <FILE>e-source-security</FILE>
 <TITLE>ESourceSecurity</TITLE>
 ESourceSecurity
index 4005c82..8a48600 100644 (file)
@@ -28,6 +28,7 @@ e_source_openpgp_get_type
 e_source_refresh_get_type
 e_source_registry_get_type
 e_source_resource_get_type
+e_source_revision_guards_get_type
 e_source_security_get_type
 e_source_selectable_get_type
 e_source_smime_get_type
index 9e3d793..db49900 100644 (file)
  * ]|
  **/
 
-#include <libedataserver/e-data-server-util.h>
-
 #include "e-source-revision-guards.h"
 
-#define E_SOURCE_ABC_GET_PRIVATE(obj)                  \
-       (G_TYPE_INSTANCE_GET_PRIVATE                    \
-        ((obj), E_TYPE_SOURCE_REVISION_GUARDS, \
-         ESourceRevisionGuardsPrivate))
+#include <libedataserver/e-data-server-util.h>
+
+#define E_SOURCE_REVISION_GUARDS_GET_PRIVATE(obj) \
+       (G_TYPE_INSTANCE_GET_PRIVATE \
+       ((obj), E_TYPE_SOURCE_REVISION_GUARDS, ESourceRevisionGuardsPrivate))
 
 struct _ESourceRevisionGuardsPrivate {
-       GMutex property_lock;
        gboolean enabled;
 };
 
@@ -68,29 +66,17 @@ G_DEFINE_TYPE (
        E_TYPE_SOURCE_EXTENSION)
 
 static void
-source_revision_guards_finalize (GObject *object)
-{
-       ESourceRevisionGuardsPrivate *priv;
-
-       priv = E_SOURCE_ABC_GET_PRIVATE (object);
-
-       g_mutex_clear (&priv->property_lock);
-
-       G_OBJECT_CLASS (e_source_revision_guards_parent_class)->finalize (object);
-}
-
-static void
 source_revision_guards_set_property (GObject *object,
-                                    guint property_id,
-                                    const GValue *value,
-                                    GParamSpec *pspec)
+                                     guint property_id,
+                                     const GValue *value,
+                                     GParamSpec *pspec)
 {
-       ESourceRevisionGuards *extension = E_SOURCE_REVISION_GUARDS (object);
-
        switch (property_id) {
-       case PROP_ENABLED:
-               e_source_revision_guards_set_enabled (extension, g_value_get_boolean (value));
-               return;
+               case PROP_ENABLED:
+                       e_source_revision_guards_set_enabled (
+                               E_SOURCE_REVISION_GUARDS (object),
+                               g_value_get_boolean (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -98,16 +84,17 @@ source_revision_guards_set_property (GObject *object,
 
 static void
 source_revision_guards_get_property (GObject *object,
-                                    guint property_id,
-                                    GValue *value,
-                                    GParamSpec *pspec)
+                                     guint property_id,
+                                     GValue *value,
+                                     GParamSpec *pspec)
 {
-       ESourceRevisionGuards *extension = E_SOURCE_REVISION_GUARDS (object);
-
        switch (property_id) {
-       case PROP_ENABLED:
-               g_value_set_boolean (value, e_source_revision_guards_get_enabled (extension));
-               return;
+               case PROP_ENABLED:
+                       g_value_set_boolean (
+                               value,
+                               e_source_revision_guards_get_enabled (
+                               E_SOURCE_REVISION_GUARDS (object)));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -116,16 +103,18 @@ source_revision_guards_get_property (GObject *object,
 static void
 e_source_revision_guards_class_init (ESourceRevisionGuardsClass *class)
 {
-       GObjectClass          *object_class;
+       GObjectClass *object_class;
        ESourceExtensionClass *extension_class;
 
-       extension_class       = E_SOURCE_EXTENSION_CLASS (class);
-       extension_class->name = E_SOURCE_EXTENSION_REVISION_GUARDS;
+       g_type_class_add_private (
+               class, sizeof (ESourceRevisionGuardsPrivate));
 
-       object_class               = G_OBJECT_CLASS (class);
-       object_class->finalize     = source_revision_guards_finalize;
-       object_class->get_property = source_revision_guards_get_property;
+       object_class = G_OBJECT_CLASS (class);
        object_class->set_property = source_revision_guards_set_property;
+       object_class->get_property = source_revision_guards_get_property;
+
+       extension_class = E_SOURCE_EXTENSION_CLASS (class);
+       extension_class->name = E_SOURCE_EXTENSION_REVISION_GUARDS;
 
        g_object_class_install_property (
                object_class,
@@ -138,17 +127,30 @@ e_source_revision_guards_class_init (ESourceRevisionGuardsClass *class)
                        G_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT |
                        E_SOURCE_PARAM_SETTING));
-
-       g_type_class_add_private (class, sizeof (ESourceRevisionGuardsPrivate));
 }
 
 static void
 e_source_revision_guards_init (ESourceRevisionGuards *extension)
 {
-       extension->priv = E_SOURCE_ABC_GET_PRIVATE (extension);
-       extension->priv->enabled = FALSE;
+       extension->priv = E_SOURCE_REVISION_GUARDS_GET_PRIVATE (extension);
+}
 
-       g_mutex_init (&extension->priv->property_lock);
+/**
+ * e_source_revision_guards_get_enabled:
+ * @extension: An #ESourceRevisionGuards
+ *
+ * Checks whether revision guards for the given #ESource are enabled.
+ *
+ * Returns: %TRUE if the revision guards are enabled.
+ *
+ * Since: 3.8
+ */
+gboolean
+e_source_revision_guards_get_enabled (ESourceRevisionGuards *extension)
+{
+       g_return_val_if_fail (E_IS_SOURCE_REVISION_GUARDS (extension), FALSE);
+
+       return extension->priv->enabled;
 }
 
 /**
@@ -164,47 +166,15 @@ e_source_revision_guards_init (ESourceRevisionGuards *extension)
  */
 void
 e_source_revision_guards_set_enabled (ESourceRevisionGuards  *extension,
-                                     gboolean                enabled)
+                                      gboolean enabled)
 {
        g_return_if_fail (E_IS_SOURCE_REVISION_GUARDS (extension));
 
-       enabled = !!enabled;
-
-       g_mutex_lock (&extension->priv->property_lock);
-
-       if (extension->priv->enabled == enabled) {
-               g_mutex_unlock (&extension->priv->property_lock);
+       if (extension->priv->enabled == enabled)
                return;
-       }
 
        extension->priv->enabled = enabled;
 
-       g_mutex_unlock (&extension->priv->property_lock);
-
        g_object_notify (G_OBJECT (extension), "enabled");
 }
 
-
-/**
- * e_source_revision_guards_get_enabled:
- * @extension: An #ESourceRevisionGuards
- *
- * Checks whether revision guards for the given #ESource are enabled.
- *
- * Returns: %TRUE if the revision guards are enabled.
- *
- * Since: 3.8
- */
-gboolean
-e_source_revision_guards_get_enabled (ESourceRevisionGuards *extension)
-{
-       gboolean enabled;
-
-       g_return_val_if_fail (E_IS_SOURCE_REVISION_GUARDS (extension), FALSE);
-
-       g_mutex_lock (&extension->priv->property_lock);
-       enabled = extension->priv->enabled;
-       g_mutex_unlock (&extension->priv->property_lock);
-
-       return enabled;
-}
index fadf318..17e2e51 100644 (file)
@@ -82,12 +82,13 @@ struct _ESourceRevisionGuardsClass {
        ESourceExtensionClass parent_class;
 };
 
-GType           e_source_revision_guards_get_type     (void);
-
-void            e_source_revision_guards_set_enabled  (ESourceRevisionGuards  *extension,
-                                                      gboolean                enabled);
-gboolean        e_source_revision_guards_get_enabled  (ESourceRevisionGuards  *extension);
-
+GType          e_source_revision_guards_get_type
+                                       (void) G_GNUC_CONST;
+gboolean       e_source_revision_guards_get_enabled
+                                       (ESourceRevisionGuards *extension);
+void           e_source_revision_guards_set_enabled
+                                       (ESourceRevisionGuards *extension,
+                                        gboolean enabled);
 
 G_END_DECLS
 
index 0ffb94f..cfb1977 100644 (file)
@@ -93,6 +93,7 @@
 #include "e-source-openpgp.h"
 #include "e-source-refresh.h"
 #include "e-source-resource.h"
+#include "e-source-revision-guards.h"
 #include "e-source-security.h"
 #include "e-source-selectable.h"
 #include "e-source-smime.h"
@@ -1650,6 +1651,7 @@ e_source_class_init (ESourceClass *class)
        g_type_ensure (E_TYPE_SOURCE_OPENPGP);
        g_type_ensure (E_TYPE_SOURCE_REFRESH);
        g_type_ensure (E_TYPE_SOURCE_RESOURCE);
+       g_type_ensure (E_TYPE_SOURCE_REVISION_GUARDS);
        g_type_ensure (E_TYPE_SOURCE_SECURITY);
        g_type_ensure (E_TYPE_SOURCE_SELECTABLE);
        g_type_ensure (E_TYPE_SOURCE_SMIME);