Commit c36d8f3c authored by Alexander Larsson's avatar Alexander Larsson Committed by Alexander Larsson

Added new symbols

2006-05-04  Alexander Larsson  <alexl@redhat.com>

	* gtk/gtk.symbols:
	Added new symbols

	* gtk/gtkpagesetupunixdialog.c:
	* gtk/gtkprintunixdialog.c:
	Destroy backends when finalizing dialogs.
	Fix printer leak in selected_printer_changed.

	* gtk/gtkprintbackend.[ch]:
	Convert from interface to baseclass.
	Move printer hashtable here so that the baseclass can handle
	the slightly complicated ownership model.
	Add gtk_print_backend_destroy which runs the dispose method,
	causing the ref-cycles between the backend and its printers
	to be broken.
	Add gtk_print_backend_unref_at_idle().

	* gtk/gtkprinter.[ch]:
	GtkPrinter objects now ref their backend so that its always
	availible, since its needed for the printer object to work.
	This causes a reference-cycle that is broken using
	gtk_print_backend_destroy.
	Add gtk_printer_compare.

	* gtk/gtkprintoperation-private.h:
	* gtk/gtkprintoperation-unix.c:
	* gtk/gtkprintoperation.c:
	Implement !show_dialog for unix.
	Make sure the print data is fully spooled before returning
	from a sync run_dialog.


	* modules/printbackends/cups/gtkcupsutils.[ch]:
	Add gtk_cups_request_ipp_add_strings

	* modules/printbackends/cups/gtkprintbackendcups.c:
	* modules/printbackends/cups/gtkprintercups.c:
	* modules/printbackends/lpr/gtkprintbackendlpr.c:
	* modules/printbackends/pdf/gtkprintbackendpdf.c:
	Convert backends to derive instead of implementing interface.
	Move common code into baseclass.
	CUPS:
	  Remove the printer polling in dispose, not finalize.
	  In the cups watch, remove the backend at idle instead of
	  immediately, since the unref can cause the module to be unloaded.
	  Limit the number of printer attributes requested
	  Get printer uri in initial printer listing so that we can use
	  the printer object immediately.

	* tests/Makefile.am:
	* tests/testnouiprint.c:
	Add testcase for !show_dialog.
