[gtk+] printing: Rename GTK_UNIT_PIXEL to GTK_UNIT_NONE



commit 88c63903a5eeac40ef2cd210468705c20f580596
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Feb 20 13:24:33 2012 +0000

    printing: Rename GTK_UNIT_PIXEL to GTK_UNIT_NONE
    
    ...and document that many functions don't accept "none" as a unit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=460908

 gtk/gtkenums.h          |    4 +++-
 gtk/gtkpapersize.c      |   16 ++++++++--------
 gtk/gtkprintcontext.c   |    4 ++--
 gtk/gtkprintoperation.c |    4 ++--
 gtk/gtkprintutils.c     |    2 --
 5 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index a24ac26..e409d79 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -753,12 +753,14 @@ typedef enum
 
 typedef enum
 {
-  GTK_UNIT_PIXEL,
+  GTK_UNIT_NONE,
   GTK_UNIT_POINTS,
   GTK_UNIT_INCH,
   GTK_UNIT_MM
 } GtkUnit;
 
+#define GTK_UNIT_PIXEL GTK_UNIT_NONE
+
 /**
  * GtkTreeViewGridLines:
  * @GTK_TREE_VIEW_GRID_LINES_NONE: No grid lines.
diff --git a/gtk/gtkpapersize.c b/gtk/gtkpapersize.c
index deb4ea3..c4e7e0c 100644
--- a/gtk/gtkpapersize.c
+++ b/gtk/gtkpapersize.c
@@ -348,7 +348,7 @@ gtk_paper_size_new_from_ppd (const gchar *ppd_name,
  * @display_name: the human-readable name
  * @width: the paper width, in units of @unit
  * @height: the paper height, in units of @unit
- * @unit: the unit for @width and @height
+ * @unit: the unit for @width and @height. not %GTK_UNIT_NONE.
  *
  * Creates a new #GtkPaperSize object with the
  * given parameters.
@@ -367,7 +367,7 @@ gtk_paper_size_new_custom (const gchar *name,
 {
   GtkPaperSize *size;
   g_return_val_if_fail (name != NULL, NULL);
-  g_return_val_if_fail (unit != GTK_UNIT_PIXEL, NULL);
+  g_return_val_if_fail (unit != GTK_UNIT_NONE, NULL);
 
   size = g_slice_new0 (GtkPaperSize);
 
@@ -570,7 +570,7 @@ gtk_paper_size_get_ppd_name (GtkPaperSize *size)
 /**
  * gtk_paper_size_get_width:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the paper width of the #GtkPaperSize, in
  * units of @unit.
@@ -589,7 +589,7 @@ gtk_paper_size_get_width (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_height:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the paper height of the #GtkPaperSize, in
  * units of @unit.
@@ -717,7 +717,7 @@ gtk_paper_size_get_default (void)
 /**
  * gtk_paper_size_get_default_top_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default top margin for the #GtkPaperSize.
  *
@@ -738,7 +738,7 @@ gtk_paper_size_get_default_top_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_bottom_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default bottom margin for the #GtkPaperSize.
  *
@@ -767,7 +767,7 @@ gtk_paper_size_get_default_bottom_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_left_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default left margin for the #GtkPaperSize.
  *
@@ -788,7 +788,7 @@ gtk_paper_size_get_default_left_margin (GtkPaperSize *size,
 /**
  * gtk_paper_size_get_default_right_margin:
  * @size: a #GtkPaperSize object
- * @unit: the unit for the return value
+ * @unit: the unit for the return value, not %GTK_UNIT_NONE
  *
  * Gets the default right margin for the #GtkPaperSize.
  *
diff --git a/gtk/gtkprintcontext.c b/gtk/gtkprintcontext.c
index 3c604fa..1de8f0c 100644
--- a/gtk/gtkprintcontext.c
+++ b/gtk/gtkprintcontext.c
@@ -214,7 +214,7 @@ gtk_print_context_set_cairo_context (GtkPrintContext *context,
   switch (context->op->priv->unit)
     {
     default:
-    case GTK_UNIT_PIXEL:
+    case GTK_UNIT_NONE:
       /* Do nothing, this is the cairo default unit */
       context->pixels_per_unit_x = 1.0;
       context->pixels_per_unit_y = 1.0;
@@ -292,7 +292,7 @@ _gtk_print_context_translate_into_margin (GtkPrintContext *context)
 
   g_return_if_fail (GTK_IS_PRINT_CONTEXT (context));
 
-  /* We do it this way to also handle GTK_UNIT_PIXELS */
+  /* We do it this way to also handle GTK_UNIT_NONE */
   left = gtk_page_setup_get_left_margin (context->page_setup, GTK_UNIT_INCH);
   top = gtk_page_setup_get_top_margin (context->page_setup, GTK_UNIT_INCH);
 
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 7521221..90b8d8a 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -248,7 +248,7 @@ gtk_print_operation_init (GtkPrintOperation *operation)
   priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_READY;
 
   priv->rloop = NULL;
-  priv->unit = GTK_UNIT_PIXEL;
+  priv->unit = GTK_UNIT_NONE;
 
   appname = g_get_application_name ();
   if (appname == NULL)
@@ -1233,7 +1233,7 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
 						      P_("Unit"),
 						      P_("The unit in which distances can be measured in the context"),
 						      GTK_TYPE_UNIT,
-						      GTK_UNIT_PIXEL,
+						      GTK_UNIT_NONE,
 						      GTK_PARAM_READWRITE));
   
   
diff --git a/gtk/gtkprintutils.c b/gtk/gtkprintutils.c
index 07a50ba..35affcf 100644
--- a/gtk/gtkprintutils.c
+++ b/gtk/gtkprintutils.c
@@ -30,7 +30,6 @@ _gtk_print_convert_to_mm (gdouble len,
     case GTK_UNIT_INCH:
       return len * MM_PER_INCH;
     default:
-    case GTK_UNIT_PIXEL:
       g_warning ("Unsupported unit");
       /* Fall through */
     case GTK_UNIT_POINTS:
@@ -50,7 +49,6 @@ _gtk_print_convert_from_mm (gdouble len,
     case GTK_UNIT_INCH:
       return len / MM_PER_INCH;
     default:
-    case GTK_UNIT_PIXEL:
       g_warning ("Unsupported unit");
       /* Fall through */
     case GTK_UNIT_POINTS:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]