[grilo-plugins/wip/carlosg/tracker3: 23/30] tracker3: Move away from g_type_class_add_private()
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins/wip/carlosg/tracker3: 23/30] tracker3: Move away from g_type_class_add_private()
- Date: Wed, 19 Aug 2020 22:35:05 +0000 (UTC)
commit d73baf33cff61834bb7b151e5bd19db6327decb2
Author: Carlos Garnacho <carlosg gnome org>
Date: Mon May 25 13:24:23 2020 +0200
tracker3: Move away from g_type_class_add_private()
Use G_*_PRIVATE when declaring the type.
src/tracker3/grl-tracker-source-api.c | 6 +++---
src/tracker3/grl-tracker-source-priv.h | 2 +-
src/tracker3/grl-tracker-source-statements.c | 2 +-
src/tracker3/grl-tracker-source.c | 16 +++++++---------
src/tracker3/grl-tracker-source.h | 4 ++--
5 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/src/tracker3/grl-tracker-source-api.c b/src/tracker3/grl-tracker-source-api.c
index f24ec293..fa603d4e 100644
--- a/src/tracker3/grl-tracker-source-api.c
+++ b/src/tracker3/grl-tracker-source-api.c
@@ -703,7 +703,7 @@ void
grl_tracker_source_store_metadata (GrlSource *source,
GrlSourceStoreMetadataSpec *sms)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = GRL_TRACKER_SOURCE (source)->priv;
TrackerResource *resource;
GrlTrackerOp *os;
@@ -968,7 +968,7 @@ grl_tracker_source_cancel (GrlSource *source, guint operation_id)
gboolean
grl_tracker_source_change_start (GrlSource *source, GError **error)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = GRL_TRACKER_SOURCE (source)->priv;
priv->notifier =
grl_tracker_source_notify_new (source, priv->tracker_connection);
@@ -979,7 +979,7 @@ grl_tracker_source_change_start (GrlSource *source, GError **error)
gboolean
grl_tracker_source_change_stop (GrlSource *source, GError **error)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = GRL_TRACKER_SOURCE (source)->priv;
g_clear_object (&priv->notifier);
diff --git a/src/tracker3/grl-tracker-source-priv.h b/src/tracker3/grl-tracker-source-priv.h
index 226087c2..90454c69 100644
--- a/src/tracker3/grl-tracker-source-priv.h
+++ b/src/tracker3/grl-tracker-source-priv.h
@@ -62,7 +62,7 @@ typedef enum {
GRL_TRACKER_SOURCE_STATE_DELETED,
} GrlTrackerSourceState;
-struct _GrlTrackerSourcePriv {
+struct _GrlTrackerSourcePrivate {
TrackerSparqlConnection *tracker_connection;
GDBusProxy *writeback;
diff --git a/src/tracker3/grl-tracker-source-statements.c b/src/tracker3/grl-tracker-source-statements.c
index d85d71b4..157f906b 100644
--- a/src/tracker3/grl-tracker-source-statements.c
+++ b/src/tracker3/grl-tracker-source-statements.c
@@ -453,7 +453,7 @@ grl_tracker_source_create_statement (GrlTrackerSource *source,
const gchar *extra_sparql,
GError **error)
{
- GrlTrackerSourcePriv *priv = source->priv;
+ GrlTrackerSourcePrivate *priv = source->priv;
CachedStatement *cache;
GError *tracker_error = NULL;
GList *link, *keys_copy;
diff --git a/src/tracker3/grl-tracker-source.c b/src/tracker3/grl-tracker-source.c
index 8fb23a8d..9a697f6e 100644
--- a/src/tracker3/grl-tracker-source.c
+++ b/src/tracker3/grl-tracker-source.c
@@ -75,7 +75,7 @@ GrlTrackerCache *grl_tracker_item_cache;
/* ================== TrackerSource GObject ================ */
-G_DEFINE_TYPE (GrlTrackerSource, grl_tracker_source, GRL_TYPE_SOURCE);
+G_DEFINE_TYPE_WITH_PRIVATE (GrlTrackerSource, grl_tracker_source, GRL_TYPE_SOURCE);
static GrlTrackerSource *
grl_tracker_source_new (TrackerSparqlConnection *connection)
@@ -124,14 +124,12 @@ grl_tracker_source_class_init (GrlTrackerSourceClass * klass)
G_PARAM_WRITABLE
| G_PARAM_CONSTRUCT_ONLY
| G_PARAM_STATIC_NAME));
-
- g_type_class_add_private (klass, sizeof (GrlTrackerSourcePriv));
}
static void
grl_tracker_source_init (GrlTrackerSource *source)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = grl_tracker_source_get_instance_private (source);
GDBusConnection *connection;
source->priv = priv;
@@ -172,7 +170,7 @@ grl_tracker_source_set_property (GObject *object,
GParamSpec *pspec)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (object);
+ GrlTrackerSourcePrivate *priv = GRL_TRACKER_SOURCE (object)->priv;
switch (propid) {
case PROP_TRACKER_CONNECTION:
@@ -188,7 +186,7 @@ grl_tracker_source_set_property (GObject *object,
TrackerSparqlConnection *
grl_tracker_source_get_tracker_connection (GrlTrackerSource *source)
{
- GrlTrackerSourcePriv *priv;
+ GrlTrackerSourcePrivate *priv;
g_return_val_if_fail (GRL_IS_TRACKER_SOURCE (source), NULL);
@@ -202,7 +200,7 @@ grl_tracker_source_get_tracker_connection (GrlTrackerSource *source)
void
grl_tracker_add_source (GrlTrackerSource *source)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = source->priv;
GRL_DEBUG ("====================>add source '%s'",
grl_source_get_name (GRL_SOURCE (source)));
@@ -217,7 +215,7 @@ grl_tracker_add_source (GrlTrackerSource *source)
void
grl_tracker_del_source (GrlTrackerSource *source)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = source->priv;
GRL_DEBUG ("==================>del source '%s'",
grl_source_get_name (GRL_SOURCE (source)));
@@ -232,7 +230,7 @@ grl_tracker_del_source (GrlTrackerSource *source)
gboolean
grl_tracker_source_can_notify (GrlTrackerSource *source)
{
- GrlTrackerSourcePriv *priv = GRL_TRACKER_SOURCE_GET_PRIVATE (source);
+ GrlTrackerSourcePrivate *priv = source->priv;
if (priv->state == GRL_TRACKER_SOURCE_STATE_RUNNING)
return priv->notifier != NULL;
diff --git a/src/tracker3/grl-tracker-source.h b/src/tracker3/grl-tracker-source.h
index a6157263..9a1c6c57 100644
--- a/src/tracker3/grl-tracker-source.h
+++ b/src/tracker3/grl-tracker-source.h
@@ -55,14 +55,14 @@
GrlTrackerSourceClass))
typedef struct _GrlTrackerSource GrlTrackerSource;
-typedef struct _GrlTrackerSourcePriv GrlTrackerSourcePriv;
+typedef struct _GrlTrackerSourcePrivate GrlTrackerSourcePrivate;
struct _GrlTrackerSource {
GrlSource parent;
/*< private >*/
- GrlTrackerSourcePriv *priv;
+ GrlTrackerSourcePrivate *priv;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]