[gnome-photos] tracker-search-controller: Make it a final class
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] tracker-search-controller: Make it a final class
- Date: Wed, 27 Jan 2016 10:45:35 +0000 (UTC)
commit cacab037ca9525a3b3c385aabc8dfb0353444541
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jan 26 10:53:00 2016 +0100
tracker-search-controller: Make it a final class
src/photos-tracker-search-controller.c | 74 +++++++++++++++----------------
src/photos-tracker-search-controller.h | 28 +-----------
2 files changed, 38 insertions(+), 64 deletions(-)
---
diff --git a/src/photos-tracker-search-controller.c b/src/photos-tracker-search-controller.c
index fc82c0a..bfa6161 100644
--- a/src/photos-tracker-search-controller.c
+++ b/src/photos-tracker-search-controller.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2014, 2015 Red Hat, Inc.
+ * Copyright © 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
@@ -37,8 +37,9 @@
#include "photos-utils.h"
-struct _PhotosTrackerSearchControllerPrivate
+struct _PhotosTrackerSearchController
{
+ PhotosTrackerController parent_instance;
PhotosBaseManager *item_mngr;
PhotosBaseManager *src_mngr;
PhotosBaseManager *srch_mtch_mngr;
@@ -48,11 +49,15 @@ struct _PhotosTrackerSearchControllerPrivate
PhotosSearchController *srch_cntrlr;
};
+struct _PhotosTrackerSearchControllerClass
+{
+ PhotosTrackerControllerClass parent_class;
+};
+
G_DEFINE_TYPE_WITH_CODE (PhotosTrackerSearchController,
photos_tracker_search_controller,
PHOTOS_TYPE_TRACKER_CONTROLLER,
- G_ADD_PRIVATE (PhotosTrackerSearchController)
photos_utils_ensure_extension_points ();
g_io_extension_point_implement (PHOTOS_TRACKER_CONTROLLER_EXTENSION_POINT_NAME,
g_define_type_id,
@@ -63,12 +68,11 @@ G_DEFINE_TYPE_WITH_CODE (PhotosTrackerSearchController,
static void
photos_tracker_search_controller_col_active_changed (PhotosTrackerSearchController *self)
{
- PhotosTrackerSearchControllerPrivate *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_SEARCH)
return;
@@ -80,7 +84,7 @@ static PhotosOffsetController *
photos_tracker_search_controller_get_offset_controller (PhotosTrackerController *trk_cntrlr)
{
PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (trk_cntrlr);
- return g_object_ref (self->priv->offset_cntrlr);
+ return g_object_ref (self->offset_cntrlr);
}
@@ -94,7 +98,7 @@ photos_tracker_search_controller_get_query (PhotosTrackerController *trk_cntrlr)
app = g_application_get_default ();
state = photos_search_context_get_state (PHOTOS_SEARCH_CONTEXT (app));
- return photos_query_builder_global_query (state, PHOTOS_QUERY_FLAGS_SEARCH, self->priv->offset_cntrlr);
+ return photos_query_builder_global_query (state, PHOTOS_QUERY_FLAGS_SEARCH, self->offset_cntrlr);
}
@@ -103,7 +107,7 @@ photos_tracker_search_controller_search_match_active_changed (PhotosTrackerSearc
{
const gchar *str;
- str = photos_search_controller_get_string (self->priv->srch_cntrlr);
+ str = photos_search_controller_get_string (self->srch_cntrlr);
if (str == NULL || str[0] == '\0')
return;
@@ -135,13 +139,12 @@ static void
photos_tracker_search_controller_dispose (GObject *object)
{
PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (object);
- PhotosTrackerSearchControllerPrivate *priv = self->priv;
- g_clear_object (&priv->src_mngr);
- g_clear_object (&priv->srch_mtch_mngr);
- g_clear_object (&priv->srch_typ_mngr);
- g_clear_object (&priv->offset_cntrlr);
- g_clear_object (&priv->srch_cntrlr);
+ g_clear_object (&self->src_mngr);
+ g_clear_object (&self->srch_mtch_mngr);
+ g_clear_object (&self->srch_typ_mngr);
+ g_clear_object (&self->offset_cntrlr);
+ g_clear_object (&self->srch_cntrlr);
G_OBJECT_CLASS (photos_tracker_search_controller_parent_class)->dispose (object);
}
@@ -151,13 +154,12 @@ static void
photos_tracker_search_controller_finalize (GObject *object)
{
PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (object);
- PhotosTrackerSearchControllerPrivate *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_search_controller_parent_class)->finalize (object);
}
@@ -166,48 +168,44 @@ photos_tracker_search_controller_finalize (GObject *object)
static void
photos_tracker_search_controller_init (PhotosTrackerSearchController *self)
{
- PhotosTrackerSearchControllerPrivate *priv;
GApplication *app;
PhotosSearchContextState *state;
- self->priv = photos_tracker_search_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_search_controller_col_active_changed),
self);
- priv->src_mngr = g_object_ref (state->src_mngr);
- g_signal_connect_swapped (priv->src_mngr,
+ self->src_mngr = g_object_ref (state->src_mngr);
+ g_signal_connect_swapped (self->src_mngr,
"active-changed",
G_CALLBACK (photos_tracker_controller_refresh_for_object),
self);
- priv->srch_mtch_mngr = g_object_ref (state->srch_mtch_mngr);
- g_signal_connect_swapped (priv->srch_mtch_mngr,
+ self->srch_mtch_mngr = g_object_ref (state->srch_mtch_mngr);
+ g_signal_connect_swapped (self->srch_mtch_mngr,
"active-changed",
G_CALLBACK (photos_tracker_search_controller_search_match_active_changed),
self);
- priv->srch_typ_mngr = g_object_ref (state->srch_typ_mngr);
- g_signal_connect_swapped (priv->srch_typ_mngr,
+ self->srch_typ_mngr = g_object_ref (state->srch_typ_mngr);
+ g_signal_connect_swapped (self->srch_typ_mngr,
"active-changed",
G_CALLBACK (photos_tracker_controller_refresh_for_object),
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_search_controller_dup_singleton ();
+ self->offset_cntrlr = photos_offset_search_controller_dup_singleton ();
- priv->srch_cntrlr = g_object_ref (state->srch_cntrlr);
- g_signal_connect_swapped (priv->srch_cntrlr,
+ self->srch_cntrlr = g_object_ref (state->srch_cntrlr);
+ g_signal_connect_swapped (self->srch_cntrlr,
"search-string-changed",
G_CALLBACK (photos_tracker_controller_refresh_for_object),
self);
diff --git a/src/photos-tracker-search-controller.h b/src/photos-tracker-search-controller.h
index d307920..571a16e 100644
--- a/src/photos-tracker-search-controller.h
+++ b/src/photos-tracker-search-controller.h
@@ -35,36 +35,12 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \
PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER, PhotosTrackerSearchController))
-#define PHOTOS_TRACKER_SEARCH_CONTROLLER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), \
- PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER, PhotosTrackerSearchControllerClass))
-
#define PHOTOS_IS_TRACKER_SEARCH_CONTROLLER(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER))
-#define PHOTOS_IS_TRACKER_SEARCH_CONTROLLER_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), \
- PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER))
-
-#define PHOTOS_TRACKER_SEARCH_CONTROLLER_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), \
- PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER, PhotosTrackerSearchControllerClass))
-
-typedef struct _PhotosTrackerSearchController PhotosTrackerSearchController;
-typedef struct _PhotosTrackerSearchControllerClass PhotosTrackerSearchControllerClass;
-typedef struct _PhotosTrackerSearchControllerPrivate PhotosTrackerSearchControllerPrivate;
-
-struct _PhotosTrackerSearchController
-{
- PhotosTrackerController parent_instance;
- PhotosTrackerSearchControllerPrivate *priv;
-};
-
-struct _PhotosTrackerSearchControllerClass
-{
- PhotosTrackerControllerClass parent_class;
-};
+typedef struct _PhotosTrackerSearchController PhotosTrackerSearchController;
+typedef struct _PhotosTrackerSearchControllerClass PhotosTrackerSearchControllerClass;
GType photos_tracker_search_controller_get_type (void) G_GNUC_CONST;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]