X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-render-context.c;h=9e728a66a70150bb367f253cffd14bc16287b30e;hb=b0e729d2f6401c7cf6988aa044f47b3ca8e48487;hp=a3969adad32f1ed85279a5e8609dd32a95506e21;hpb=13a06349251874bd35d2f03c3fc93217cee749a2;p=evince.git diff --git a/libdocument/ev-render-context.c b/libdocument/ev-render-context.c index a3969ada..9e728a66 100644 --- a/libdocument/ev-render-context.c +++ b/libdocument/ev-render-context.c @@ -1,3 +1,23 @@ +/* this file is part of evince, a gnome document viewer + * + * Copyright (C) 2005 Jonathan Blandford + * + * Evince 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. + * + * Evince 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 #include "ev-render-context.h" static void ev_render_context_init (EvRenderContext *rc); @@ -15,9 +35,9 @@ ev_render_context_dispose (GObject *object) rc = (EvRenderContext *) object; - if (rc->destroy) { - (*rc->destroy) (rc->data); - rc->destroy = NULL; + if (rc->page) { + g_object_unref (rc->page); + rc->page = NULL; } (* G_OBJECT_CLASS (ev_render_context_parent_class)->dispose) (object); @@ -33,18 +53,17 @@ ev_render_context_class_init (EvRenderContextClass *class) oclass->dispose = ev_render_context_dispose; } - EvRenderContext * -ev_render_context_new (int rotation, - gint page, - gdouble scale) +ev_render_context_new (EvPage *page, + gint rotation, + gdouble scale) { EvRenderContext *rc; rc = (EvRenderContext *) g_object_new (EV_TYPE_RENDER_CONTEXT, NULL); + rc->page = page ? g_object_ref (page) : NULL; rc->rotation = rotation; - rc->page = page; rc->scale = scale; return rc; @@ -52,11 +71,14 @@ ev_render_context_new (int rotation, void ev_render_context_set_page (EvRenderContext *rc, - gint page) + EvPage *page) { g_return_if_fail (rc != NULL); + g_return_if_fail (EV_IS_PAGE (page)); - rc->page = page; + if (rc->page) + g_object_unref (rc->page); + rc->page = g_object_ref (page); } void