Blame modules/printbackends/papi/gtkprinterpapi.c

Packit Service fb6fa5
/* GtkPrinterPapi
Packit Service fb6fa5
 * Copyright (C) 2006 John (J5) Palmieri  <johnp@redhat.com>
Packit Service fb6fa5
 * Copyright (C) 2009 Ghee Teo <ghee.teo@sun.com>
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is free software; you can redistribute it and/or
Packit Service fb6fa5
 * modify it under the terms of the GNU Lesser General Public
Packit Service fb6fa5
 * License as published by the Free Software Foundation; either
Packit Service fb6fa5
 * version 2 of the License, or (at your option) any later version.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is distributed in the hope that it will be useful,
Packit Service fb6fa5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fb6fa5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service fb6fa5
 * Lesser General Public License for more details.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * You should have received a copy of the GNU Lesser General Public
Packit Service fb6fa5
 * License along with this library; if not, write to the
Packit Service fb6fa5
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service fb6fa5
 * Boston, MA 02111-1307, USA.
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
#include "config.h"
Packit Service fb6fa5
#include "gtkprinterpapi.h"
Packit Service fb6fa5
Packit Service fb6fa5
static void gtk_printer_papi_init       (GtkPrinterPapi      *printer);
Packit Service fb6fa5
static void gtk_printer_papi_class_init (GtkPrinterPapiClass *class);
Packit Service fb6fa5
static void gtk_printer_papi_finalize   (GObject             *object);
Packit Service fb6fa5
Packit Service fb6fa5
static GtkPrinterClass *gtk_printer_papi_parent_class;
Packit Service fb6fa5
static GType gtk_printer_papi_type = 0;
Packit Service fb6fa5
Packit Service fb6fa5
void 
Packit Service fb6fa5
gtk_printer_papi_register_type (GTypeModule *module)
Packit Service fb6fa5
{
Packit Service fb6fa5
  const GTypeInfo object_info =
Packit Service fb6fa5
  {
Packit Service fb6fa5
    sizeof (GtkPrinterPapiClass),
Packit Service fb6fa5
    (GBaseInitFunc) NULL,
Packit Service fb6fa5
    (GBaseFinalizeFunc) NULL,
Packit Service fb6fa5
    (GClassInitFunc) gtk_printer_papi_class_init,
Packit Service fb6fa5
    NULL,           /* class_finalize */
Packit Service fb6fa5
    NULL,           /* class_data */
Packit Service fb6fa5
    sizeof (GtkPrinterPapi),
Packit Service fb6fa5
    0,              /* n_preallocs */
Packit Service fb6fa5
    (GInstanceInitFunc) gtk_printer_papi_init,
Packit Service fb6fa5
  };
Packit Service fb6fa5
Packit Service fb6fa5
 gtk_printer_papi_type = g_type_module_register_type (module,
Packit Service fb6fa5
                                                      GTK_TYPE_PRINTER,
Packit Service fb6fa5
                                                      "GtkPrinterPapi",
Packit Service fb6fa5
                                                      &object_info, 0);
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
GType
Packit Service fb6fa5
gtk_printer_papi_get_type (void)
Packit Service fb6fa5
{
Packit Service fb6fa5
  return gtk_printer_papi_type;
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
gtk_printer_papi_class_init (GtkPrinterPapiClass *class)
Packit Service fb6fa5
{
Packit Service fb6fa5
  GObjectClass *object_class = (GObjectClass *) class;
Packit Service fb6fa5
	
Packit Service fb6fa5
  gtk_printer_papi_parent_class = g_type_class_peek_parent (class);
Packit Service fb6fa5
Packit Service fb6fa5
  object_class->finalize = gtk_printer_papi_finalize;
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
gtk_printer_papi_init (GtkPrinterPapi *printer)
Packit Service fb6fa5
{
Packit Service fb6fa5
  printer->printer_name = NULL;
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
gtk_printer_papi_finalize (GObject *object)
Packit Service fb6fa5
{
Packit Service fb6fa5
  GtkPrinterPapi *printer;
Packit Service fb6fa5
Packit Service fb6fa5
  g_return_if_fail (object != NULL);
Packit Service fb6fa5
Packit Service fb6fa5
  printer = GTK_PRINTER_PAPI (object);
Packit Service fb6fa5
Packit Service fb6fa5
  g_free(printer->printer_name);
Packit Service fb6fa5
Packit Service fb6fa5
  G_OBJECT_CLASS (gtk_printer_papi_parent_class)->finalize (object);
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
/**
Packit Service fb6fa5
 * gtk_printer_papi_new:
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * Creates a new #GtkPrinterPapi.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * Return value: a new #GtkPrinterPapi
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * Since: 2.10
Packit Service fb6fa5
 **/
Packit Service fb6fa5
GtkPrinterPapi *
Packit Service fb6fa5
gtk_printer_papi_new (const char      *name,
Packit Service fb6fa5
		      GtkPrintBackend *backend)
Packit Service fb6fa5
{
Packit Service fb6fa5
  GObject *result;
Packit Service fb6fa5
  GtkPrinterPapi *pp;
Packit Service fb6fa5
  
Packit Service fb6fa5
  result = g_object_new (GTK_TYPE_PRINTER_PAPI,
Packit Service fb6fa5
			 "name", name,
Packit Service fb6fa5
			 "backend", backend,
Packit Service fb6fa5
			 "is-virtual", TRUE,
Packit Service fb6fa5
                         NULL);
Packit Service fb6fa5
  pp = GTK_PRINTER_PAPI(result);
Packit Service fb6fa5
Packit Service fb6fa5
  pp->printer_name = g_strdup (name);
Packit Service fb6fa5
Packit Service fb6fa5
  return (GtkPrinterPapi *) pp;
Packit Service fb6fa5
}
Packit Service fb6fa5