2 * Copyright (C) 2006 John (J5) Palmieri <johnp@redhat.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 #include "gtkprintercups.h"
23 static void gtk_printer_cups_init (GtkPrinterCups *printer);
24 static void gtk_printer_cups_class_init (GtkPrinterCupsClass *class);
25 static void gtk_printer_cups_finalize (GObject *object);
27 static GtkPrinterClass *gtk_printer_cups_parent_class;
28 static GType gtk_printer_cups_type = 0;
31 gtk_printer_cups_register_type (GTypeModule *module)
33 static const GTypeInfo object_info =
35 sizeof (GtkPrinterCupsClass),
37 (GBaseFinalizeFunc) NULL,
38 (GClassInitFunc) gtk_printer_cups_class_init,
39 NULL, /* class_finalize */
40 NULL, /* class_data */
41 sizeof (GtkPrinterCups),
43 (GInstanceInitFunc) gtk_printer_cups_init,
46 gtk_printer_cups_type = g_type_module_register_type (module,
53 gtk_printer_cups_get_type (void)
55 return gtk_printer_cups_type;
59 gtk_printer_cups_class_init (GtkPrinterCupsClass *class)
61 GObjectClass *object_class = (GObjectClass *) class;
63 gtk_printer_cups_parent_class = g_type_class_peek_parent (class);
65 object_class->finalize = gtk_printer_cups_finalize;
69 gtk_printer_cups_init (GtkPrinterCups *printer)
71 printer->device_uri = NULL;
72 printer->printer_uri = NULL;
74 printer->hostname = NULL;
76 printer->ppd_name = NULL;
77 printer->ppd_file = NULL;
81 gtk_printer_cups_finalize (GObject *object)
83 GtkPrinterCups *printer;
85 g_return_if_fail (object != NULL);
87 printer = GTK_PRINTER_CUPS (object);
89 g_free (printer->device_uri);
90 g_free (printer->printer_uri);
91 g_free (printer->hostname);
92 g_free (printer->ppd_name);
94 if (printer->ppd_file)
95 ppdClose (printer->ppd_file);
97 G_OBJECT_CLASS (gtk_printer_cups_parent_class)->finalize (object);
101 * gtk_printer_cups_new:
103 * Creates a new #GtkPrinterCups.
105 * Return value: a new #GtkPrinterCups
110 gtk_printer_cups_new (const char *name,
111 GtkPrintBackend *backend)
115 result = g_object_new (GTK_TYPE_PRINTER_CUPS,
121 return (GtkPrinterCups *) result;
125 gtk_printer_cups_get_ppd (GtkPrinterCups *printer)
127 return printer->ppd_file;
131 gtk_printer_cups_get_ppd_name (GtkPrinterCups *printer)
135 result = printer->ppd_name;
138 result = gtk_printer_get_name (GTK_PRINTER (printer));