[gnome-photos/gnome-3-16] single-item-job: Make it a final class
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/gnome-3-16] single-item-job: Make it a final class
- Date: Tue, 6 Oct 2015 14:14:29 +0000 (UTC)
commit fa527b5aaec70aace1e7936035b12ceda89144a2
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Oct 6 16:10:11 2015 +0200
single-item-job: Make it a final class
src/photos-single-item-job.c | 48 +++++++++++++++++++----------------------
src/photos-single-item-job.h | 28 +----------------------
2 files changed, 24 insertions(+), 52 deletions(-)
---
diff --git a/src/photos-single-item-job.c b/src/photos-single-item-job.c
index 7434c71..43b26f7 100644
--- a/src/photos-single-item-job.c
+++ b/src/photos-single-item-job.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2014 Red Hat, Inc.
+ * Copyright © 2012, 2014, 2015 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -33,8 +33,9 @@
#include "photos-tracker-queue.h"
-struct _PhotosSingleItemJobPrivate
+struct _PhotosSingleItemJob
{
+ GObject parent_instance;
PhotosSingleItemJobCallback callback;
PhotosTrackerQueue *queue;
TrackerSparqlCursor *cursor;
@@ -42,6 +43,11 @@ struct _PhotosSingleItemJobPrivate
gpointer user_data;
};
+struct _PhotosSingleItemJobClass
+{
+ GObjectClass parent_class;
+};
+
enum
{
PROP_0,
@@ -49,18 +55,16 @@ enum
};
-G_DEFINE_TYPE_WITH_PRIVATE (PhotosSingleItemJob, photos_single_item_job, G_TYPE_OBJECT);
+G_DEFINE_TYPE (PhotosSingleItemJob, photos_single_item_job, G_TYPE_OBJECT);
static void
photos_single_item_job_emit_callback (PhotosSingleItemJob *self)
{
- PhotosSingleItemJobPrivate *priv = self->priv;
-
- if (priv->callback == NULL)
+ if (self->callback == NULL)
return;
- (*priv->callback) (priv->cursor, priv->user_data);
+ (*self->callback) (self->cursor, self->user_data);
}
@@ -68,7 +72,6 @@ static void
photos_single_item_job_cursor_next (GObject *source_object, GAsyncResult *res, gpointer user_data)
{
PhotosSingleItemJob *self = PHOTOS_SINGLE_ITEM_JOB (user_data);
- PhotosSingleItemJobPrivate *priv = self->priv;
TrackerSparqlCursor *cursor = TRACKER_SPARQL_CURSOR (source_object);
GError *error;
gboolean valid;
@@ -84,7 +87,7 @@ photos_single_item_job_cursor_next (GObject *source_object, GAsyncResult *res, g
else if (!valid)
goto out;
- priv->cursor = g_object_ref (cursor);
+ self->cursor = g_object_ref (cursor);
out:
photos_single_item_job_emit_callback (self);
@@ -123,10 +126,9 @@ static void
photos_single_item_job_dispose (GObject *object)
{
PhotosSingleItemJob *self = PHOTOS_SINGLE_ITEM_JOB (object);
- PhotosSingleItemJobPrivate *priv = self->priv;
- g_clear_object (&priv->cursor);
- g_clear_object (&priv->queue);
+ g_clear_object (&self->cursor);
+ g_clear_object (&self->queue);
G_OBJECT_CLASS (photos_single_item_job_parent_class)->dispose (object);
}
@@ -137,7 +139,7 @@ photos_single_item_job_finalize (GObject *object)
{
PhotosSingleItemJob *self = PHOTOS_SINGLE_ITEM_JOB (object);
- g_free (self->priv->urn);
+ g_free (self->urn);
G_OBJECT_CLASS (photos_single_item_job_parent_class)->finalize (object);
}
@@ -151,7 +153,7 @@ photos_single_item_job_set_property (GObject *object, guint prop_id, const GValu
switch (prop_id)
{
case PROP_URN:
- self->priv->urn = g_value_dup_string (value);
+ self->urn = g_value_dup_string (value);
break;
default:
@@ -164,12 +166,7 @@ photos_single_item_job_set_property (GObject *object, guint prop_id, const GValu
static void
photos_single_item_job_init (PhotosSingleItemJob *self)
{
- PhotosSingleItemJobPrivate *priv = self->priv;
-
- self->priv = photos_single_item_job_get_instance_private (self);
- priv = self->priv;
-
- priv->queue = photos_tracker_queue_dup_singleton (NULL, NULL);
+ self->queue = photos_tracker_queue_dup_singleton (NULL, NULL);
}
@@ -206,21 +203,20 @@ photos_single_item_job_run (PhotosSingleItemJob *self,
PhotosSingleItemJobCallback callback,
gpointer user_data)
{
- PhotosSingleItemJobPrivate *priv = self->priv;
PhotosQuery *query;
- if (G_UNLIKELY (priv->queue == NULL))
+ if (G_UNLIKELY (self->queue == NULL))
{
if (callback != NULL)
(*callback) (NULL, user_data);
return;
}
- priv->callback = callback;
- priv->user_data = user_data;
+ self->callback = callback;
+ self->user_data = user_data;
- query = photos_query_builder_single_query (state, flags, priv->urn);
- photos_tracker_queue_select (priv->queue,
+ query = photos_query_builder_single_query (state, flags, self->urn);
+ photos_tracker_queue_select (self->queue,
query->sparql,
NULL,
photos_single_item_job_query_executed,
diff --git a/src/photos-single-item-job.h b/src/photos-single-item-job.h
index fdad9d0..5ce986e 100644
--- a/src/photos-single-item-job.h
+++ b/src/photos-single-item-job.h
@@ -38,38 +38,14 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PHOTOS_TYPE_SINGLE_ITEM_JOB, PhotosSingleItemJob))
-#define PHOTOS_SINGLE_ITEM_JOB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- PHOTOS_TYPE_SINGLE_ITEM_JOB, PhotosSingleItemJobClass))
-
#define PHOTOS_IS_SINGLE_ITEM_JOB(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PHOTOS_TYPE_SINGLE_ITEM_JOB))
-#define PHOTOS_IS_SINGLE_ITEM_JOB_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- PHOTOS_TYPE_SINGLE_ITEM_JOB))
-
-#define PHOTOS_SINGLE_ITEM_JOB_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- PHOTOS_TYPE_SINGLE_ITEM_JOB, PhotosSingleItemJobClass))
-
typedef void (*PhotosSingleItemJobCallback) (TrackerSparqlCursor *, gpointer);
-typedef struct _PhotosSingleItemJob PhotosSingleItemJob;
-typedef struct _PhotosSingleItemJobClass PhotosSingleItemJobClass;
-typedef struct _PhotosSingleItemJobPrivate PhotosSingleItemJobPrivate;
-
-struct _PhotosSingleItemJob
-{
- GObject parent_instance;
- PhotosSingleItemJobPrivate *priv;
-};
-
-struct _PhotosSingleItemJobClass
-{
- GObjectClass parent_class;
-};
+typedef struct _PhotosSingleItemJob PhotosSingleItemJob;
+typedef struct _PhotosSingleItemJobClass PhotosSingleItemJobClass;
GType photos_single_item_job_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]