summaryrefslogtreecommitdiff
path: root/gtk/gtkprintunixdialog.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2006-05-04 13:43:32 +0000
committerAlexander Larsson <alexl@src.gnome.org>2006-05-04 13:43:32 +0000
commitc36d8f3cb3781db3cf41b1888c7daf8487324d78 (patch)
treed2ca4427d7aabba33cc64b05f96f4a261334064c /gtk/gtkprintunixdialog.c
parent89b5cb64808fe544a4e0c6717bdb0c24908097b0 (diff)
downloadgtk+-c36d8f3cb3781db3cf41b1888c7daf8487324d78.tar.gz
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.
Diffstat (limited to 'gtk/gtkprintunixdialog.c')
-rw-r--r--gtk/gtkprintunixdialog.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index f2cdd8040a..59cf75321b 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -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;
}