mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-06 00:30:08 +00:00
Rename gtk_paper_size_get_builtins() to gtk_paper_size_get_paper_sizes()
2007-04-30 Matthias Clasen <mclasen@redhat.com> * gtk/gtk.symbols: * gtk/gtkpapersize.[hc]: Rename gtk_paper_size_get_builtins() to gtk_paper_size_get_paper_sizes() and optionally include custom paper sizes. * gtk/gtkpagesetupunixdialog.c: Internally export a function to load custom paper sizes. * modules/printbackends/file/gtkprintbackendfile.c: Implement printer_list_papers, returning all paper sizes. (#434329, Christian Persch) svn path=/trunk/; revision=17728
This commit is contained in:
parent
23263cd43c
commit
7253a5a292
14
ChangeLog
14
ChangeLog
@ -1,3 +1,17 @@
|
||||
2007-04-30 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtk.symbols:
|
||||
* gtk/gtkpapersize.[hc]: Rename gtk_paper_size_get_builtins()
|
||||
to gtk_paper_size_get_paper_sizes() and optionally include
|
||||
custom paper sizes.
|
||||
|
||||
* gtk/gtkpagesetupunixdialog.c: Internally export a function
|
||||
to load custom paper sizes.
|
||||
|
||||
* modules/printbackends/file/gtkprintbackendfile.c: Implement
|
||||
printer_list_papers, returning all paper sizes. (#434329,
|
||||
Christian Persch)
|
||||
|
||||
2007-04-30 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gtk/gtkprintoperation.c: Translate the default job
|
||||
|
@ -6366,7 +6366,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_paper_sizes
|
||||
gtk_paper_size_get_name
|
||||
gtk_paper_size_get_display_name
|
||||
gtk_paper_size_get_ppd_name
|
||||
|
@ -2561,7 +2561,7 @@ gtk_paper_size_to_key_file
|
||||
gtk_paper_size_copy
|
||||
gtk_paper_size_free
|
||||
gtk_paper_size_is_equal
|
||||
gtk_paper_size_get_builtins
|
||||
gtk_paper_size_get_paper_sizes
|
||||
gtk_paper_size_get_name
|
||||
gtk_paper_size_get_display_name
|
||||
gtk_paper_size_get_ppd_name
|
||||
|
@ -181,14 +181,15 @@ custom_paper_get_filename (void)
|
||||
return filename;
|
||||
}
|
||||
|
||||
static void
|
||||
load_custom_papers (GtkListStore *store)
|
||||
GList *
|
||||
_gtk_load_custom_papers (void)
|
||||
{
|
||||
GKeyFile *keyfile;
|
||||
gchar *filename;
|
||||
gchar **groups;
|
||||
gsize n_groups, i;
|
||||
gboolean load_ok;
|
||||
GList *result = NULL;
|
||||
|
||||
filename = custom_paper_get_filename ();
|
||||
|
||||
@ -198,7 +199,7 @@ load_custom_papers (GtkListStore *store)
|
||||
if (!load_ok)
|
||||
{
|
||||
g_key_file_free (keyfile);
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
groups = g_key_file_get_groups (keyfile, &n_groups);
|
||||
@ -211,15 +212,34 @@ load_custom_papers (GtkListStore *store)
|
||||
if (!page_setup)
|
||||
continue;
|
||||
|
||||
result = g_list_prepend (result, page_setup);
|
||||
}
|
||||
|
||||
g_strfreev (groups);
|
||||
g_key_file_free (keyfile);
|
||||
|
||||
return g_list_reverse (result);
|
||||
}
|
||||
|
||||
static void
|
||||
load_custom_papers (GtkListStore *store)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GList *papers, *p;
|
||||
GtkPageSetup *page_setup;
|
||||
|
||||
papers = _gtk_load_custom_papers ();
|
||||
for (p = papers; p; p = p->next)
|
||||
{
|
||||
page_setup = p->data;
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
0, page_setup,
|
||||
-1);
|
||||
g_object_unref (page_setup);
|
||||
}
|
||||
|
||||
g_strfreev (groups);
|
||||
g_key_file_free (keyfile);
|
||||
|
||||
g_list_free (papers);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -433,10 +433,14 @@ gtk_paper_size_is_equal (GtkPaperSize *size1,
|
||||
gtk_paper_size_get_name (size2)) == 0;
|
||||
}
|
||||
|
||||
GList * _gtk_load_custom_papers (void);
|
||||
|
||||
/**
|
||||
* gtk_paper_size_get_builtins:
|
||||
* gtk_paper_size_get_paper_sizes:
|
||||
* @include_custom: whether to include custom paper sizes
|
||||
* as defined in the page setup dialog
|
||||
*
|
||||
* Creates a list of builtin paper sizes.
|
||||
* Creates a list of known paper sizes.
|
||||
*
|
||||
* Return value: a newly allocated list of newly
|
||||
* allocated #GtkPaperSize objects
|
||||
@ -444,11 +448,14 @@ gtk_paper_size_is_equal (GtkPaperSize *size1,
|
||||
* Since: 2.12
|
||||
*/
|
||||
GList *
|
||||
gtk_paper_size_get_builtins (void)
|
||||
gtk_paper_size_get_paper_sizes (gboolean include_custom)
|
||||
{
|
||||
GList *list = NULL;
|
||||
guint i;
|
||||
|
||||
if (include_custom)
|
||||
list = _gtk_load_custom_papers ();
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (standard_names_offsets); ++i)
|
||||
{
|
||||
GtkPaperSize *size;
|
||||
@ -457,9 +464,10 @@ gtk_paper_size_get_builtins (void)
|
||||
list = g_list_prepend (list, size);
|
||||
}
|
||||
|
||||
return list;
|
||||
return g_list_reverse (list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_paper_size_get_name:
|
||||
* @size: a #GtkPaperSize object
|
||||
|
@ -103,6 +103,8 @@ static cairo_surface_t * file_printer_create_cairo_surface (GtkPrinter
|
||||
gdouble height,
|
||||
GIOChannel *cache_io);
|
||||
|
||||
static GList * file_printer_list_papers (GtkPrinter *printer);
|
||||
|
||||
static void
|
||||
gtk_print_backend_file_register_type (GTypeModule *module)
|
||||
{
|
||||
@ -179,6 +181,7 @@ gtk_print_backend_file_class_init (GtkPrintBackendFileClass *class)
|
||||
backend_class->printer_get_options = file_printer_get_options;
|
||||
backend_class->printer_get_settings_from_options = file_printer_get_settings_from_options;
|
||||
backend_class->printer_prepare_for_print = file_printer_prepare_for_print;
|
||||
backend_class->printer_list_papers = file_printer_list_papers;
|
||||
}
|
||||
|
||||
/* return N_FORMATS if no explicit format in the settings */
|
||||
@ -600,3 +603,27 @@ file_printer_prepare_for_print (GtkPrinter *printer,
|
||||
print_job->page_set = gtk_print_settings_get_page_set (settings);
|
||||
print_job->rotate_to_orientation = TRUE;
|
||||
}
|
||||
|
||||
static GList *
|
||||
file_printer_list_papers (GtkPrinter *printer)
|
||||
{
|
||||
GList *result = NULL;
|
||||
GList *papers, *p;
|
||||
GtkPageSetup *page_setup;
|
||||
|
||||
papers = gtk_paper_size_get_paper_sizes (TRUE);
|
||||
|
||||
for (p = papers; p; p = p->next)
|
||||
{
|
||||
GtkPaperSize *paper_size = p->data;
|
||||
|
||||
page_setup = gtk_page_setup_new ();
|
||||
gtk_page_setup_set_paper_size (page_setup, paper_size);
|
||||
gtk_paper_size_free (paper_size);
|
||||
result = g_list_prepend (result, page_setup);
|
||||
}
|
||||
|
||||
g_list_free (papers);
|
||||
|
||||
return g_list_reverse (result);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user