[gnome-photos/wip/search: 18/35] Add PhotosTrackerSearchController
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/search: 18/35] Add PhotosTrackerSearchController
- Date: Tue, 28 Jan 2014 17:50:08 +0000 (UTC)
commit 105e6e524c9a663351af9458b4bab8553347e5b4
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Jan 24 10:17:29 2014 +0100
Add PhotosTrackerSearchController
src/Makefile.am | 2 +
src/photos-tracker-search-controller.c | 121 ++++++++++++++++++++++++++++++++
src/photos-tracker-search-controller.h | 75 ++++++++++++++++++++
3 files changed, 198 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index bfccfee..31af6f8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -200,6 +200,8 @@ gnome_photos_SOURCES = \
photos-tracker-favorites-controller.h \
photos-tracker-overview-controller.c \
photos-tracker-overview-controller.h \
+ photos-tracker-search-controller.c \
+ photos-tracker-search-controller.h \
photos-tracker-queue.c \
photos-tracker-queue.h \
photos-update-mtime-job.c \
diff --git a/src/photos-tracker-search-controller.c b/src/photos-tracker-search-controller.c
new file mode 100644
index 0000000..ec3ce5b
--- /dev/null
+++ b/src/photos-tracker-search-controller.c
@@ -0,0 +1,121 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2014 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
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/* Based on code from:
+ * + Documents
+ */
+
+
+#include "config.h"
+
+#include "photos-mode-controller.h"
+#include "photos-offset-search-controller.h"
+#include "photos-query-builder.h"
+#include "photos-tracker-search-controller.h"
+
+
+struct _PhotosTrackerSearchControllerPrivate
+{
+ PhotosOffsetController *offset_cntrlr;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (PhotosTrackerSearchController,
+ photos_tracker_search_controller,
+ PHOTOS_TYPE_TRACKER_CONTROLLER);
+
+
+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);
+}
+
+
+static PhotosQuery *
+photos_tracker_search_controller_get_query (PhotosTrackerController *trk_cntrlr)
+{
+ PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (trk_cntrlr);
+ return photos_query_builder_global_query (PHOTOS_QUERY_FLAGS_SEARCH, self->priv->offset_cntrlr);
+}
+
+
+static GObject *
+photos_tracker_search_controller_constructor (GType type,
+ guint n_construct_params,
+ GObjectConstructParam *construct_params)
+{
+ static GObject *self = NULL;
+
+ if (self == NULL)
+ {
+ self = G_OBJECT_CLASS (photos_tracker_search_controller_parent_class)->constructor (type,
+ n_construct_params,
+ construct_params);
+ g_object_add_weak_pointer (self, (gpointer) &self);
+ return self;
+ }
+
+ return g_object_ref (self);
+}
+
+
+static void
+photos_tracker_search_controller_dispose (GObject *object)
+{
+ PhotosTrackerSearchController *self = PHOTOS_TRACKER_SEARCH_CONTROLLER (object);
+
+ g_clear_object (&self->priv->offset_cntrlr);
+
+ G_OBJECT_CLASS (photos_tracker_search_controller_parent_class)->dispose (object);
+}
+
+
+static void
+photos_tracker_search_controller_init (PhotosTrackerSearchController *self)
+{
+ PhotosTrackerSearchControllerPrivate *priv;
+
+ self->priv = photos_tracker_search_controller_get_instance_private (self);
+ priv = self->priv;
+
+ priv->offset_cntrlr = photos_offset_search_controller_dup_singleton ();
+}
+
+
+static void
+photos_tracker_search_controller_class_init (PhotosTrackerSearchControllerClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+ PhotosTrackerControllerClass *tracker_controller_class = PHOTOS_TRACKER_CONTROLLER_CLASS (class);
+
+ object_class->constructor = photos_tracker_search_controller_constructor;
+ object_class->dispose = photos_tracker_search_controller_dispose;
+ tracker_controller_class->get_offset_controller = photos_tracker_search_controller_get_offset_controller;
+ tracker_controller_class->get_query = photos_tracker_search_controller_get_query;
+}
+
+
+PhotosTrackerController *
+photos_tracker_search_controller_dup_singleton (void)
+{
+ return g_object_new (PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER, "mode", PHOTOS_WINDOW_MODE_SEARCH, NULL);
+}
diff --git a/src/photos-tracker-search-controller.h b/src/photos-tracker-search-controller.h
new file mode 100644
index 0000000..d307920
--- /dev/null
+++ b/src/photos-tracker-search-controller.h
@@ -0,0 +1,75 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2014 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
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+/* Based on code from:
+ * + Documents
+ */
+
+#ifndef PHOTOS_TRACKER_SEARCH_CONTROLLER_H
+#define PHOTOS_TRACKER_SEARCH_CONTROLLER_H
+
+#include "photos-tracker-controller.h"
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_TRACKER_SEARCH_CONTROLLER (photos_tracker_search_controller_get_type ())
+
+#define PHOTOS_TRACKER_SEARCH_CONTROLLER(obj) \
+ (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;
+};
+
+GType photos_tracker_search_controller_get_type (void) G_GNUC_CONST;
+
+PhotosTrackerController *photos_tracker_search_controller_dup_singleton (void);
+
+G_END_DECLS
+
+#endif /* PHOTOS_TRACKER_SEARCH_CONTROLLER_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]