[gnome-photos/wip/rishi/crop: 1/5] tracker-favorites-controller: Make it a final class



commit b929e38b735c00e8c15a2bff1d76529b015224d0
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Jan 26 10:48:45 2016 +0100

    tracker-favorites-controller: Make it a final class

 src/photos-tracker-favorites-controller.c |   52 ++++++++++++++---------------
 src/photos-tracker-favorites-controller.h |   28 +--------------
 2 files changed, 27 insertions(+), 53 deletions(-)
---
diff --git a/src/photos-tracker-favorites-controller.c b/src/photos-tracker-favorites-controller.c
index d14062e..625de5e 100644
--- a/src/photos-tracker-favorites-controller.c
+++ b/src/photos-tracker-favorites-controller.c
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014, 2015, 2016 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
@@ -31,18 +31,23 @@
 #include "photos-utils.h"
 
 
-struct _PhotosTrackerFavoritesControllerPrivate
+struct _PhotosTrackerFavoritesController
 {
+  PhotosTrackerController parent_instance;
   PhotosBaseManager *item_mngr;
   PhotosModeController *mode_cntrlr;
   PhotosOffsetController *offset_cntrlr;
 };
 
+struct _PhotosTrackerFavoritesControllerClass
+{
+  PhotosTrackerControllerClass parent_class;
+};
+
 
 G_DEFINE_TYPE_WITH_CODE (PhotosTrackerFavoritesController,
                          photos_tracker_favorites_controller,
                          PHOTOS_TYPE_TRACKER_CONTROLLER,
-                         G_ADD_PRIVATE (PhotosTrackerFavoritesController)
                          photos_utils_ensure_extension_points ();
                          g_io_extension_point_implement (PHOTOS_TRACKER_CONTROLLER_EXTENSION_POINT_NAME,
                                                          g_define_type_id,
@@ -53,12 +58,11 @@ G_DEFINE_TYPE_WITH_CODE (PhotosTrackerFavoritesController,
 static void
 photos_tracker_favorites_controller_col_active_changed (PhotosTrackerFavoritesController *self)
 {
-  PhotosTrackerFavoritesControllerPrivate *priv = self->priv;
   PhotosWindowMode mode;
 
-  g_return_if_fail (priv->mode_cntrlr != NULL);
+  g_return_if_fail (self->mode_cntrlr != NULL);
 
-  mode = photos_mode_controller_get_window_mode (priv->mode_cntrlr);
+  mode = photos_mode_controller_get_window_mode (self->mode_cntrlr);
   if (mode != PHOTOS_WINDOW_MODE_FAVORITES)
     return;
 
@@ -70,7 +74,7 @@ static PhotosOffsetController *
 photos_tracker_favorites_controller_get_offset_controller (PhotosTrackerController *trk_cntrlr)
 {
   PhotosTrackerFavoritesController *self = PHOTOS_TRACKER_FAVORITES_CONTROLLER (trk_cntrlr);
-  return g_object_ref (self->priv->offset_cntrlr);
+  return g_object_ref (self->offset_cntrlr);
 }
 
 
@@ -78,15 +82,14 @@ static PhotosQuery *
 photos_tracker_favorites_controller_get_query (PhotosTrackerController *trk_cntrlr)
 {
   PhotosTrackerFavoritesController *self = PHOTOS_TRACKER_FAVORITES_CONTROLLER (trk_cntrlr);
-  PhotosTrackerFavoritesControllerPrivate *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
@@ -95,7 +98,7 @@ photos_tracker_favorites_controller_get_query (PhotosTrackerController *trk_cntr
   app = g_application_get_default ();
   state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
 
-  return photos_query_builder_global_query (state, flags, priv->offset_cntrlr);
+  return photos_query_builder_global_query (state, flags, self->offset_cntrlr);
 }
 
 
@@ -124,7 +127,7 @@ photos_tracker_favorites_controller_dispose (GObject *object)
 {
   PhotosTrackerFavoritesController *self = PHOTOS_TRACKER_FAVORITES_CONTROLLER (object);
 
-  g_clear_object (&self->priv->offset_cntrlr);
+  g_clear_object (&self->offset_cntrlr);
 
   G_OBJECT_CLASS (photos_tracker_favorites_controller_parent_class)->dispose (object);
 }
@@ -134,13 +137,12 @@ static void
 photos_tracker_favorites_controller_finalize (GObject *object)
 {
   PhotosTrackerFavoritesController *self = PHOTOS_TRACKER_FAVORITES_CONTROLLER (object);
-  PhotosTrackerFavoritesControllerPrivate *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);
 
-  if (priv->mode_cntrlr != NULL)
-    g_object_remove_weak_pointer (G_OBJECT (priv->mode_cntrlr), (gpointer *) &priv->mode_cntrlr);
+  if (self->mode_cntrlr != NULL)
+    g_object_remove_weak_pointer (G_OBJECT (self->mode_cntrlr), (gpointer *) &self->mode_cntrlr);
 
   G_OBJECT_CLASS (photos_tracker_favorites_controller_parent_class)->finalize (object);
 }
@@ -149,27 +151,23 @@ photos_tracker_favorites_controller_finalize (GObject *object)
 static void
 photos_tracker_favorites_controller_init (PhotosTrackerFavoritesController *self)
 {
-  PhotosTrackerFavoritesControllerPrivate *priv;
   GApplication *app;
   PhotosSearchContextState *state;
 
-  self->priv = photos_tracker_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);
-  g_signal_connect_swapped (priv->item_mngr,
+  self->item_mngr = state->item_mngr;
+  g_object_add_weak_pointer (G_OBJECT (self->item_mngr), (gpointer *) &self->item_mngr);
+  g_signal_connect_swapped (self->item_mngr,
                             "active-collection-changed",
                             G_CALLBACK (photos_tracker_favorites_controller_col_active_changed),
                             self);
 
-  priv->mode_cntrlr = state->mode_cntrlr;
-  g_object_add_weak_pointer (G_OBJECT (priv->mode_cntrlr), (gpointer *) &priv->mode_cntrlr);
+  self->mode_cntrlr = state->mode_cntrlr;
+  g_object_add_weak_pointer (G_OBJECT (self->mode_cntrlr), (gpointer *) &self->mode_cntrlr);
 
-  priv->offset_cntrlr = photos_offset_favorites_controller_dup_singleton ();
+  self->offset_cntrlr = photos_offset_favorites_controller_dup_singleton ();
 }
 
 
diff --git a/src/photos-tracker-favorites-controller.h b/src/photos-tracker-favorites-controller.h
index 6d3437c..1267dc0 100644
--- a/src/photos-tracker-favorites-controller.h
+++ b/src/photos-tracker-favorites-controller.h
@@ -31,36 +31,12 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
    PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER, PhotosTrackerFavoritesController))
 
-#define PHOTOS_TRACKER_FAVORITES_CONTROLLER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_CAST ((klass), \
-   PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER, PhotosTrackerFavoritesControllerClass))
-
 #define PHOTOS_IS_TRACKER_FAVORITES_CONTROLLER(obj) \
   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
    PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER))
 