parent 89b5cb64
2006-05-04 Alexander Larsson <alexl@redhat.com>
* gtk/gtk.symbols:
Added new symbols
* gtk/gtkpagesetupunixdialog.c:
* gtk/gtkprintunixdialog.c:
Destroy backends when finalizing dialogs.
Fix printer leak in selected_printer_changed.
* gtk/gtkprintbackend.[ch]:
Convert from interface to baseclass.
Move printer hashtable here so that the baseclass can handle
the slightly complicated ownership model.
Add gtk_print_backend_destroy which runs the dispose method,
causing the ref-cycles between the backend and its printers
to be broken.
Add gtk_print_backend_unref_at_idle().
* gtk/gtkprinter.[ch]:
GtkPrinter objects now ref their backend so that its always
availible, since its needed for the printer object to work.
This causes a reference-cycle that is broken using
gtk_print_backend_destroy.
Add gtk_printer_compare.
* gtk/gtkprintoperation-private.h:
* gtk/gtkprintoperation-unix.c:
* gtk/gtkprintoperation.c:
Implement !show_dialog for unix.
Make sure the print data is fully spooled before returning
from a sync run_dialog.
* modules/printbackends/cups/gtkcupsutils.[ch]:
Add gtk_cups_request_ipp_add_strings
* modules/printbackends/cups/gtkprintbackendcups.c:
* modules/printbackends/cups/gtkprintercups.c:
* modules/printbackends/lpr/gtkprintbackendlpr.c:
* modules/printbackends/pdf/gtkprintbackendpdf.c:
Convert backends to derive instead of implementing interface.
Move common code into baseclass.
CUPS:
Remove the printer polling in dispose, not finalize.
In the cups watch, remove the backend at idle instead of
immediately, since the unref can cause the module to be unloaded.
Limit the number of printer attributes requested
Get printer uri in initial printer listing so that we can use
the printer object immediately.
* tests/Makefile.am:
* tests/testnouiprint.c:
Add testcase for !show_dialog.
2006-05-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
......
2006-05-04 Alexander Larsson <alexl@redhat.com>
* gtk/gtk.symbols:
Added new symbols
* gtk/gtkpagesetupunixdialog.c:
* gtk/gtkprintunixdialog.c:
Destroy backends when finalizing dialogs.
Fix printer leak in selected_printer_changed.
* gtk/gtkprintbackend.[ch]:
Convert from interface to baseclass.
Move printer hashtable here so that the baseclass can handle
the slightly complicated ownership model.
Add gtk_print_backend_destroy which runs the dispose method,
causing the ref-cycles between the backend and its printers
to be broken.
Add gtk_print_backend_unref_at_idle().
* gtk/gtkprinter.[ch]:
GtkPrinter objects now ref their backend so that its always
availible, since its needed for the printer object to work.
This causes a reference-cycle that is broken using
gtk_print_backend_destroy.
Add gtk_printer_compare.
* gtk/gtkprintoperation-private.h:
* gtk/gtkprintoperation-unix.c:
* gtk/gtkprintoperation.c:
Implement !show_dialog for unix.
Make sure the print data is fully spooled before returning
from a sync run_dialog.
* modules/printbackends/cups/gtkcupsutils.[ch]:
Add gtk_cups_request_ipp_add_strings
* modules/printbackends/cups/gtkprintbackendcups.c:
* modules/printbackends/cups/gtkprintercups.c:
* modules/printbackends/lpr/gtkprintbackendlpr.c:
* modules/printbackends/pdf/gtkprintbackendpdf.c:
Convert backends to derive instead of implementing interface.
Move common code into baseclass.
CUPS:
Remove the printer polling in dispose, not finalize.
In the cups watch, remove the backend at idle instead of
immediately, since the unref can cause the module to be unloaded.
Limit the number of printer attributes requested
Get printer uri in initial printer listing so that we can use
the printer object immediately.
* tests/Makefile.am:
* tests/testnouiprint.c:
Add testcase for !show_dialog.
2006-05-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols:
......
......@@ -2550,9 +2550,11 @@ gtk_paper_size_get_default
gtk_print_backend_error_quark
gtk_print_backend_get_type G_GNUC_CONST
gtk_print_backend_get_printer_list
gtk_print_backend_printer_list_is_done
gtk_print_backend_find_printer
gtk_print_backend_print_stream
gtk_print_backend_load_modules
gtk_print_backend_unref_at_idle
#endif
#endif
#endif
......
......@@ -110,6 +110,17 @@ static void populate_dialog (GtkPageSetupUnixDialog *dialog
static void fill_paper_sizes_from_printer (GtkPageSetupUnixDialog *dialog,
GtkPrinter *printer);
static void run_custom_paper_dialog (GtkPageSetupUnixDialog *dialog);
static void printer_added_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPageSetupUnixDialog *dialog);
static void printer_removed_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPageSetupUnixDialog *dialog);
static void printer_status_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPageSetupUnixDialog *dialog);
static const char * const common_paper_sizes[] = {
"na_letter",
......@@ -369,7 +380,9 @@ gtk_page_setup_unix_dialog_finalize (GObject *object)
{
GtkPageSetupUnixDialog *dialog = GTK_PAGE_SETUP_UNIX_DIALOG (object);
GtkPageSetupUnixDialogPrivate *priv = dialog->priv;
GtkPrintBackend *backend;
GList *node;
if (priv->request_details_tag)
{
g_source_remove (priv->request_details_tag);
......@@ -397,6 +410,21 @@ gtk_page_setup_unix_dialog_finalize (GObject *object)
g_free (priv->waiting_for_printer);
priv->waiting_for_printer = NULL;
for (node = priv->print_backends; node != NULL; node = node->next)
{
backend = GTK_PRINT_BACKEND (node->data);
g_signal_handlers_disconnect_by_func (backend, printer_added_cb, dialog);
g_signal_handlers_disconnect_by_func (backend, printer_removed_cb, dialog);
g_signal_handlers_disconnect_by_func (backend, printer_status_cb, dialog);
gtk_print_backend_destroy (backend);
g_object_unref (backend);
}
g_list_free (priv->print_backends);
priv->print_backends = NULL;
G_OBJECT_CLASS (gtk_page_setup_unix_dialog_parent_class)->finalize (object);
}
......
This diff is collapsed.
......@@ -39,7 +39,8 @@
G_BEGIN_DECLS
typedef struct _GtkPrintBackendIface GtkPrintBackendIface;
typedef struct _GtkPrintBackendClass GtkPrintBackendClass;
typedef struct _GtkPrintBackendPrivate GtkPrintBackendPrivate;
#define GTK_PRINT_BACKEND_ERROR (gtk_print_backend_error_quark ())
......@@ -51,22 +52,28 @@ typedef enum
GQuark gtk_print_backend_error_quark (void);
#define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ())
#define GTK_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackend))
#define GTK_IS_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND))
#define GTK_PRINT_BACKEND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendIface))
#define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ())
#define GTK_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackend))
#define GTK_PRINT_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendClass))
#define GTK_IS_PRINT_BACKEND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_PRINT_BACKEND))
#define GTK_IS_PRINT_BACKEND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_PRINT_BACKEND))
#define GTK_PRINT_BACKEND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendClass))
struct _GtkPrintBackendIface
struct _GtkPrintBackend
{
GTypeInterface base_iface;
GObject parent_instance;
/* Global backend methods: */
GList * (*get_printer_list) (GtkPrintBackend *printer_backend);
GtkPrintBackendPrivate *priv;
};
GtkPrinter * (*find_printer) (GtkPrintBackend *print_backend,
const gchar *printer_name);
void (*print_stream) (GtkPrintBackend *print_backend,
GtkPrintJob *job,
struct _GtkPrintBackendClass
{
GObjectClass parent_class;
/* Global backend methods: */
void (*request_printer_list) (GtkPrintBackend *backend);
void (*print_stream) (GtkPrintBackend *backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
......@@ -97,26 +104,49 @@ struct _GtkPrintBackendIface
double *left,
double *right);
/* Signals
*/
void (*printer_list_changed) (void);
void (*printer_added) (GtkPrinter *printer);
void (*printer_removed) (GtkPrinter *printer);
void (*printer_status_changed) (GtkPrinter *printer);
/* Signals */
void (*printer_list_changed) (GtkPrintBackend *backend);
void (*printer_list_done) (GtkPrintBackend *backend);
void (*printer_added) (GtkPrintBackend *backend,
GtkPrinter *printer);
void (*printer_removed) (GtkPrintBackend *backend,
GtkPrinter *printer);
void (*printer_status_changed) (GtkPrintBackend *backend,
GtkPrinter *printer);
/* Padding for future expansion */
void (*_gtk_reserved1) (void);
void (*_gtk_reserved2) (void);
void (*_gtk_reserved3) (void);
void (*_gtk_reserved4) (void);
void (*_gtk_reserved5) (void);
void (*_gtk_reserved6) (void);
void (*_gtk_reserved7) (void);
};
GType gtk_print_backend_get_type (void) G_GNUC_CONST;
GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend);
GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend,
const gchar *printer_name);
void gtk_print_backend_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GList * gtk_print_backend_load_modules (void);
GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend);
gboolean gtk_print_backend_printer_list_is_done (GtkPrintBackend *print_backend);
GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend,
const gchar *printer_name);
void gtk_print_backend_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
GList * gtk_print_backend_load_modules (void);
void gtk_print_backend_unref_at_idle (GtkPrintBackend *print_backend);
void gtk_print_backend_destroy (GtkPrintBackend *print_backend);
/* Backend-only functions for GtkPrintBackend */
void gtk_print_backend_add_printer (GtkPrintBackend *print_backend,
GtkPrinter *printer);
void gtk_print_backend_remove_printer (GtkPrintBackend *print_backend,
GtkPrinter *printer);
void gtk_print_backend_set_list_done (GtkPrintBackend *backend);
/* Backend-only functions for GtkPrinter */
......
......@@ -52,7 +52,6 @@ struct _GtkPrinterPrivate
gchar *state_message;
gint job_count;
/* Not ref:ed, backend owns printer. */
GtkPrintBackend *backend;
};
......@@ -215,6 +214,9 @@ gtk_printer_finalize (GObject *object)
g_free (priv->state_message);
g_free (priv->icon_name);
if (priv->backend)
g_object_unref (priv->backend);
G_OBJECT_CLASS (gtk_printer_parent_class)->finalize (object);
}
......@@ -234,7 +236,7 @@ gtk_printer_set_property (GObject *object,
break;
case PROP_BACKEND:
priv->backend = GTK_PRINT_BACKEND (g_value_get_object (value));
priv->backend = GTK_PRINT_BACKEND (g_value_dup_object (value));
break;
case PROP_IS_VIRTUAL:
......@@ -340,16 +342,6 @@ gtk_printer_get_backend (GtkPrinter *printer)
return printer->priv->backend;
}
void
gtk_printer_set_backend (GtkPrinter *printer,
GtkPrintBackend *backend)
{
g_return_if_fail (GTK_IS_PRINTER (printer));
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
printer->priv->backend = backend;
}
/**
* gtk_printer_get_name:
* @printer: a #GtkPrinter
......@@ -663,8 +655,8 @@ gtk_printer_set_is_default (GtkPrinter *printer,
void
_gtk_printer_request_details (GtkPrinter *printer)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
return backend_iface->printer_request_details (printer);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_request_details (printer);
}
GtkPrinterOptionSet *
......@@ -672,16 +664,16 @@ _gtk_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
return backend_iface->printer_get_options (printer, settings, page_setup);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_get_options (printer, settings, page_setup);
}
gboolean
_gtk_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
return backend_iface->printer_mark_conflicts (printer, options);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_mark_conflicts (printer, options);
}
void
......@@ -689,8 +681,8 @@ _gtk_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
return backend_iface->printer_get_settings_from_options (printer, options, settings);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_get_settings_from_options (printer, options, settings);
}
void
......@@ -699,8 +691,8 @@ _gtk_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintSettings *settings,
GtkPageSetup *page_setup)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
return backend_iface->printer_prepare_for_print (printer, print_job, settings, page_setup);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_class->printer_prepare_for_print (printer, print_job, settings, page_setup);
}
cairo_surface_t *
......@@ -709,17 +701,17 @@ _gtk_printer_create_cairo_surface (GtkPrinter *printer,
gdouble height,
gint cache_fd)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_iface->printer_create_cairo_surface (printer, width, height, cache_fd);
return backend_class->printer_create_cairo_surface (printer, width, height, cache_fd);
}
GList *
_gtk_printer_list_papers (GtkPrinter *printer)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
return backend_iface->printer_list_papers (printer);
return backend_class->printer_list_papers (printer);
}
void
......@@ -729,9 +721,28 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer,
gdouble *left,
gdouble *right)
{
GtkPrintBackendIface *backend_iface = GTK_PRINT_BACKEND_GET_IFACE (printer->priv->backend);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_GET_CLASS (printer->priv->backend);
backend_iface->printer_get_hard_margins (printer, top, bottom, left, right);
backend_class->printer_get_hard_margins (printer, top, bottom, left, right);
}
gint
gtk_printer_compare (GtkPrinter *a, GtkPrinter *b)
{
const char *name_a, *name_b;
g_assert (GTK_IS_PRINTER (a) && GTK_IS_PRINTER (b));
name_a = gtk_printer_get_name (a);
name_b = gtk_printer_get_name (b);
if (name_a == NULL && name_b == NULL)
return 0;
else if (name_a == NULL)
return G_MAXINT;
else if (name_b == NULL)
return G_MININT;
else
return g_ascii_strcasecmp (name_a, name_b);
}
#define __GTK_PRINTER_C__
......
......@@ -78,6 +78,8 @@ gboolean gtk_printer_is_active (GtkPrinter *printer
gboolean gtk_printer_is_virtual (GtkPrinter *printer);
gboolean gtk_printer_is_default (GtkPrinter *printer);
gint gtk_printer_compare (GtkPrinter *a,
GtkPrinter *b);
G_END_DECLS
......
......@@ -61,7 +61,8 @@ struct _GtkPrintOperationPrivate
GtkPageSetup *page_setup);
void (*end_page) (GtkPrintOperation *operation,
GtkPrintContext *print_context);
void (*end_run) (GtkPrintOperation *operation);
void (*end_run) (GtkPrintOperation *operation,
gboolean wait);
GDestroyNotify free_platform_data;
};
......@@ -70,7 +71,8 @@ GtkPrintOperationResult _gtk_print_operation_platform_backend_run_dialog (GtkPri
gboolean *do_print,
GError **error);
typedef void (* GtkPrintOperationPrintFunc) (GtkPrintOperation *op);
typedef void (* GtkPrintOperationPrintFunc) (GtkPrintOperation *op,
gboolean wait);
void _gtk_print_operation_platform_backend_run_dialog_async (GtkPrintOperation *op,
GtkWindow *parent,
......
This diff is collapsed.
......@@ -1115,7 +1115,8 @@ pdf_end_page (GtkPrintOperation *op,
}
static void
pdf_end_run (GtkPrintOperation *op)
pdf_end_run (GtkPrintOperation *op,
gboolean wait)
{
GtkPrintOperationPrivate *priv = op->priv;
......@@ -1161,7 +1162,8 @@ run_pdf (GtkPrintOperation *op,
}
static void
print_pages (GtkPrintOperation *op)
print_pages (GtkPrintOperation *op,
gboolean wait)
{
GtkPrintOperationPrivate *priv = op->priv;
int page, range;
......@@ -1289,8 +1291,7 @@ print_pages (GtkPrintOperation *op)
g_object_unref (initial_page_setup);
cairo_surface_finish (priv->surface);
priv->end_run (op);
priv->end_run (op, wait);
}
/**
......@@ -1343,7 +1344,7 @@ gtk_print_operation_run (GtkPrintOperation *op,
&do_print,
error);
if (do_print)
print_pages (op);
print_pages (op, TRUE);
else
_gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL);
......@@ -1384,7 +1385,7 @@ gtk_print_operation_run_async (GtkPrintOperation *op,
{
run_pdf (op, parent, &do_print, NULL);
if (do_print)
print_pages (op);
print_pages (op, FALSE);
else
_gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL);
}
......
......@@ -73,6 +73,15 @@ static void unschedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog);
static void selected_printer_changed (GtkTreeSelection *selection,
GtkPrintUnixDialog *dialog);
static void clear_per_printer_ui (GtkPrintUnixDialog *dialog);
static void printer_added_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog);
static void printer_removed_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog);
static void printer_status_cb (GtkPrintBackend *backend,
GtkPrinter *printer,
GtkPrintUnixDialog *dialog);
enum {
PROP_0,
......@@ -281,6 +290,8 @@ gtk_print_unix_dialog_finalize (GObject *object)
{
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (object);
GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkPrintBackend *backend;
GList *node;
unschedule_idle_mark_conflicts (dialog);
......@@ -339,6 +350,21 @@ gtk_print_unix_dialog_finalize (GObject *object)
g_free (priv->format_for_printer);
priv->format_for_printer = NULL;
for (node = priv->print_backends; node != NULL; node = node->next)
{
backend = GTK_PRINT_BACKEND (node->data);
g_signal_handlers_disconnect_by_func (backend, printer_added_cb, dialog);
g_signal_handlers_disconnect_by_func (backend, printer_removed_cb, dialog);
g_signal_handlers_disconnect_by_func (backend, printer_status_cb, dialog);
gtk_print_backend_destroy (backend);
g_object_unref (backend);
}
g_list_free (priv->print_backends);
priv->print_backends = NULL;
G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->finalize (object);
}
......@@ -1164,6 +1190,7 @@ selected_printer_changed (GtkTreeSelection *selection,
g_signal_connect (printer, "details-acquired",
G_CALLBACK (printer_details_acquired), dialog);
_gtk_printer_request_details (printer);
g_object_unref (printer);
return;
}
......
......@@ -242,6 +242,26 @@ gtk_cups_request_ipp_add_string (GtkCupsRequest *request,
value);
}
void
gtk_cups_request_ipp_add_strings (GtkCupsRequest *request,
ipp_tag_t group,
ipp_tag_t tag,
const char *name,
int num_values,
const char *charset,
const char * const *values)
{
ippAddStrings (request->ipp_request,
group,
tag,
name,
num_values,
charset,
values);
}
typedef struct
{
const char *name;
......
......@@ -109,6 +109,13 @@ void gtk_cups_request_ipp_add_string (GtkCupsRequest *request,
const char *name,
const char *charset,
const char *value);
void gtk_cups_request_ipp_add_strings (GtkCupsRequest *request,
ipp_tag_t group,
ipp_tag_t tag,
const char *name,
int num_values,
const char *charset,
const char * const *values);
gboolean gtk_cups_request_read_write (GtkCupsRequest *request);
GtkCupsPollState gtk_cups_request_get_poll_state (GtkCupsRequest *request);
void gtk_cups_request_free (GtkCupsRequest *request);
......
......@@ -90,8 +90,7 @@ gtk_printer_cups_finalize (GObject *object)
if (printer->ppd_file)
ppdClose (printer->ppd_file);
if (G_OBJECT_CLASS (gtk_printer_cups_parent_class)->finalize)
G_OBJECT_CLASS (gtk_printer_cups_parent_class)->finalize (object);
G_OBJECT_CLASS (gtk_printer_cups_parent_class)->finalize (object);
}
/**
......
......@@ -51,25 +51,18 @@ static GType print_backend_lpr_type = 0;
struct _GtkPrintBackendLprClass
{
GObjectClass parent_class;
GtkPrintBackendClass parent_class;
};
struct _GtkPrintBackendLpr
{
GObject parent_instance;
GtkPrinter *printer;
GHashTable *printers;
GtkPrintBackend parent_instance;
};
static GObjectClass *backend_parent_class;
static void gtk_print_backend_lpr_class_init (GtkPrintBackendLprClass *class);
static void gtk_print_backend_lpr_iface_init (GtkPrintBackendIface *iface);
static void gtk_print_backend_lpr_init (GtkPrintBackendLpr *impl);
static void gtk_print_backend_lpr_finalize (GObject *object);
static GList * lpr_request_printer_list (GtkPrintBackend *print_backend);
static void lpr_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options,
GtkPrintSettings *settings);
......@@ -89,6 +82,16 @@ static void lpr_printer_get_hard_margins (GtkPrinter
double *right);
static void lpr_printer_request_details (GtkPrinter *printer);
static GList * lpr_printer_list_papers (GtkPrinter *printer);
static cairo_surface_t * lpr_printer_create_cairo_surface (GtkPrinter *printer,
gdouble width,
gdouble height,
gint cache_fd);
static void gtk_print_backend_lpr_print_stream (GtkPrintBackend *print_backend,
GtkPrintJob *job,
gint data_fd,
GtkPrintJobCompleteFunc callback,
gpointer user_data,
GDestroyNotify dnotify);
static void
gtk_print_backend_lpr_register_type (GTypeModule *module)
......@@ -108,24 +111,11 @@ gtk_print_backend_lpr_register_type (GTypeModule *module)
(GInstanceInitFunc) gtk_print_backend_lpr_init,
};
static const GInterfaceInfo print_backend_info =
{
(GInterfaceInitFunc) gtk_print_backend_lpr_iface_init, /* interface_init */
NULL, /* interface_finalize */
NULL /* interface_data */
};
print_backend_lpr_type = g_type_module_register_type (module,
G_TYPE_OBJECT,
"GtkPrintBackendLpr",
&print_backend_lpr_info, 0);
g_type_module_add_interface (module,
print_backend_lpr_type,
GTK_TYPE_PRINT_BACKEND,
&print_backend_info);
GTK_TYPE_PRINT_BACKEND,
"GtkPrintBackendLpr",
&print_backend_lpr_info, 0);
}
}
G_MODULE_EXPORT void
......@@ -173,11 +163,19 @@ gtk_print_backend_lpr_new (void)
static void
gtk_print_backend_lpr_class_init (GtkPrintBackendLprClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
GtkPrintBackendClass *backend_class = GTK_PRINT_BACKEND_CLASS (class);
backend_parent_class = g_type_class_peek_parent (class);
gobject_class->finalize = gtk_print_backend_lpr_finalize;
backend_class->print_stream = gtk_print_backend_lpr_print_stream;
backend_class->printer_request_details = lpr_printer_request_details;
backend_class->printer_create_cairo_surface = lpr_printer_create_cairo_surface;
backend_class->printer_get_options = lpr_printer_get_options;
backend_class->printer_mark_conflicts = lpr_printer_mark_conflicts;
backend_class->printer_get_settings_from_options = lpr_printer_get_settings_from_options;
backend_class->printer_prepare_for_print = lpr_printer_prepare_for_print;
backend_class->printer_list_papers = lpr_printer_list_papers;
backend_class->printer_get_hard_margins = lpr_printer_get_hard_margins;
}
static cairo_status_t
......@@ -215,22 +213,6 @@ lpr_printer_create_cairo_surface (GtkPrinter *printer,
return surface;
}
static GtkPrinter *
gtk_print_backend_lpr_find_printer (GtkPrintBackend *print_backend,
const gchar *printer_name)
{
GtkPrintBackendLpr *lpr_print_backend;
GtkPrinter *printer;