2 * Copyright (C) 2006 John (J5) Palmieri <johnp@redhat.com>
3 * Copyright (C) 2009 Ghee Teo <ghee.teo@sun.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 #include "gtkprinterpapi.h"
24 static void gtk_printer_papi_init (GtkPrinterPapi *printer);
25 static void gtk_printer_papi_class_init (GtkPrinterPapiClass *class);
26 static void gtk_printer_papi_finalize (GObject *object);
28 static GtkPrinterClass *gtk_printer_papi_parent_class;
29 static GType gtk_printer_papi_type = 0;
32 gtk_printer_papi_register_type (GTypeModule *module)
34 const GTypeInfo object_info =
36 sizeof (GtkPrinterPapiClass),
38 (GBaseFinalizeFunc) NULL,
39 (GClassInitFunc) gtk_printer_papi_class_init,
40 NULL, /* class_finalize */
41 NULL, /* class_data */
42 sizeof (GtkPrinterPapi),
44 (GInstanceInitFunc) gtk_printer_papi_init,
47 gtk_printer_papi_type = g_type_module_register_type (module,
54 gtk_printer_papi_get_type (void)
56 return gtk_printer_papi_type;
60 gtk_printer_papi_class_init (GtkPrinterPapiClass *class)
62 GObjectClass *object_class = (GObjectClass *) class;
64 gtk_printer_papi_parent_class = g_type_class_peek_parent (class);
66 object_class->finalize = gtk_printer_papi_finalize;
70 gtk_printer_papi_init (GtkPrinterPapi *printer)
72 printer->printer_name = NULL;
76 gtk_printer_papi_finalize (GObject *object)
78 GtkPrinterPapi *printer;
80 g_return_if_fail (object != NULL);
82 printer = GTK_PRINTER_PAPI (object);
84 g_free(printer->printer_name);
86 G_OBJECT_CLASS (gtk_printer_papi_parent_class)->finalize (object);
90 * gtk_printer_papi_new:
92 * Creates a new #GtkPrinterPapi.
94 * Return value: a new #GtkPrinterPapi
99 gtk_printer_papi_new (const char *name,
100 GtkPrintBackend *backend)
105 result = g_object_new (GTK_TYPE_PRINTER_PAPI,
110 pp = GTK_PRINTER_PAPI(result);
112 pp->printer_name = g_strdup (name);
114 return (GtkPrinterPapi *) pp;