X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkprinter.c;h=fac0136fe5b6bb3433cbdb59f6eb45baa66c903d;hb=d484721b5ca9e82d6422cca8a3a40f001208f87b;hp=7e8c4d0a8af23393d1193b98433c362b2143c9be;hpb=5f1b5d24067468fc86b28dccc504c71abdaf68b8;p=~andy%2Fgtk diff --git a/gtk/gtkprinter.c b/gtk/gtkprinter.c index 7e8c4d0a8..fac0136fe 100644 --- a/gtk/gtkprinter.c +++ b/gtk/gtkprinter.c @@ -12,9 +12,7 @@ * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * License along with this library. If not, see . */ #include "config.h" @@ -145,7 +143,7 @@ gtk_printer_class_init (GtkPrinterClass *class) g_param_spec_boolean ("accepts-pdf", P_("Accepts PDF"), P_("TRUE if this printer can accept PDF"), - TRUE, + FALSE, GTK_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (G_OBJECT_CLASS (class), PROP_ACCEPTS_PS, @@ -256,7 +254,7 @@ gtk_printer_init (GtkPrinter *printer) priv->is_accepting_jobs = TRUE; priv->is_new = TRUE; priv->has_details = FALSE; - priv->accepts_pdf = TRUE; + priv->accepts_pdf = FALSE; priv->accepts_ps = TRUE; priv->state_message = NULL; @@ -414,7 +412,7 @@ gtk_printer_new (const gchar *name, * * Returns the backend of the printer. * - * Return value: the backend of @printer + * Return value: (transfer none): the backend of @printer * * Since: 2.10 */ @@ -436,7 +434,7 @@ gtk_printer_get_backend (GtkPrinter *printer) * * Since: 2.10 */ -G_CONST_RETURN gchar * +const gchar * gtk_printer_get_name (GtkPrinter *printer) { g_return_val_if_fail (GTK_IS_PRINTER (printer), NULL); @@ -454,7 +452,7 @@ gtk_printer_get_name (GtkPrinter *printer) * * Since: 2.10 */ -G_CONST_RETURN gchar * +const gchar * gtk_printer_get_description (GtkPrinter *printer) { g_return_val_if_fail (GTK_IS_PRINTER (printer), NULL); @@ -492,7 +490,7 @@ gtk_printer_set_description (GtkPrinter *printer, * * Since: 2.10 */ -G_CONST_RETURN gchar * +const gchar * gtk_printer_get_state_message (GtkPrinter *printer) { g_return_val_if_fail (GTK_IS_PRINTER (printer), NULL); @@ -530,7 +528,7 @@ gtk_printer_set_state_message (GtkPrinter *printer, * * Since: 2.10 */ -G_CONST_RETURN gchar * +const gchar * gtk_printer_get_location (GtkPrinter *printer) { g_return_val_if_fail (GTK_IS_PRINTER (printer), NULL); @@ -568,7 +566,7 @@ gtk_printer_set_location (GtkPrinter *printer, * * Since: 2.10 */ -G_CONST_RETURN gchar * +const gchar * gtk_printer_get_icon_name (GtkPrinter *printer) { g_return_val_if_fail (GTK_IS_PRINTER (printer), NULL); @@ -795,6 +793,15 @@ gtk_printer_accepts_pdf (GtkPrinter *printer) return printer->priv->accepts_pdf; } +void +gtk_printer_set_accepts_pdf (GtkPrinter *printer, + gboolean val) +{ + g_return_if_fail (GTK_IS_PRINTER (printer)); + + printer->priv->accepts_pdf = val; +} + /** * gtk_printer_accepts_ps: * @printer: a #GtkPrinter @@ -814,6 +821,15 @@ gtk_printer_accepts_ps (GtkPrinter *printer) return printer->priv->accepts_ps; } +void +gtk_printer_set_accepts_ps (GtkPrinter *printer, + gboolean val) +{ + g_return_if_fail (GTK_IS_PRINTER (printer)); + + printer->priv->accepts_ps = val; +} + gboolean gtk_printer_is_new (GtkPrinter *printer) { @@ -976,10 +992,10 @@ gtk_printer_get_default_page_size (GtkPrinter *printer) /** * gtk_printer_get_hard_margins: * @printer: a #GtkPrinter - * @top: a location to store the top margin in - * @bottom: a location to store the bottom margin in - * @left: a location to store the left margin in - * @right: a location to store the right margin in + * @top: (out): a location to store the top margin in + * @bottom: (out): a location to store the bottom margin in + * @left: (out): a location to store the left margin in + * @right: (out): a location to store the right margin in * * Retrieve the hard margins of @printer, i.e. the margins that define * the area at the borders of the paper that the printer cannot print to. @@ -1135,15 +1151,10 @@ backend_status_changed (GObject *object, } static void -list_done_cb (GtkPrintBackend *backend, - PrinterList *printer_list) +list_printers_remove_backend (PrinterList *printer_list, + GtkPrintBackend *backend) { printer_list->backends = g_list_remove (printer_list->backends, backend); - - g_signal_handlers_disconnect_by_func (backend, list_added_cb, printer_list); - g_signal_handlers_disconnect_by_func (backend, list_done_cb, printer_list); - g_signal_handlers_disconnect_by_func (backend, backend_status_changed, printer_list); - gtk_print_backend_destroy (backend); g_object_unref (backend); @@ -1151,6 +1162,17 @@ list_done_cb (GtkPrintBackend *backend, free_printer_list (printer_list); } +static void +list_done_cb (GtkPrintBackend *backend, + PrinterList *printer_list) +{ + g_signal_handlers_disconnect_by_func (backend, list_added_cb, printer_list); + g_signal_handlers_disconnect_by_func (backend, list_done_cb, printer_list); + g_signal_handlers_disconnect_by_func (backend, backend_status_changed, printer_list); + + list_printers_remove_backend(printer_list, backend); +} + static gboolean list_printers_init (PrinterList *printer_list, GtkPrintBackend *backend) @@ -1175,11 +1197,7 @@ list_printers_init (PrinterList *printer_list, if (status == GTK_PRINT_BACKEND_STATUS_UNAVAILABLE || gtk_print_backend_printer_list_is_done (backend)) - { - printer_list->backends = g_list_remove (printer_list->backends, backend); - gtk_print_backend_destroy (backend); - g_object_unref (backend); - } + list_printers_remove_backend(printer_list, backend); else { g_signal_connect (backend, "printer-added", @@ -1246,9 +1264,9 @@ gtk_enumerate_printers (GtkPrinterFunc func, { printer_list->loop = g_main_loop_new (NULL, FALSE); - GDK_THREADS_LEAVE (); + gdk_threads_leave (); g_main_loop_run (printer_list->loop); - GDK_THREADS_ENTER (); + gdk_threads_enter (); } }