[gnome-photos] preview-model: Make it a final class



commit 8a9955b019cde44a6eb691c6ad6b83d6aa1e9758
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Mar 4 15:06:16 2016 +0100

    preview-model: Make it a final class

 src/photos-preview-model.c |   20 +++++++++++---------
 src/photos-preview-model.h |   28 ++--------------------------
 2 files changed, 13 insertions(+), 35 deletions(-)
---
diff --git a/src/photos-preview-model.c b/src/photos-preview-model.c
index 7e8abd3..7cecae5 100644
--- a/src/photos-preview-model.c
+++ b/src/photos-preview-model.c
@@ -31,13 +31,19 @@
 #include "photos-view-model.h"
 
 
-struct _PhotosPreviewModelPrivate
+struct _PhotosPreviewModel
 {
+  GtkTreeModelFilter parent_instance;
   PhotosBaseManager *item_mngr;
 };
 
+struct _PhotosPreviewModelClass
+{
+  GtkTreeModelFilterClass parent_class;
+};
 
-G_DEFINE_TYPE_WITH_PRIVATE (PhotosPreviewModel, photos_preview_model, GTK_TYPE_TREE_MODEL_FILTER);
+
+G_DEFINE_TYPE (PhotosPreviewModel, photos_preview_model, GTK_TYPE_TREE_MODEL_FILTER);
 
 
 static gboolean
@@ -53,7 +59,7 @@ photos_preview_model_visible (GtkTreeModel *model, GtkTreeIter *iter, gpointer u
   if (id == NULL)
     goto out;
 
-  item = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id (self->priv->item_mngr, id));
+  item = PHOTOS_BASE_ITEM (photos_base_manager_get_object_by_id (self->item_mngr, id));
   identifier = photos_base_item_get_identifier (item);
   if (identifier != NULL && g_str_has_prefix (identifier, PHOTOS_QUERY_COLLECTIONS_IDENTIFIER))
     goto out;
@@ -71,7 +77,7 @@ photos_preview_model_dispose (GObject *object)
 {
   PhotosPreviewModel *self = PHOTOS_PREVIEW_MODEL (object);
 
-  g_clear_object (&self->priv->item_mngr);
+  g_clear_object (&self->item_mngr);
 
   G_OBJECT_CLASS (photos_preview_model_parent_class)->dispose (object);
 }
@@ -80,17 +86,13 @@ photos_preview_model_dispose (GObject *object)
 static void
 photos_preview_model_init (PhotosPreviewModel *self)
 {
-  PhotosPreviewModelPrivate *priv;
   GApplication *app;
   PhotosSearchContextState *state;
 
-  self->priv = photos_preview_model_get_instance_private (self);
-  priv = self->priv;
-
   app = g_application_get_default ();
   state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
 
-  priv->item_mngr = g_object_ref (state->item_mngr);
+  self->item_mngr = g_object_ref (state->item_mngr);
   gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (self), photos_preview_model_visible, self, 
NULL);
 }
 
diff --git a/src/photos-preview-model.h b/src/photos-preview-model.h
index 402ecdd..bfb8501 100644
--- a/src/photos-preview-model.h
+++ b/src/photos-preview-model.h
@@ -32,36 +32,12 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
    PHOTOS_TYPE_PREVIEW_MODEL, PhotosPreviewModel))
 
-#define PHOTOS_PREVIEW_MODEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-   PHOTOS_TYPE_PREVIEW_MODEL, PhotosPreviewModelClass))
-
 #define PHOTOS_IS_PREVIEW_MODEL(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
    PHOTOS_TYPE_PREVIEW_MODEL))
 
-#define PHOTOS_IS_PREVIEW_MODEL_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-   PHOTOS_TYPE_PREVIEW_MODEL))
-
-#define PHOTOS_PREVIEW_MODEL_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-   PHOTOS_TYPE_PREVIEW_MODEL, PhotosPreviewModelClass))
-
-typedef struct _PhotosPreviewModel        PhotosPreviewModel;
-typedef struct _PhotosPreviewModelClass   PhotosPreviewModelClass;
-typedef struct _PhotosPreviewModelPrivate PhotosPreviewModelPrivate;
-
-struct _PhotosPreviewModel
-{
-  GtkTreeModelFilter parent_instance;
-  PhotosPreviewModelPrivate *priv;
-};
-
-struct _PhotosPreviewModelClass
-{
-  GtkTreeModelFilterClass parent_class;
-};
+typedef struct _PhotosPreviewModel      PhotosPreviewModel;
+typedef struct _PhotosPreviewModelClass PhotosPreviewModelClass;
 
 GType             photos_preview_model_get_type               (void) G_GNUC_CONST;
 


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