[gnome-photos/wip/search: 1/6] Add PhotosSearchContext



commit 45a34f5d3a082409c6d3f3fb5e4ac1668c63398d
Author: Debarshi Ray <debarshir gnome org>
Date:   Sun Dec 1 01:14:52 2013 +0100

    Add PhotosSearchContext
    
    This is an interface that is to be implemented by PhotosApplication
    and the future PhotosShellSearchProvider.

 src/Makefile.am             |    2 +
 src/photos-search-context.c |   71 ++++++++++++++++++++++++++++++++++++++++
 src/photos-search-context.h |   76 +++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index cb1f276..4bcdec4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -152,6 +152,8 @@ gnome_photos_SOURCES = \
        photos-query-builder.c \
        photos-remote-display-manager.c \
        photos-remote-display-manager.h \
+       photos-search-context.c \
+       photos-search-context.h \
        photos-search-controller.c \
        photos-search-controller.h \
        photos-search-type.c \
diff --git a/src/photos-search-context.c b/src/photos-search-context.c
new file mode 100644
index 0000000..fb32df2
--- /dev/null
+++ b/src/photos-search-context.c
@@ -0,0 +1,71 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2013 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 <glib.h>
+
+#include "photos-search-context.h"
+
+
+G_DEFINE_INTERFACE (PhotosSearchContext, photos_search_context, G_TYPE_INVALID);
+
+
+static void
+photos_search_context_default_init (PhotosSearchContextInterface *iface)
+{
+}
+
+
+PhotosBaseManager *
+photos_search_context_get_collection_manager (PhotosSearchContext *iface)
+{
+  g_return_val_if_fail (PHOTOS_IS_SEARCH_CONTEXT (iface), NULL);
+  return PHOTOS_SEARCH_CONTEXT_GET_INTERFACE (iface)->get_collection_manager (iface);
+}
+
+
+PhotosBaseManager *
+photos_search_context_get_source_manager (PhotosSearchContext *iface)
+{
+  g_return_val_if_fail (PHOTOS_IS_SEARCH_CONTEXT (iface), NULL);
+  return PHOTOS_SEARCH_CONTEXT_GET_INTERFACE (iface)->get_source_manager (iface);
+}
+
+
+void
+photos_search_context_set_collection_manager (PhotosSearchContext *iface, PhotosBaseManager *col_mngr)
+{
+  g_return_if_fail (PHOTOS_IS_SEARCH_CONTEXT (iface));
+  PHOTOS_SEARCH_CONTEXT_GET_INTERFACE (iface)->set_collection_manager (iface, col_mngr);
+}
+
+
+void
+photos_search_context_set_source_manager (PhotosSearchContext *iface, PhotosBaseManager *src_mngr)
+{
+  g_return_if_fail (PHOTOS_IS_SEARCH_CONTEXT (iface));
+  PHOTOS_SEARCH_CONTEXT_GET_INTERFACE (iface)->set_source_manager (iface, src_mngr);
+}
diff --git a/src/photos-search-context.h b/src/photos-search-context.h
new file mode 100644
index 0000000..7f3eefb
--- /dev/null
+++ b/src/photos-search-context.h
@@ -0,0 +1,76 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2013 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_SEARCH_CONTEXT_H
+#define PHOTOS_SEARCH_CONTEXT_H
+
+#include <glib-object.h>
+
+#include "photos-base-manager.h"
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_SEARCH_CONTEXT (photos_search_context_get_type ())
+
+#define PHOTOS_SEARCH_CONTEXT(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_SEARCH_CONTEXT, PhotosSearchContext))
+
+#define PHOTOS_IS_SEARCH_CONTEXT(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_SEARCH_CONTEXT))
+
+#define PHOTOS_SEARCH_CONTEXT_GET_INTERFACE(inst) \
+  (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
+   PHOTOS_TYPE_SEARCH_CONTEXT, PhotosSearchContextInterface))
+
+typedef struct _PhotosSearchContext          PhotosSearchContext;
+typedef struct _PhotosSearchContextInterface PhotosSearchContextInterface;
+
+struct _PhotosSearchContextInterface
+{
+  GTypeInterface parent_iface;
+
+  /* virtual methods */
+  PhotosBaseManager *(*get_collection_manager) (PhotosSearchContext *self);
+  PhotosBaseManager *(*get_source_manager) (PhotosSearchContext *self);
+  void (*set_collection_manager) (PhotosSearchContext *self, PhotosBaseManager *col_mngr);
+  void (*set_source_manager) (PhotosSearchContext *self, PhotosBaseManager *col_mngr);
+};
+
+GType                 photos_search_context_get_type                  (void) G_GNUC_CONST;
+
+PhotosBaseManager    *photos_search_context_get_collection_manager    (PhotosSearchContext *iface);
+
+PhotosBaseManager    *photos_search_context_get_source_manager        (PhotosSearchContext *iface);
+
+void                  photos_search_context_set_collection_manager    (PhotosSearchContext *iface,
+                                                                       PhotosBaseManager *col_mngr);
+
+void                  photos_search_context_set_source_manager        (PhotosSearchContext *iface,
+                                                                       PhotosBaseManager *src_mngr);
+
+G_END_DECLS
+
+#endif /* PHOTOS_SEARCH_CONTEXT_H */


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