summaryrefslogtreecommitdiff
path: root/telepathy-logger
diff options
context:
space:
mode:
Diffstat (limited to 'telepathy-logger')
-rw-r--r--telepathy-logger/log-manager.c24
-rw-r--r--telepathy-logger/log-store-pidgin.c20
-rw-r--r--telepathy-logger/log-store-sqlite.c7
-rw-r--r--telepathy-logger/log-store-xml.c20
-rw-r--r--telepathy-logger/log-store.c29
5 files changed, 11 insertions, 89 deletions
diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index 642e3f9..966e7fe 100644
--- a/telepathy-logger/log-manager.c
+++ b/telepathy-logger/log-manager.c
@@ -190,8 +190,7 @@ static TplLogStore *
add_log_store (TplLogManager *self,
GType type,
const char *name,
- gboolean readable,
- gboolean writable)
+ gboolean readable)
{
TplLogStore *store;
@@ -200,7 +199,6 @@ add_log_store (TplLogManager *self,
store = g_object_new (type,
"name", name,
"readable", readable,
- "writable", writable,
NULL);
/* set the log store in "testmode" if it supports it and the environment is
@@ -290,17 +288,17 @@ tpl_log_manager_init (TplLogManager *self)
G_CALLBACK (_globally_enabled_changed), NULL);
/* The TPL's default read-write logstore */
- add_log_store (self, TPL_TYPE_LOG_STORE_XML, "TpLogger", TRUE, TRUE);
+ add_log_store (self, TPL_TYPE_LOG_STORE_XML, "TpLogger", TRUE);
/* Load by default the Empathy's legacy 'past coversations' LogStore */
- store = add_log_store (self, TPL_TYPE_LOG_STORE_XML, "Empathy", TRUE, FALSE);
+ store = add_log_store (self, TPL_TYPE_LOG_STORE_XML, "Empathy", TRUE);
if (store != NULL)
g_object_set (store, "empathy-legacy", TRUE, NULL);
- add_log_store (self, TPL_TYPE_LOG_STORE_PIDGIN, "Pidgin", TRUE, FALSE);
+ add_log_store (self, TPL_TYPE_LOG_STORE_PIDGIN, "Pidgin", TRUE);
/* Load the event counting cache */
- add_log_store (self, TPL_TYPE_LOG_STORE_SQLITE, "Sqlite", FALSE, TRUE);
+ add_log_store (self, TPL_TYPE_LOG_STORE_SQLITE, "Sqlite", FALSE);
DEBUG ("Log Manager initialised");
}
@@ -324,13 +322,8 @@ tpl_log_manager_dup_singleton (void)
* @event: a TplEvent subclass's instance
* @error: the memory location of GError, filled if an error occurs
*
- * It stores @event, sending it to all the registered TplLogStore which have
- * TplLogStore:writable set to %TRUE.
- * Every TplLogManager is guaranteed to have at least a readable
- * and a writable TplLogStore regitered.
- *
- * It applies for any registered TplLogStore with #TplLogstore:writable property
- * %TRUE
+ * It stores @event, sending it to all the writable registered #TplLogStore objects.
+ * (Every TplLogManager is guaranteed to have at least one writable log store.)
*
* Returns: %TRUE if the event has been successfully added, otherwise %FALSE.
*/
@@ -394,9 +387,6 @@ _tpl_log_manager_add_event (TplLogManager *manager,
* It registers @logstore into @manager, the log store has to be an
* implementation of the TplLogStore interface.
*
- * @logstore has to properly implement the add_event method if the
- * #TplLogStore:writable is set to %TRUE.
- *
* @logstore has to properly implement all the search/query methods if the
* TplLogStore:readable is set to %TRUE.
*/
diff --git a/telepathy-logger/log-store-pidgin.c b/telepathy-logger/log-store-pidgin.c
index 169acd6..c9c9772 100644
--- a/telepathy-logger/log-store-pidgin.c
+++ b/telepathy-logger/log-store-pidgin.c
@@ -49,14 +49,12 @@ struct _TplLogStorePidginPriv
gchar *basedir;
gchar *name;
gboolean readable;
- gboolean writable;
};
enum {
PROP_0,
PROP_NAME,
PROP_READABLE,
- PROP_WRITABLE,
PROP_BASEDIR,
PROP_TESTMODE,
};
@@ -73,7 +71,6 @@ static void log_store_pidgin_set_name (TplLogStorePidgin *self, const gchar *dat
static const gchar *log_store_pidgin_get_basedir (TplLogStorePidgin *self);
static void log_store_pidgin_set_basedir (TplLogStorePidgin *self,
const gchar *data);
-static void log_store_pidgin_set_writable (TplLogStorePidgin *self, gboolean data);
static void log_store_pidgin_set_readable (TplLogStorePidgin *self, gboolean data);
@@ -94,9 +91,6 @@ tpl_log_store_pidgin_get_property (GObject *object,
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
- case PROP_WRITABLE:
- g_value_set_boolean (value, priv->writable);
- break;
case PROP_READABLE:
g_value_set_boolean (value, priv->readable);
break;
@@ -129,9 +123,6 @@ tpl_log_store_pidgin_set_property (GObject *object,
case PROP_READABLE:
log_store_pidgin_set_readable (self, g_value_get_boolean (value));
break;
- case PROP_WRITABLE:
- log_store_pidgin_set_writable (self, g_value_get_boolean (value));
- break;
case PROP_BASEDIR:
log_store_pidgin_set_basedir (self, g_value_get_string (value));
break;
@@ -172,7 +163,6 @@ tpl_log_store_pidgin_class_init (TplLogStorePidginClass *klass)
g_object_class_override_property (object_class, PROP_NAME, "name");
g_object_class_override_property (object_class, PROP_READABLE, "readable");
- g_object_class_override_property (object_class, PROP_WRITABLE, "writable");
/**
* TplLogStorePidgin:basedir:
@@ -283,16 +273,6 @@ log_store_pidgin_set_readable (TplLogStorePidgin *self,
}
-static void
-log_store_pidgin_set_writable (TplLogStorePidgin *self,
- gboolean data)
-{
- g_return_if_fail (TPL_IS_LOG_STORE_PIDGIN (self));
-
- self->priv->writable = data;
-}
-
-
/* internal: get the full name of the storing directory, including protocol
* and id */
static gchar *
diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c
index 1c0f11f..bd4ed98 100644
--- a/telepathy-logger/log-store-sqlite.c
+++ b/telepathy-logger/log-store-sqlite.c
@@ -51,7 +51,6 @@ enum /* properties */
PROP_0,
PROP_NAME,
PROP_READABLE,
- PROP_WRITABLE
};
struct _TplLogStoreSqlitePrivate
@@ -113,10 +112,6 @@ tpl_log_store_sqlite_get_property (GObject *self,
g_value_set_boolean (value, FALSE);
break;
- case PROP_WRITABLE:
- g_value_set_boolean (value, TRUE);
- break;
-
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (self, id, pspec);
break;
@@ -134,7 +129,6 @@ tpl_log_store_sqlite_set_property (GObject *self,
{
case PROP_NAME:
case PROP_READABLE:
- case PROP_WRITABLE:
break;
default:
@@ -325,7 +319,6 @@ _tpl_log_store_sqlite_class_init (TplLogStoreSqliteClass *klass)
g_object_class_override_property (gobject_class, PROP_NAME, "name");
g_object_class_override_property (gobject_class, PROP_READABLE, "readable");
- g_object_class_override_property (gobject_class, PROP_WRITABLE, "writable");
g_type_class_add_private (gobject_class, sizeof (TplLogStoreSqlitePrivate));
}
diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c
index 83a39a3..0c4595e 100644
--- a/telepathy-logger/log-store-xml.c
+++ b/telepathy-logger/log-store-xml.c
@@ -81,7 +81,6 @@ struct _TplLogStoreXmlPriv
gchar *basedir;
gchar *name;
gboolean readable;
- gboolean writable;
gboolean empathy_legacy;
gboolean test_mode;
TpAccountManager *account_manager;
@@ -91,7 +90,6 @@ enum {
PROP_0,
PROP_NAME,
PROP_READABLE,
- PROP_WRITABLE,
PROP_BASEDIR,
PROP_EMPATHY_LEGACY,
PROP_TESTMODE
@@ -107,7 +105,6 @@ static void log_store_xml_set_name (TplLogStoreXml *self, const gchar *data);
static const gchar *log_store_xml_get_basedir (TplLogStoreXml *self);
static void log_store_xml_set_basedir (TplLogStoreXml *self,
const gchar *data);
-static void log_store_xml_set_writable (TplLogStoreXml *self, gboolean data);
static void log_store_xml_set_readable (TplLogStoreXml *self, gboolean data);
@@ -170,9 +167,6 @@ tpl_log_store_xml_get_property (GObject *object,
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
- case PROP_WRITABLE:
- g_value_set_boolean (value, priv->writable);
- break;
case PROP_READABLE:
g_value_set_boolean (value, priv->readable);
break;
@@ -208,9 +202,6 @@ tpl_log_store_xml_set_property (GObject *object,
case PROP_READABLE:
log_store_xml_set_readable (self, g_value_get_boolean (value));
break;
- case PROP_WRITABLE:
- log_store_xml_set_writable (self, g_value_get_boolean (value));
- break;
case PROP_EMPATHY_LEGACY:
self->priv->empathy_legacy = g_value_get_boolean (value);
break;
@@ -240,7 +231,6 @@ _tpl_log_store_xml_class_init (TplLogStoreXmlClass *klass)
g_object_class_override_property (object_class, PROP_NAME, "name");
g_object_class_override_property (object_class, PROP_READABLE, "readable");
- g_object_class_override_property (object_class, PROP_WRITABLE, "writable");
/**
* TplLogStoreXml:basedir:
@@ -1853,16 +1843,6 @@ log_store_xml_set_readable (TplLogStoreXml *self,
}
-static void
-log_store_xml_set_writable (TplLogStoreXml *self,
- gboolean data)
-{
- g_return_if_fail (TPL_IS_LOG_STORE_XML (self));
-
- self->priv->writable = data;
-}
-
-
static GList *
log_store_xml_get_filtered_events (TplLogStore *store,
TpAccount *account,
diff --git a/telepathy-logger/log-store.c b/telepathy-logger/log-store.c
index 44ef326..c586bbb 100644
--- a/telepathy-logger/log-store.c
+++ b/telepathy-logger/log-store.c
@@ -30,7 +30,7 @@
* SECTION:log-store
* @title: TplLogStore
* @short_description: LogStore interface can register into #TplLogManager as
- * #TplLogStore:writable or #TplLogStore:readable log stores.
+ * readable and/or writable log stores.
* @see_also: #text-event:#TplTextEvent and other subclasses when they'll exist
*
* The #TplLogStore defines all the public methods that a TPL Log Store has to
@@ -89,22 +89,6 @@ _tpl_log_store_init (gpointer g_iface)
"Whether this log store is readable",
TRUE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
-
- /**
- * TplLogStore:writable:
- *
- * Defines whether the object is writable for a #TplLogManager.
- *
- * If an TplLogStore implementation is writable, the #TplLogManager will call
- * its tpl_log_store_add_event() method every time a loggable even occurs,
- * i.e., every time _tpl_log_manager_add_event() is called.
- */
- g_object_interface_install_property (g_iface,
- g_param_spec_boolean ("writable",
- "Writable",
- "Whether this log store is writable",
- TRUE,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}
const gchar *
@@ -150,11 +134,12 @@ _tpl_log_store_add_event (TplLogStore *self,
{
g_return_val_if_fail (TPL_IS_LOG_STORE (self), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
if (TPL_LOG_STORE_GET_INTERFACE (self)->add_event == NULL)
{
g_set_error (error, TPL_LOG_STORE_ERROR,
TPL_LOG_STORE_ERROR_ADD_EVENT,
- "%s: add_event not implemented, but writable set to TRUE : %s",
+ "%s: %s is not writable",
G_STRFUNC, G_OBJECT_CLASS_NAME (self));
return FALSE;
}
@@ -380,15 +365,9 @@ _tpl_log_store_create_iter (TplLogStore *self,
gboolean
_tpl_log_store_is_writable (TplLogStore *self)
{
- gboolean writable;
-
g_return_val_if_fail (TPL_IS_LOG_STORE (self), FALSE);
- g_object_get (self,
- "writable", &writable,
- NULL);
-
- return writable;
+ return (TPL_LOG_STORE_GET_INTERFACE (self)->add_event != NULL);
}