[gnome-photos] offset-favorites-controller: Make it a final class



commit 534fd3fa5039448b777e3ce98d20f2d418fecb1c
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu Mar 24 12:20:58 2016 +0100

    offset-favorites-controller: Make it a final class

 src/photos-offset-favorites-controller.c |   30 ++++++++++++++----------------
 src/photos-offset-favorites-controller.h |   28 ++--------------------------
 2 files changed, 16 insertions(+), 42 deletions(-)
---
diff --git a/src/photos-offset-favorites-controller.c b/src/photos-offset-favorites-controller.c
index d7dbefe..c0676df 100644
--- a/src/photos-offset-favorites-controller.c
+++ b/src/photos-offset-favorites-controller.c
@@ -33,30 +33,33 @@
 #include "photos-search-context.h"
 
 
-struct _PhotosOffsetFavoritesControllerPrivate
+struct _PhotosOffsetFavoritesController
 {
+  PhotosOffsetController parent_instance;
   PhotosBaseManager *item_mngr;
 };
 
+struct _PhotosOffsetFavoritesControllerClass
+{
+  PhotosOffsetControllerClass parent_class;
+};
 
-G_DEFINE_TYPE_WITH_PRIVATE (PhotosOffsetFavoritesController,
-                            photos_offset_favorites_controller,
-                            PHOTOS_TYPE_OFFSET_CONTROLLER);
+
+G_DEFINE_TYPE (PhotosOffsetFavoritesController, photos_offset_favorites_controller, 
PHOTOS_TYPE_OFFSET_CONTROLLER);
 
 
 static PhotosQuery *
 photos_offset_favorites_controller_get_query (PhotosOffsetController *offset_cntrlr)
 {
   PhotosOffsetFavoritesController *self = PHOTOS_OFFSET_FAVORITES_CONTROLLER (offset_cntrlr);
-  PhotosOffsetFavoritesControllerPrivate *priv = self->priv;
   GApplication *app;
   PhotosBaseItem *collection;
   PhotosSearchContextState *state;
   gint flags;
 
-  g_return_val_if_fail (priv->item_mngr != NULL, NULL);
+  g_return_val_if_fail (self->item_mngr != NULL, NULL);
 
-  collection = photos_item_manager_get_active_collection (PHOTOS_ITEM_MANAGER (priv->item_mngr));
+  collection = photos_item_manager_get_active_collection (PHOTOS_ITEM_MANAGER (self->item_mngr));
   if (collection != NULL)
     flags = PHOTOS_QUERY_FLAGS_NONE;
   else
@@ -93,10 +96,9 @@ static void
 photos_offset_favorites_controller_finalize (GObject *object)
 {
   PhotosOffsetFavoritesController *self = PHOTOS_OFFSET_FAVORITES_CONTROLLER (object);
-  PhotosOffsetFavoritesControllerPrivate *priv = self->priv;
 
-  if (priv->item_mngr != NULL)
-    g_object_remove_weak_pointer (G_OBJECT (priv->item_mngr), (gpointer *) &priv->item_mngr);
+  if (self->item_mngr != NULL)
+    g_object_remove_weak_pointer (G_OBJECT (self->item_mngr), (gpointer *) &self->item_mngr);
 
   G_OBJECT_CLASS (photos_offset_favorites_controller_parent_class)->finalize (object);
 }
@@ -105,18 +107,14 @@ photos_offset_favorites_controller_finalize (GObject *object)
 static void
 photos_offset_favorites_controller_init (PhotosOffsetFavoritesController *self)
 {
-  PhotosOffsetFavoritesControllerPrivate *priv;
   GApplication *app;
   PhotosSearchContextState *state;
 
-  self->priv = photos_offset_favorites_controller_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 = state->item_mngr;
-  g_object_add_weak_pointer (G_OBJECT (priv->item_mngr), (gpointer *) &priv->item_mngr);
+  self->item_mngr = state->item_mngr;
+  g_object_add_weak_pointer (G_OBJECT (self->item_mngr), (gpointer *) &self->item_mngr);
 }
 
 
diff --git a/src/photos-offset-favorites-controller.h b/src/photos-offset-favorites-controller.h
index 663ec56..1f6efa9 100644
--- a/src/photos-offset-favorites-controller.h
+++ b/src/photos-offset-favorites-controller.h
@@ -35,36 +35,12 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
    PHOTOS_TYPE_OFFSET_FAVORITES_CONTROLLER, PhotosOffsetFavoritesController))
 
-#define PHOTOS_OFFSET_FAVORITES_CONTROLLER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-   PHOTOS_TYPE_OFFSET_FAVORITES_CONTROLLER, PhotosOffsetFavoritesControllerClass))
-
 #define PHOTOS_IS_OFFSET_FAVORITES_CONTROLLER(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
    PHOTOS_TYPE_OFFSET_FAVORITES_CONTROLLER))
 
-#define PHOTOS_IS_OFFSET_FAVORITES_CONTROLLER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-   PHOTOS_TYPE_OFFSET_FAVORITES_CONTROLLER))
-
-#define PHOTOS_OFFSET_FAVORITES_CONTROLLER_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-   PHOTOS_TYPE_OFFSET_FAVORITES_CONTROLLER, PhotosOffsetFavoritesControllerClass))
-
-typedef struct _PhotosOffsetFavoritesController        PhotosOffsetFavoritesController;
-typedef struct _PhotosOffsetFavoritesControllerClass   PhotosOffsetFavoritesControllerClass;
-typedef struct _PhotosOffsetFavoritesControllerPrivate PhotosOffsetFavoritesControllerPrivate;
-
-struct _PhotosOffsetFavoritesController
-{
-  PhotosOffsetController parent_instance;
-  PhotosOffsetFavoritesControllerPrivate *priv;
-};
-
-struct _PhotosOffsetFavoritesControllerClass
-{
-  PhotosOffsetControllerClass parent_class;
-};
+typedef struct _PhotosOffsetFavoritesController      PhotosOffsetFavoritesController;
+typedef struct _PhotosOffsetFavoritesControllerClass PhotosOffsetFavoritesControllerClass;
 
 GType                    photos_offset_favorites_controller_get_type          (void) G_GNUC_CONST;
 


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