+2005-02-07 Marco Pesenti Gritti <marco@gnome.org>
+
+ * ps/ps-document.c: (ps_document_finalize),
+ (ps_document_get_n_pages), (ps_document_get_page):
+
+ Some cleanups, stop the interpreter on finalize
+
+ * shell/ev-page-view.c: (ev_page_view_dispose),
+ (ev_page_view_class_init):
+
+ Release our reference on the document
+
2005-02-07 Marco Pesenti Gritti <marco@gnome.org>
* Makefile.am:
}
static void
-ps_document_finalize(GObject * object)
+ps_document_finalize (GObject * object)
{
- PSDocument *gs;
+ PSDocument *gs;
- g_return_if_fail(object != NULL);
- g_return_if_fail(GTK_IS_GS(object));
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GTK_IS_GS (object));
- gs = PS_DOCUMENT(object);
+ LOG ("Finalize")
- ps_document_cleanup(gs);
+ gs = PS_DOCUMENT (object);
- if(gs->input_buffer) {
- g_free(gs->input_buffer);
- gs->input_buffer = NULL;
- }
+ ps_document_cleanup (gs);
+ stop_interpreter (gs);
+
+ if(gs->input_buffer) {
+ g_free(gs->input_buffer);
+ gs->input_buffer = NULL;
+ }
- (*G_OBJECT_CLASS(parent_class)->finalize) (object);
+ (*G_OBJECT_CLASS(parent_class)->finalize) (object);
}
static void
return TRUE;
}
-static gint
-ps_document_get_current_page(PSDocument * gs)
-{
- g_return_val_if_fail(gs != NULL, -1);
- g_return_val_if_fail(GTK_IS_GS(gs), -1);
-
- return gs->current_page;
-}
-
-static gint
-ps_document_get_page_count(PSDocument * gs)
-{
- if(!gs->gs_filename)
- return 0;
-
- if(gs->doc) {
- if(gs->structured_doc)
- return gs->doc->numpages;
- else
- return G_MAXINT;
- }
- else
- return 0;
-}
-
static gboolean
ps_document_goto_page(PSDocument * gs, gint page)
{
static int
ps_document_get_n_pages (EvDocument *document)
{
- return ps_document_get_page_count (PS_DOCUMENT (document));
+ PSDocument *ps = PS_DOCUMENT (document);
+
+ g_return_val_if_fail (ps != NULL, -1);
+
+ if (!ps->gs_filename || !ps->doc) {
+ return -1;
+ }
+
+ return ps->structured_doc ? ps->doc->numpages : 1;
}
static void
static int
ps_document_get_page (EvDocument *document)
{
- return ps_document_get_current_page (PS_DOCUMENT (document));
+ PSDocument *ps = PS_DOCUMENT (document);
+
+ g_return_val_if_fail (ps != NULL, -1);
+
+ return ps->current_page;
}
static gboolean
page_view->priv->uniform_page_size = FALSE;
}
+static void
+ev_page_view_dispose (GObject *object)
+{
+ EvPageView *view = EV_PAGE_VIEW (object);
+
+ if (view->priv->document) {
+ g_object_unref (view->priv->document);
+ view->priv->document = NULL;
+ }
+
+ G_OBJECT_CLASS (ev_page_view_parent_class)->dispose (object);
+}
+
static void
ev_page_view_class_init (EvPageViewClass *klass)
{
widget_class->unrealize = ev_page_view_unrealize;
widget_class->map = ev_page_view_map;
+ o_class->dispose = ev_page_view_dispose;
+
widget_class->set_scroll_adjustments_signal =
g_signal_new ("set_scroll_adjustments",
G_TYPE_FROM_CLASS (o_class),