/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ /* * example * Copyright (C) Hodong Kim 2013 * * example is free software: you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * example 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see ."; */ #include "example-document.h" #include G_DEFINE_TYPE (ExampleDocument, example_document, G_TYPE_OBJECT); ExampleDocument * example_document_new_from_uri (const gchar *uri, GError **error) { return (ExampleDocument *) g_object_new (EXAMPLE_TYPE_DOCUMENT, NULL); } guint example_document_get_n_pages (ExampleDocument *document) { return 1; } ExamplePage *example_document_get_page (ExampleDocument *document, gint index) { g_return_val_if_fail (EXAMPLE_IS_DOCUMENT (document), NULL); return (ExamplePage *) g_object_new (EXAMPLE_TYPE_PAGE, NULL); } static void example_document_init (ExampleDocument *document) { ExamplePage *page = (ExamplePage *) g_object_new (EXAMPLE_TYPE_PAGE, NULL); document->page = g_object_ref (page); } static void example_document_finalize (GObject *object) { g_object_unref (EXAMPLE_DOCUMENT (object)->page); G_OBJECT_CLASS (example_document_parent_class)->finalize (object); } static void example_document_class_init (ExampleDocumentClass *klass) { GObjectClass* object_class = G_OBJECT_CLASS (klass); object_class->finalize = example_document_finalize; }