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> 2006-05-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols: * 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> 2006-05-04 Matthias Clasen <mclasen@redhat.com>
* gtk/gtk.symbols: * gtk/gtk.symbols:
......
...@@ -2550,9 +2550,11 @@ gtk_paper_size_get_default ...@@ -2550,9 +2550,11 @@ gtk_paper_size_get_default
gtk_print_backend_error_quark gtk_print_backend_error_quark
gtk_print_backend_get_type G_GNUC_CONST gtk_print_backend_get_type G_GNUC_CONST
gtk_print_backend_get_printer_list gtk_print_backend_get_printer_list
gtk_print_backend_printer_list_is_done
gtk_print_backend_find_printer gtk_print_backend_find_printer
gtk_print_backend_print_stream gtk_print_backend_print_stream
gtk_print_backend_load_modules gtk_print_backend_load_modules
gtk_print_backend_unref_at_idle
#endif #endif
#endif #endif
#endif #endif
......
...@@ -110,6 +110,17 @@ static void populate_dialog (GtkPageSetupUnixDialog *dialog ...@@ -110,6 +110,17 @@ static void populate_dialog (GtkPageSetupUnixDialog *dialog
static void fill_paper_sizes_from_printer (GtkPageSetupUnixDialog *dialog, static void fill_paper_sizes_from_printer (GtkPageSetupUnixDialog *dialog,
GtkPrinter *printer); GtkPrinter *printer);
static void run_custom_paper_dialog (GtkPageSetupUnixDialog *dialog); 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[] = { static const char * const common_paper_sizes[] = {
"na_letter", "na_letter",
...@@ -369,7 +380,9 @@ gtk_page_setup_unix_dialog_finalize (GObject *object) ...@@ -369,7 +380,9 @@ gtk_page_setup_unix_dialog_finalize (GObject *object)
{ {
GtkPageSetupUnixDialog *dialog = GTK_PAGE_SETUP_UNIX_DIALOG (object); GtkPageSetupUnixDialog *dialog = GTK_PAGE_SETUP_UNIX_DIALOG (object);
GtkPageSetupUnixDialogPrivate *priv = dialog->priv; GtkPageSetupUnixDialogPrivate *priv = dialog->priv;
GtkPrintBackend *backend;
GList *node;
if (priv->request_details_tag) if (priv->request_details_tag)
{ {
g_source_remove (priv->request_details_tag); g_source_remove (priv->request_details_tag);
...@@ -397,6 +410,21 @@ gtk_page_setup_unix_dialog_finalize (GObject *object) ...@@ -397,6 +410,21 @@ gtk_page_setup_unix_dialog_finalize (GObject *object)
g_free (priv->waiting_for_printer); g_free (priv->waiting_for_printer);
priv->waiting_for_printer = NULL; 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); G_OBJECT_CLASS (gtk_page_setup_unix_dialog_parent_class)->finalize (object);
} }
......
This diff is collapsed.
...@@ -39,7 +39,8 @@ ...@@ -39,7 +39,8 @@
G_BEGIN_DECLS 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 ()) #define GTK_PRINT_BACKEND_ERROR (gtk_print_backend_error_quark ())
...@@ -51,22 +52,28 @@ typedef enum ...@@ -51,22 +52,28 @@ typedef enum
GQuark gtk_print_backend_error_quark (void); GQuark gtk_print_backend_error_quark (void);
#define GTK_TYPE_PRINT_BACKEND (gtk_print_backend_get_type ()) #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(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_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendClass))
#define GTK_PRINT_BACKEND_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_PRINT_BACKEND, GtkPrintBackendIface)) #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: */ GtkPrintBackendPrivate *priv;
GList * (*get_printer_list) (GtkPrintBackend *printer_backend); };
GtkPrinter * (*find_printer) (GtkPrintBackend *print_backend, struct _GtkPrintBackendClass
const gchar *printer_name); {
void (*print_stream) (GtkPrintBackend *print_backend, GObjectClass parent_class;
GtkPrintJob *job,
/* Global backend methods: */
void (*request_printer_list) (GtkPrintBackend *backend);
void (*print_stream) (GtkPrintBackend *backend,
GtkPrintJob *job,
gint data_fd, gint data_fd,
GtkPrintJobCompleteFunc callback, GtkPrintJobCompleteFunc callback,
gpointer user_data, gpointer user_data,
...@@ -97,26 +104,49 @@ struct _GtkPrintBackendIface ...@@ -97,26 +104,49 @@ struct _GtkPrintBackendIface
double *left, double *left,
double *right); double *right);
/* Signals /* Signals */
*/ void (*printer_list_changed) (GtkPrintBackend *backend);
void (*printer_list_changed) (void); void (*printer_list_done) (GtkPrintBackend *backend);
void (*printer_added) (GtkPrinter *printer); void (*printer_added) (GtkPrintBackend *backend,
void (*printer_removed) (GtkPrinter *printer); GtkPrinter *printer);
void (*printer_status_changed) (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; GType gtk_print_backend_get_type (void) G_GNUC_CONST;
GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend); GList *gtk_print_backend_get_printer_list (GtkPrintBackend *print_backend);
GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend, gboolean gtk_print_backend_printer_list_is_done (GtkPrintBackend *print_backend);
const gchar *printer_name); GtkPrinter *gtk_print_backend_find_printer (GtkPrintBackend *print_backend,
void gtk_print_backend_print_stream (GtkPrintBackend *print_backend, const gchar *printer_name);
GtkPrintJob *job, void gtk_print_backend_print_stream (GtkPrintBackend *print_backend,
gint data_fd, GtkPrintJob *job,
GtkPrintJobCompleteFunc callback, gint data_fd,
gpointer user_data, GtkPrintJobCompleteFunc callback,
GDestroyNotify dnotify); gpointer user_data,
GList * gtk_print_backend_load_modules (void); 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 */ /* Backend-only functions for GtkPrinter */
......
...@@ -52,7 +52,6 @@ struct _GtkPrinterPrivate ...@@ -52,7 +52,6 @@ struct _GtkPrinterPrivate
gchar *state_message; gchar *state_message;
gint job_count; gint job_count;
/* Not ref:ed, backend owns printer. */
GtkPrintBackend *backend; GtkPrintBackend *backend;
}; };
...@@ -215,6 +214,9 @@ gtk_printer_finalize (GObject *object) ...@@ -215,6 +214,9 @@ gtk_printer_finalize (GObject *object)
g_free (priv->state_message); g_free (priv->state_message);
g_free (priv->icon_name); g_free (priv->icon_name);
if (priv->backend)
g_object_unref (priv->backend);
G_OBJECT_CLASS (gtk_printer_parent_class)->finalize (object); G_OBJECT_CLASS (gtk_printer_parent_class)->finalize (object);
} }
...@@ -234,7 +236,7 @@ gtk_printer_set_property (GObject *object, ...@@ -234,7 +236,7 @@ gtk_printer_set_property (GObject *object,
break; break;
case PROP_BACKEND: case PROP_BACKEND:
priv->backend = GTK_PRINT_BACKEND (g_value_get_object (value)); priv->backend = GTK_PRINT_BACKEND (g_value_dup_object (value));
break; break;
case PROP_IS_VIRTUAL: case PROP_IS_VIRTUAL:
...@@ -340,16 +342,6 @@ gtk_printer_get_backend (GtkPrinter *printer) ...@@ -340,16 +342,6 @@ gtk_printer_get_backend (GtkPrinter *printer)
return printer->priv->backend; 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: * gtk_printer_get_name:
* @printer: a #GtkPrinter * @printer: a #GtkPrinter
...@@ -663,8 +655,8 @@ gtk_printer_set_is_default (GtkPrinter *printer, ...@@ -663,8 +655,8 @@ gtk_printer_set_is_default (GtkPrinter *printer,
void void
_gtk_printer_request_details (GtkPrinter *printer) _gtk_printer_request_details (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_request_details (printer); return backend_class->printer_request_details (printer);
} }
GtkPrinterOptionSet * GtkPrinterOptionSet *
...@@ -672,16 +664,16 @@ _gtk_printer_get_options (GtkPrinter *printer, ...@@ -672,16 +664,16 @@ _gtk_printer_get_options (GtkPrinter *printer,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup) GtkPageSetup *page_setup)
{ {
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_get_options (printer, settings, page_setup); return backend_class->printer_get_options (printer, settings, page_setup);
} }
gboolean gboolean
_gtk_printer_mark_conflicts (GtkPrinter *printer, _gtk_printer_mark_conflicts (GtkPrinter *printer,
GtkPrinterOptionSet *options) GtkPrinterOptionSet *options)
{ {
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_mark_conflicts (printer, options); return backend_class->printer_mark_conflicts (printer, options);
} }
void void
...@@ -689,8 +681,8 @@ _gtk_printer_get_settings_from_options (GtkPrinter *printer, ...@@ -689,8 +681,8 @@ _gtk_printer_get_settings_from_options (GtkPrinter *printer,
GtkPrinterOptionSet *options, GtkPrinterOptionSet *options,
GtkPrintSettings *settings) GtkPrintSettings *settings)
{ {
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_get_settings_from_options (printer, options, settings); return backend_class->printer_get_settings_from_options (printer, options, settings);
} }
void void
...@@ -699,8 +691,8 @@ _gtk_printer_prepare_for_print (GtkPrinter *printer, ...@@ -699,8 +691,8 @@ _gtk_printer_prepare_for_print (GtkPrinter *printer,
GtkPrintSettings *settings, GtkPrintSettings *settings,
GtkPageSetup *page_setup) GtkPageSetup *page_setup)
{ {
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_prepare_for_print (printer, print_job, settings, page_setup); return backend_class->printer_prepare_for_print (printer, print_job, settings, page_setup);
} }
cairo_surface_t * cairo_surface_t *
...@@ -709,17 +701,17 @@ _gtk_printer_create_cairo_surface (GtkPrinter *printer, ...@@ -709,17 +701,17 @@ _gtk_printer_create_cairo_surface (GtkPrinter *printer,
gdouble height, gdouble height,
gint cache_fd) 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 * GList *
_gtk_printer_list_papers (GtkPrinter *printer) _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 void
...@@ -729,9 +721,28 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer, ...@@ -729,9 +721,28 @@ _gtk_printer_get_hard_margins (GtkPrinter *printer,
gdouble *left, gdouble *left,
gdouble *right) 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__ #define __GTK_PRINTER_C__
......
...@@ -78,6 +78,8 @@ gboolean gtk_printer_is_active (GtkPrinter *printer ...@@ -78,6 +78,8 @@ gboolean gtk_printer_is_active (GtkPrinter *printer
gboolean gtk_printer_is_virtual (GtkPrinter *printer); gboolean gtk_printer_is_virtual (GtkPrinter *printer);
gboolean gtk_printer_is_default (GtkPrinter *printer); gboolean gtk_printer_is_default (GtkPrinter *printer);
gint gtk_printer_compare (GtkPrinter *a,
GtkPrinter *b);
G_END_DECLS G_END_DECLS
......
...@@ -61,7 +61,8 @@ struct _GtkPrintOperationPrivate ...@@ -61,7 +61,8 @@ struct _GtkPrintOperationPrivate
GtkPageSetup *page_setup); GtkPageSetup *page_setup);
void (*end_page) (GtkPrintOperation *operation, void (*end_page) (GtkPrintOperation *operation,
GtkPrintContext *print_context); GtkPrintContext *print_context);
void (*end_run) (GtkPrintOperation *operation); void (*end_run) (GtkPrintOperation *operation,
gboolean wait);
GDestroyNotify free_platform_data; GDestroyNotify free_platform_data;
}; };
...@@ -70,7 +71,8 @@ GtkPrintOperationResult _gtk_print_operation_platform_backend_run_dialog (GtkPri ...@@ -70,7 +71,8 @@ GtkPrintOperationResult _gtk_print_operation_platform_backend_run_dialog (GtkPri
gboolean *do_print, gboolean *do_print,
GError **error); 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, void _gtk_print_operation_platform_backend_run_dialog_async (GtkPrintOperation *op,
GtkWindow *parent, GtkWindow *parent,
......
This diff is collapsed.
...@@ -1115,7 +1115,8 @@ pdf_end_page (GtkPrintOperation *op, ...@@ -1115,7 +1115,8 @@ pdf_end_page (GtkPrintOperation *op,
} }
static void static void
pdf_end_run (GtkPrintOperation *op) pdf_end_run (GtkPrintOperation *op,
gboolean wait)
{ {
GtkPrintOperationPrivate *priv = op->priv; GtkPrintOperationPrivate *priv = op->priv;
...@@ -1161,7 +1162,8 @@ run_pdf (GtkPrintOperation *op, ...@@ -1161,7 +1162,8 @@ run_pdf (GtkPrintOperation *op,
} }
static void static void
print_pages (GtkPrintOperation *op) print_pages (GtkPrintOperation *op,
gboolean wait)
{ {
GtkPrintOperationPrivate *priv = op->priv; GtkPrintOperationPrivate *priv = op->priv;
int page, range; int page, range;
...@@ -1289,8 +1291,7 @@ print_pages (GtkPrintOperation *op) ...@@ -1289,8 +1291,7 @@ print_pages (GtkPrintOperation *op)
g_object_unref (initial_page_setup); g_object_unref (initial_page_setup);
cairo_surface_finish (priv->surface); cairo_surface_finish (priv->surface);
priv->end_run (op); priv->end_run (op, wait);
} }
/** /**
...@@ -1343,7 +1344,7 @@ gtk_print_operation_run (GtkPrintOperation *op, ...@@ -1343,7 +1344,7 @@ gtk_print_operation_run (GtkPrintOperation *op,
&do_print, &do_print,
error); error);
if (do_print) if (do_print)
print_pages (op); print_pages (op, TRUE);
else else
_gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL); _gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL);
...@@ -1384,7 +1385,7 @@ gtk_print_operation_run_async (GtkPrintOperation *op, ...@@ -1384,7 +1385,7 @@ gtk_print_operation_run_async (GtkPrintOperation *op,
{ {
run_pdf (op, parent, &do_print, NULL); run_pdf (op, parent, &do_print, NULL);
if (do_print) if (do_print)
print_pages (op); print_pages (op, FALSE);
else else
_gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL); _gtk_print_operation_set_status (op, GTK_PRINT_STATUS_FINISHED_ABORTED, NULL);
} }
......
...@@ -73,6 +73,15 @@ static void unschedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog); ...@@ -73,6 +73,15 @@ static void unschedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog);
static void selected_printer_changed (GtkTreeSelection *selection, static void selected_printer_changed (GtkTreeSelection *selection,
GtkPrintUnixDialog *dialog); GtkPrintUnixDialog *dialog);
static void clear_per_printer_ui (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 { enum {
PROP_0, PROP_0,
...@@ -281,6 +290,8 @@ gtk_print_unix_dialog_finalize (GObject *object) ...@@ -281,6 +290,8 @@ gtk_print_unix_dialog_finalize (GObject *object)
{ {
GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (object); GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (object);
GtkPrintUnixDialogPrivate *priv = dialog->priv; GtkPrintUnixDialogPrivate *priv = dialog->priv;
GtkPrintBackend *backend;
GList *node;
unschedule_idle_mark_conflicts (dialog); unschedule_idle_mark_conflicts (dialog);
...@@ -339,6 +350,21 @@ gtk_print_unix_dialog_finalize (GObject *object) ...@@ -339,6 +350,21 @@ gtk_print_unix_dialog_finalize (GObject *object)
g_free (priv->format_for_printer); g_free (priv->format_for_printer);
priv->format_for_printer = NULL; 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); G_OBJECT_CLASS (gtk_print_unix_dialog_parent_class)->finalize (object);
} }
...@@ -1164,6 +1190,7 @@ selected_printer_changed (GtkTreeSelection *selection, ...@@ -1164,6 +1190,7 @@ selected_printer_changed (GtkTreeSelection *selection,
g_signal_connect (printer, "details-acquired", g_signal_connect (printer, "details-acquired",
G_CALLBACK (printer_details_acquired), dialog); G_CALLBACK (printer_details_acquired), dialog);
_gtk_printer_request_details (printer); _gtk_printer_request_details (printer);
g_object_unref (printer);
return; return;
} }
......
...@@ -242,6 +242,26 @@ gtk_cups_request_ipp_add_string (GtkCupsRequest *request, ...@@ -242,6 +242,26 @@ gtk_cups_request_ipp_add_string (GtkCupsRequest *request,
value); 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,