* ]|
**/
-#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;
};
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);
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);
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,
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;
}
/**
*/
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;
-}