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
This commit is contained in:
Ryan Lortie 2012-02-20 13:24:33 +00:00
parent 154ce014a8
commit 88c63903a5
5 changed files with 15 additions and 15 deletions

View File

@ -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.

View File

@ -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.
*

View File

@ -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);

View File

@ -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));

View File

@ -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: