/* * Author: Chris Lord * * Copyright (c) 2007 OpenedHand Ltd - http://www.openedhand.com/ * * 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, 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. * */ /** * SECTION:jana-store-view * @short_description: A store query interface * @see_also: #JanaStore * * #JanaStoreView is the interface for a query, or 'view' on a #JanaStore. A * store view has functions to query a particular time range of components. */ #include "jana-store-view.h" enum { ADDED, MODIFIED, REMOVED, LAST_SIGNAL }; static void jana_store_view_base_init (gpointer g_class) { static gboolean initialized = FALSE; if (!initialized) { /** * JanaStoreView::added: * @store_view: the store view that received the signal * @components: A list of #JanaComponents * * The ::added signal is emitted when new components become * visible in the scope of the store view. **/ g_signal_new ("added", G_OBJECT_CLASS_TYPE (g_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (JanaStoreViewInterface, added), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /** * JanaStoreView::modified: * @store_view: the store view that received the signal * @components: A list of #JanaComponents * * The ::modified signal is emitted when components that were * previously in view have been modified in some way. **/ g_signal_new ("modified", G_OBJECT_CLASS_TYPE (g_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (JanaStoreViewInterface, modified), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); /** * JanaStoreView::removed: * @store_view: the store view that received the signal * @uids: A list of uids * * The ::removed signal is emitted when components that were * previously in view have been removed from the underling * #JanaStore. **/ g_signal_new ("removed", G_OBJECT_CLASS_TYPE (g_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (JanaStoreViewInterface, removed), NULL, NULL, g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); initialized = TRUE; } } GType jana_store_view_get_type (void) { static GType type = 0; if (type == 0) { static const GTypeInfo info = { sizeof (JanaStoreViewInterface), jana_store_view_base_init, /* base_init */ NULL, }; type = g_type_register_static (G_TYPE_INTERFACE, "JanaStoreView", &info, 0); } return type; } /** * jana_store_view_get_range: * @self: A #JanaStoreView * @start: Return location for the start of the view range, or %NULL * @end: Return location for the end of the view range, or %NULL * * Retrieves the range over which this #JanaStoreView is set to span. A %NULL * start or end indicate an unbounded range. */ void jana_store_view_get_range (JanaStoreView *self, JanaTime **start, JanaTime **end) { JANA_STORE_VIEW_GET_INTERFACE (self)->get_range (self, start, end); } /** * jana_store_view_set_range: * @self: A #JanaStoreView * @start: The start of the range, or %NULL * @end: The end of the range, or %NULL * * Sets the range for the #JanaStoreView to span. A %NULL parameter indicates * that that end of the range should be unbounded (i.e. extended infinitely * into the past or future). */ void jana_store_view_set_range (JanaStoreView *self, JanaTime *start, JanaTime *end) { JANA_STORE_VIEW_GET_INTERFACE (self)->set_range (self, start, end); } /** * jana_store_view_start: * @self: A #JanaStoreView * * Starts the view. No signals will be emitted prior to calling this function. */ void jana_store_view_start (JanaStoreView *self) { JANA_STORE_VIEW_GET_INTERFACE (self)->start (self); } /** * jana_store_view_get_store: * @self: A #JanaStoreView * * Retrieves the #JanaStore that this view operates on. * * Returns: The #JanaStore that this view operates on. */ JanaStore * jana_store_view_get_store (JanaStoreView *self) { return JANA_STORE_VIEW_GET_INTERFACE (self)->get_store (self); }