[gnome-photos] search-type: Make it a final class



commit 8bb588eb046419f50cb28f6973bf17be1f5d2e8d
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 4 14:43:13 2016 +0100

    search-type: Make it a final class

 src/photos-search-type.c |   39 ++++++++++++++++++++-------------------
 src/photos-search-type.h |   28 ++--------------------------
 2 files changed, 22 insertions(+), 45 deletions(-)
---
diff --git a/src/photos-search-type.c b/src/photos-search-type.c
index 476cf92..10ffdce 100644
--- a/src/photos-search-type.c
+++ b/src/photos-search-type.c
@@ -29,14 +29,20 @@
 #include "photos-search-type.h"
 
 
-struct _PhotosSearchTypePrivate
+struct _PhotosSearchType
 {
+  GObject parent_instance;
   gchar *filter;
   gchar *id;
   gchar *name;
   gchar *where;
 };
 
+struct _PhotosSearchTypeClass
+{
+  GObjectClass parent_class;
+};
+
 enum
 {
   PROP_0,
@@ -50,7 +56,6 @@ static void photos_filterable_interface_init (PhotosFilterableInterface *iface);
 
 
 G_DEFINE_TYPE_WITH_CODE (PhotosSearchType, photos_search_type, G_TYPE_OBJECT,
-                         G_ADD_PRIVATE (PhotosSearchType)
                          G_IMPLEMENT_INTERFACE (PHOTOS_TYPE_FILTERABLE,
                                                 photos_filterable_interface_init));
 
@@ -59,7 +64,7 @@ static gchar *
 photos_search_type_get_filter (PhotosFilterable *iface)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (iface);
-  return g_strdup (self->priv->filter);
+  return g_strdup (self->filter);
 }
 
 
@@ -67,7 +72,7 @@ static const gchar *
 photos_search_type_get_id (PhotosFilterable *filterable)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (filterable);
-  return self->priv->id;
+  return self->id;
 }
 
 
@@ -75,7 +80,7 @@ static gchar *
 photos_search_type_get_where (PhotosFilterable *iface)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (iface);
-  return g_strdup (self->priv->where);
+  return g_strdup (self->where);
 }
 
 
@@ -83,12 +88,11 @@ static void
 photos_search_type_finalize (GObject *object)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (object);
-  PhotosSearchTypePrivate *priv = self->priv;
 
-  g_free (priv->filter);
-  g_free (priv->id);
-  g_free (priv->name);
-  g_free (priv->where);
+  g_free (self->filter);
+  g_free (self->id);
+  g_free (self->name);
+  g_free (self->where);
 
   G_OBJECT_CLASS (photos_search_type_parent_class)->finalize (object);
 }
@@ -98,16 +102,15 @@ static void
 photos_search_type_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (object);
-  PhotosSearchTypePrivate *priv = self->priv;
 
   switch (prop_id)
     {
     case PROP_ID:
-      g_value_set_string (value, priv->id);
+      g_value_set_string (value, self->id);
       break;
 
     case PROP_NAME:
-      g_value_set_string (value, priv->name);
+      g_value_set_string (value, self->name);
       break;
 
     default:
@@ -121,24 +124,23 @@ static void
 photos_search_type_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
 {
   PhotosSearchType *self = PHOTOS_SEARCH_TYPE (object);
-  PhotosSearchTypePrivate *priv = self->priv;
 
   switch (prop_id)
     {
     case PROP_FILTER:
-      priv->filter = g_value_dup_string (value);
+      self->filter = g_value_dup_string (value);
       break;
 
     case PROP_ID:
-      priv->id = g_value_dup_string (value);
+      self->id = g_value_dup_string (value);
       break;
 
     case PROP_NAME:
-      priv->name = g_value_dup_string (value);
+      self->name = g_value_dup_string (value);
       break;
 
     case PROP_WHERE:
-      priv->where = g_value_dup_string (value);
+      self->where = g_value_dup_string (value);
       break;
 
     default:
@@ -151,7 +153,6 @@ photos_search_type_set_property (GObject *object, guint prop_id, const GValue *v
 static void
 photos_search_type_init (PhotosSearchType *self)
 {
-  self->priv = photos_search_type_get_instance_private (self);
 }
 
 
diff --git a/src/photos-search-type.h b/src/photos-search-type.h
index 599fab9..a055ce7 100644
--- a/src/photos-search-type.h
+++ b/src/photos-search-type.h
@@ -35,41 +35,17 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
    PHOTOS_TYPE_SEARCH_TYPE, PhotosSearchType))
 
-#define PHOTOS_SEARCH_TYPE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-   PHOTOS_TYPE_SEARCH_TYPE, PhotosSearchTypeClass))
-
 #define PHOTOS_IS_SEARCH_TYPE(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
    PHOTOS_TYPE_SEARCH_TYPE))
 
-#define PHOTOS_IS_SEARCH_TYPE_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-   PHOTOS_TYPE_SEARCH_TYPE))
-
-#define PHOTOS_SEARCH_TYPE_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-   PHOTOS_TYPE_SEARCH_TYPE, PhotosSearchTypeClass))
-
 #define PHOTOS_SEARCH_TYPE_STOCK_ALL "all"
 #define PHOTOS_SEARCH_TYPE_STOCK_COLLECTIONS "collections"
 #define PHOTOS_SEARCH_TYPE_STOCK_FAVORITES "favorites"
 #define PHOTOS_SEARCH_TYPE_STOCK_PHOTOS "photos"
 
-typedef struct _PhotosSearchType        PhotosSearchType;
-typedef struct _PhotosSearchTypeClass   PhotosSearchTypeClass;
-typedef struct _PhotosSearchTypePrivate PhotosSearchTypePrivate;
-
-struct _PhotosSearchType
-{
-  GObject parent_instance;
-  PhotosSearchTypePrivate *priv;
-};
-
-struct _PhotosSearchTypeClass
-{
-  GObjectClass parent_class;
-};
+typedef struct _PhotosSearchType      PhotosSearchType;
+typedef struct _PhotosSearchTypeClass PhotosSearchTypeClass;
 
 GType                photos_search_type_get_type           (void) G_GNUC_CONST;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]