]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkprinter.c
Updated Spanish translation
[~andy/gtk] / gtk / gtkprinter.c
index 3ad30ccad656f45e0a51fa5c144152e7aea246b8..d6ac906371bf7d371a11e8e2309b72e6de308c59 100644 (file)
 #include "gtkprinter-private.h"
 #include "gtkprintbackend.h"
 #include "gtkprintjob.h"
-#include "gtkalias.h"
 
-#define GTK_PRINTER_GET_PRIVATE(o)  \
-   (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_PRINTER, GtkPrinterPrivate))
+/**
+ * SECTION:gtkprinter
+ * @Short_description: Represents a printer
+ * @Title: GtkPrinter
+ *
+ * A #GtkPrinter object represents a printer. You only need to
+ * deal directly with printers if you use the non-portable
+ * #GtkPrintUnixDialog API.
+ *
+ * A #GtkPrinter allows to get status information about the printer,
+ * such as its description, its location, the number of queued jobs,
+ * etc. Most importantly, a #GtkPrinter object can be used to create
+ * a #GtkPrintJob object, which lets you print to the printer.
+ *
+ * Printing support was added in GTK+ 2.10.
+ */
+
 
 static void gtk_printer_finalize     (GObject *object);
 
@@ -92,18 +106,6 @@ static void gtk_printer_get_property (GObject      *object,
 
 G_DEFINE_TYPE (GtkPrinter, gtk_printer, G_TYPE_OBJECT)
 
-static int
-safe_strcmp (const char *a, const char *b)
-{
-  if (a == b)
-    return 0;
-  if (a == NULL)
-    return -1;
-  if (b == NULL)
-    return 1;
-  return strcmp (a, b);
-}
-
 static void
 gtk_printer_class_init (GtkPrinterClass *class)
 {
@@ -143,7 +145,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,
@@ -240,7 +242,9 @@ gtk_printer_init (GtkPrinter *printer)
 {
   GtkPrinterPrivate *priv;
 
-  priv = printer->priv = GTK_PRINTER_GET_PRIVATE (printer); 
+  priv = printer->priv = G_TYPE_INSTANCE_GET_PRIVATE (printer,
+                                                      GTK_TYPE_PRINTER,
+                                                      GtkPrinterPrivate);
 
   priv->name = NULL;
   priv->location = NULL;
@@ -252,7 +256,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;  
@@ -410,7 +414,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
  */
@@ -432,7 +436,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);
@@ -450,7 +454,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);
@@ -468,7 +472,7 @@ gtk_printer_set_description (GtkPrinter  *printer,
 
   priv = printer->priv;
 
-  if (safe_strcmp (priv->description, description) == 0)
+  if (g_strcmp0 (priv->description, description) == 0)
     return FALSE;
 
   g_free (priv->description);
@@ -488,7 +492,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);
@@ -506,7 +510,7 @@ gtk_printer_set_state_message (GtkPrinter  *printer,
 
   priv = printer->priv;
 
-  if (safe_strcmp (priv->state_message, message) == 0)
+  if (g_strcmp0 (priv->state_message, message) == 0)
     return FALSE;
 
   g_free (priv->state_message);
@@ -526,7 +530,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);
@@ -544,7 +548,7 @@ gtk_printer_set_location (GtkPrinter  *printer,
 
   priv = printer->priv;
 
-  if (safe_strcmp (priv->location, location) == 0)
+  if (g_strcmp0 (priv->location, location) == 0)
     return FALSE;
 
   g_free (priv->location);
@@ -564,7 +568,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);
@@ -791,6 +795,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
@@ -810,6 +823,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)
 {
@@ -932,8 +954,8 @@ _gtk_printer_create_cairo_surface (GtkPrinter       *printer,
  * Lists all the paper sizes @printer supports.
  * This will return and empty list unless the printer's details are 
  * available, see gtk_printer_has_details() and gtk_printer_request_details().
- * 
- * Return value: a newly allocated list of newly allocated #GtkPageSetup s.
+ *
+ * Return value: (element-type GtkPageSetup) (transfer full): a newly allocated list of newly allocated #GtkPageSetup s.
  *
  * Since: 2.12
  */
@@ -972,10 +994,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.
@@ -1274,7 +1296,3 @@ gtk_print_capabilities_get_type (void)
 
   return etype;
 }
-
-
-#define __GTK_PRINTER_C__
-#include "gtkaliasdef.c"