[gnome-photos/wip/search: 19/27] Add PhotosOffsetSearchController



commit 09c24c467d8396da48ec7cd73584cda36c567f15
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 24 10:23:14 2014 +0100

    Add PhotosOffsetSearchController

 src/Makefile.am                       |    2 +
 src/photos-offset-search-controller.c |   83 +++++++++++++++++++++++++++++++++
 src/photos-offset-search-controller.h |   73 +++++++++++++++++++++++++++++
 3 files changed, 158 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 31af6f8..64bec57 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -134,6 +134,8 @@ gnome_photos_SOURCES = \
        photos-offset-favorites-controller.h \
        photos-offset-overview-controller.c \
        photos-offset-overview-controller.h \
+       photos-offset-search-controller.c \
+       photos-offset-search-controller.h \
        photos-organize-collection-dialog.c \
        photos-organize-collection-dialog.h \
        photos-organize-collection-model.c \
diff --git a/src/photos-offset-search-controller.c b/src/photos-offset-search-controller.c
new file mode 100644
index 0000000..e4c9e56
--- /dev/null
+++ b/src/photos-offset-search-controller.c
@@ -0,0 +1,83 @@
+/*
+ * 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-query-builder.h"
+#include "photos-offset-search-controller.h"
+
+
+G_DEFINE_TYPE (PhotosOffsetSearchController, photos_offset_search_controller, PHOTOS_TYPE_OFFSET_CONTROLLER);
+
+
+static PhotosQuery *
+photos_offset_search_controller_get_query (PhotosOffsetController *offset_cntrlr)
+{
+  return photos_query_builder_count_query (PHOTOS_QUERY_FLAGS_SEARCH);
+}
+
+
+static GObject *
+photos_offset_search_controller_constructor (GType type,
+                                             guint n_construct_params,
+                                             GObjectConstructParam *construct_params)
+{
+  static GObject *self = NULL;
+
+  if (self == NULL)
+    {
+      self = G_OBJECT_CLASS (photos_offset_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_offset_search_controller_init (PhotosOffsetSearchController *self)
+{
+}
+
+
+static void
+photos_offset_search_controller_class_init (PhotosOffsetSearchControllerClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  PhotosOffsetControllerClass *offset_controller_class = PHOTOS_OFFSET_CONTROLLER_CLASS (class);
+
+  object_class->constructor = photos_offset_search_controller_constructor;
+  offset_controller_class->get_query = photos_offset_search_controller_get_query;
+}
+
+
+PhotosOffsetController *
+photos_offset_search_controller_dup_singleton (void)
+{
+  return g_object_new (PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER, NULL);
+}
diff --git a/src/photos-offset-search-controller.h b/src/photos-offset-search-controller.h
new file mode 100644
index 0000000..4d45d24
--- /dev/null
+++ b/src/photos-offset-search-controller.h
@@ -0,0 +1,73 @@
+/*
+ * 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_OFFSET_SEARCH_CONTROLLER_H
+#define PHOTOS_OFFSET_SEARCH_CONTROLLER_H
+
+#include "photos-offset-controller.h"
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER (photos_offset_search_controller_get_type ())
+
+#define PHOTOS_OFFSET_SEARCH_CONTROLLER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER, PhotosOffsetSearchController))
+
+#define PHOTOS_OFFSET_SEARCH_CONTROLLER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER, PhotosOffsetSearchControllerClass))
+
+#define PHOTOS_IS_OFFSET_SEARCH_CONTROLLER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER))
+
+#define PHOTOS_IS_OFFSET_SEARCH_CONTROLLER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER))
+
+#define PHOTOS_OFFSET_SEARCH_CONTROLLER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   PHOTOS_TYPE_OFFSET_SEARCH_CONTROLLER, PhotosOffsetSearchControllerClass))
+
+typedef struct _PhotosOffsetSearchController        PhotosOffsetSearchController;
+typedef struct _PhotosOffsetSearchControllerClass   PhotosOffsetSearchControllerClass;
+
+struct _PhotosOffsetSearchController
+{
+  PhotosOffsetController parent_instance;
+};
+
+struct _PhotosOffsetSearchControllerClass
+{
+  PhotosOffsetControllerClass parent_class;
+};
+
+GType                    photos_offset_search_controller_get_type          (void) G_GNUC_CONST;
+
+PhotosOffsetController  *photos_offset_search_controller_dup_singleton     (void);
+
+G_END_DECLS
+
+#endif /* PHOTOS_OFFSET_SEARCH_CONTROLLER_H */


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