[gnome-photos] Add PhotosSearchTypeManager



commit edc59962a3c4a6b535555d8d18c04a1c2bf33af7
Author: Debarshi Ray <debarshir gnome org>
Date:   Sat May 12 18:02:20 2012 +0200

    Add PhotosSearchTypeManager

 src/Makefile.am                  |    2 +
 src/photos-search-type-manager.c |   86 ++++++++++++++++++++++++++++++++++++++
 src/photos-search-type-manager.h |   71 +++++++++++++++++++++++++++++++
 3 files changed, 159 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 88c65be..8dae625 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -63,6 +63,8 @@ gnome_photos_SOURCES = \
 	photos-query-builder.c \
 	photos-search-type.c \
 	photos-search-type.h \
+	photos-search-type-manager.c \
+	photos-search-type-manager.h \
 	photos-selection-controller.c \
 	photos-selection-controller.h \
 	photos-selection-toolbar.c \
diff --git a/src/photos-search-type-manager.c b/src/photos-search-type-manager.c
new file mode 100644
index 0000000..92c1402
--- /dev/null
+++ b/src/photos-search-type-manager.c
@@ -0,0 +1,86 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright  2012 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.
+ */
+
+
+#include "config.h"
+
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "photos-search-type.h"
+#include "photos-search-type-manager.h"
+
+
+G_DEFINE_TYPE (PhotosSearchTypeManager, photos_search_type_manager, PHOTOS_TYPE_BASE_MANAGER);
+
+
+static GObject *
+photos_search_type_manager_constructor (GType                  type,
+                                        guint                  n_construct_params,
+                                        GObjectConstructParam *construct_params)
+{
+  static GObject *self = NULL;
+
+  if (self == NULL)
+    {
+      self = G_OBJECT_CLASS (photos_search_type_manager_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_search_type_manager_init (PhotosSearchTypeManager *self)
+{
+  PhotosSearchType *search_type;
+
+  search_type = photos_search_type_new (PHOTOS_SEARCH_TYPE_STOCK_ALL, _("All"));
+  photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (search_type));
+  g_object_unref (search_type);
+
+  search_type = photos_search_type_new_with_filter (PHOTOS_SEARCH_TYPE_STOCK_PHOTOS,
+                                                    _("Photos"),
+                                                    "fn:contains (rdf:type (?urn), 'nmm#Photo')");
+  photos_base_manager_add_object (PHOTOS_BASE_MANAGER (self), G_OBJECT (search_type));
+  g_object_unref (search_type);
+
+  photos_base_manager_set_active_object_by_id (PHOTOS_BASE_MANAGER (self), PHOTOS_SEARCH_TYPE_STOCK_ALL);
+}
+
+
+static void
+photos_search_type_manager_class_init (PhotosSearchTypeManagerClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+  object_class->constructor = photos_search_type_manager_constructor;
+}
+
+
+PhotosBaseManager *
+photos_search_type_manager_new (void)
+{
+  return g_object_new (PHOTOS_TYPE_SEARCH_TYPE_MANAGER, NULL);
+}
diff --git a/src/photos-search-type-manager.h b/src/photos-search-type-manager.h
new file mode 100644
index 0000000..39c4a8e
--- /dev/null
+++ b/src/photos-search-type-manager.h
@@ -0,0 +1,71 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright  2012 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.
+ */
+
+#ifndef PHOTOS_SEARCH_TYPE_MANAGER_H
+#define PHOTOS_SEARCH_TYPE_MANAGER_H
+
+#include "photos-base-manager.h"
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_SEARCH_TYPE_MANAGER (photos_search_type_manager_get_type ())
+
+#define PHOTOS_SEARCH_TYPE_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_SEARCH_TYPE_MANAGER, PhotosSearchTypeManager))
+
+#define PHOTOS_SEARCH_TYPE_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   PHOTOS_TYPE_SEARCH_TYPE_MANAGER, PhotosSearchTypeManagerClass))
+
+#define PHOTOS_IS_SEARCH_TYPE_MANAGER(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_SEARCH_TYPE_MANAGER))
+
+#define PHOTOS_IS_SEARCH_TYPE_MANAGER_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   PHOTOS_TYPE_SEARCH_TYPE_MANAGER))
+
+#define PHOTOS_SEARCH_TYPE_MANAGER_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   PHOTOS_TYPE_SEARCH_TYPE_MANAGER, PhotosSearchTypeManagerClass))
+
+typedef struct _PhotosSearchTypeManager        PhotosSearchTypeManager;
+typedef struct _PhotosSearchTypeManagerClass   PhotosSearchTypeManagerClass;
+typedef struct _PhotosSearchTypeManagerPrivate PhotosSearchTypeManagerPrivate;
+
+struct _PhotosSearchTypeManager
+{
+  PhotosBaseManager parent_instance;
+  PhotosSearchTypeManagerPrivate *priv;
+};
+
+struct _PhotosSearchTypeManagerClass
+{
+  PhotosBaseManagerClass parent_class;
+};
+
+GType                     photos_search_type_manager_get_type           (void) G_GNUC_CONST;
+
+PhotosBaseManager        *photos_search_type_manager_new                (void);
+
+G_END_DECLS
+
+#endif /* PHOTOS_SEARCH_TYPE_MANAGER_H */



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