-#define PHOTOS_IS_TRACKER_FAVORITES_CONTROLLER_CLASS(klass) \
-  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
-   PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER))
-
-#define PHOTOS_TRACKER_FAVORITES_CONTROLLER_GET_CLASS(obj) \
-  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
-   PHOTOS_TYPE_TRACKER_FAVORITES_CONTROLLER, PhotosTrackerFavoritesControllerClass))
-
-typedef struct _PhotosTrackerFavoritesController        PhotosTrackerFavoritesController;
-typedef struct _PhotosTrackerFavoritesControllerClass   PhotosTrackerFavoritesControllerClass;
-typedef struct _PhotosTrackerFavoritesControllerPrivate PhotosTrackerFavoritesControllerPrivate;
-
-struct _PhotosTrackerFavoritesController
-{
-  PhotosTrackerController parent_instance;
-  PhotosTrackerFavoritesControllerPrivate *priv;
-};
-
-struct _PhotosTrackerFavoritesControllerClass
-{
-  PhotosTrackerControllerClass parent_class;
-};
+typedef struct _PhotosTrackerFavoritesController      PhotosTrackerFavoritesController;
+typedef struct _PhotosTrackerFavoritesControllerClass PhotosTrackerFavoritesControllerClass;
 
 GType                     photos_tracker_favorites_controller_get_type          (void) G_GNUC_CONST;
 


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