From 4e316dd99e14d4aae9dee38a052a6c465a657d3d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 29 Apr 2007 04:50:28 +0000 Subject: [PATCH] Add a function to list the builtin paper sizes. (#382355, Christian 2007-04-29 Matthias Clasen * gtk/gtk.symbols: * gtk/gtkpapersize.[hc]: Add a function to list the builtin paper sizes. (#382355, Christian Persch) svn path=/trunk/; revision=17691 --- ChangeLog | 6 ++++++ docs/reference/ChangeLog | 4 ++++ docs/reference/gtk/gtk-sections.txt | 1 + gtk/gtk.symbols | 1 + gtk/gtkpapersize.c | 27 +++++++++++++++++++++++++++ gtk/gtkpapersize.h | 1 + 6 files changed, 40 insertions(+) diff --git a/ChangeLog b/ChangeLog index 40fdf4d332..13ee3196e8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-04-29 Matthias Clasen + + * gtk/gtk.symbols: + * gtk/gtkpapersize.[hc]: Add a function to list the + builtin paper sizes. (#382355, Christian Persch) + 2007-04-29 Matthias Clasen * gtk/gtk.symbols: diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 3d0d4beafe..d6e37db5f8 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2007-04-29 Matthias Clasen + + * gtk/gtk-sections.txt: Add gtk_paper_size_get_builtins + 2007-04-29 Matthias Clasen * gtk/gtk-sections.txt: Add gtk_printer_{has,request}_details diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 8727f81f23..24ecc7437a 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -6361,6 +6361,7 @@ gtk_paper_size_new_custom gtk_paper_size_copy gtk_paper_size_free gtk_paper_size_is_equal +gtk_paper_size_get_builtins gtk_paper_size_get_name gtk_paper_size_get_display_name gtk_paper_size_get_ppd_name diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index cc602ac5f1..ada3a398d1 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -2555,6 +2555,7 @@ gtk_paper_size_new_custom gtk_paper_size_copy gtk_paper_size_free gtk_paper_size_is_equal +gtk_paper_size_get_builtins gtk_paper_size_get_name gtk_paper_size_get_display_name gtk_paper_size_get_ppd_name diff --git a/gtk/gtkpapersize.c b/gtk/gtkpapersize.c index 00292df917..be21faf68e 100644 --- a/gtk/gtkpapersize.c +++ b/gtk/gtkpapersize.c @@ -430,6 +430,33 @@ gtk_paper_size_is_equal (GtkPaperSize *size1, gtk_paper_size_get_name (size2)) == 0; } +/** + * gtk_paper_size_get_builtins: + * + * Creates a list of builtin paper sizes. + * + * Return value: a newly allocated list of newly + * allocated #GtkPaperSize objects + * + * Since: 2.12 + */ +GList * +gtk_paper_size_get_builtins (void) +{ + GList *list = NULL; + guint i; + + for (i = 0; i < G_N_ELEMENTS (standard_names_offsets); ++i) + { + GtkPaperSize *size; + + size = gtk_paper_size_new_from_info (&standard_names_offsets[i]); + list = g_list_prepend (list, size); + } + + return list; +} + /** * gtk_paper_size_get_name: * @size: a #GtkPaperSize object diff --git a/gtk/gtkpapersize.h b/gtk/gtkpapersize.h index 679915cdab..8709cdf2f4 100644 --- a/gtk/gtkpapersize.h +++ b/gtk/gtkpapersize.h @@ -56,6 +56,7 @@ void gtk_paper_size_free (GtkPaperSize *size); gboolean gtk_paper_size_is_equal (GtkPaperSize *size1, GtkPaperSize *size2); +GList *gtk_paper_size_get_builtins (void); /* The width is always the shortest side, measure in mm */ G_CONST_RETURN gchar *gtk_paper_size_get_name (GtkPaperSize *size);