Simplify, make it build against cups 1.1. (#350329)

2006-08-15  Matthias Clasen  <mclasen@redhat.com>

	* modules/printbackends/cups/gtkprintbackendcups.c (create_pickone_option):
	Simplify, make it build against cups 1.1.  (#350329)
This commit is contained in:
Matthias Clasen 2006-08-15 16:05:13 +00:00 committed by Matthias Clasen
parent dd0aab11cc
commit 430a9d5ea8
3 changed files with 22 additions and 32 deletions

View File

@ -1,5 +1,8 @@
2006-08-15 Matthias Clasen <mclasen@redhat.com>
* modules/printbackends/cups/gtkprintbackendcups.c (create_pickone_option):
Simplify, make it build against cups 1.1. (#350329)
* gtk/gtkliststore.c (gtk_list_store_insert_with_values):
Fix a typo in the docs. (#349501, Carlos GUSLiBu)

View File

@ -1,5 +1,8 @@
2006-08-15 Matthias Clasen <mclasen@redhat.com>
* modules/printbackends/cups/gtkprintbackendcups.c (create_pickone_option):
Simplify, make it build against cups 1.1. (#350329)
* gtk/gtkliststore.c (gtk_list_store_insert_with_values):
Fix a typo in the docs. (#349501, Carlos GUSLiBu)

View File

@ -1824,18 +1824,19 @@ available_choices (ppd_file_t *ppd,
return option->num_choices - num_conflicts + add_auto;
}
#if HAVE_CUPS_API_1_2
static GtkPrinterOption *
create_pickone_option_custom (ppd_file_t *ppd_file,
ppd_option_t *ppd_option,
ppd_coption_t *coption,
const gchar *gtk_name)
create_pickone_option (ppd_file_t *ppd_file,
ppd_option_t *ppd_option,
const gchar *gtk_name)
{
GtkPrinterOption *option;
ppd_choice_t **available;
char *label;
int n_choices;
int i;
#ifdef HAVE_CUPS_API_1_2
ppd_coption_t *coption;
#endif
g_assert (ppd_option->ui == PPD_UI_PICKONE);
@ -1844,15 +1845,20 @@ create_pickone_option_custom (ppd_file_t *ppd_file,
n_choices = available_choices (ppd_file, ppd_option, &available, g_str_has_prefix (gtk_name, "gtk-"));
if (n_choices > 0)
{
ppd_cparam_t *cparam;
label = get_option_text (ppd_file, ppd_option);
/* right now only support one parameter per custom option
* if more than one print warning and only offer the default choices
*/
label = get_option_text (ppd_file, ppd_option);
#ifdef HAVE_CUPS_API_1_2
coption = ppdFindCustomOption (ppd_file, ppd_option->keyword);
if (coption)
{
ppd_cparam_t *cparam;
cparam = ppdFirstCustomParam (coption);
if (ppdNextCustomParam (coption) == NULL)
@ -1893,6 +1899,7 @@ create_pickone_option_custom (ppd_file_t *ppd_file,
else
g_warning ("Not Supported: PPD Custom Option has more than one parameter");
}
#endif /* HAVE_CUPS_API_1_2 */
if (!option)
option = gtk_printer_option_new (gtk_name, label,
@ -1924,19 +1931,6 @@ create_pickone_option_custom (ppd_file_t *ppd_file,
return option;
}
#endif /* HAVE_CUPS_API_1_2 */
static GtkPrinterOption *
create_pickone_option (ppd_file_t *ppd_file,
ppd_option_t *ppd_option,
const gchar *gtk_name)
{
GtkPrinterOption *option;
option = create_pickone_option_custom (ppd_file, ppd_option, NULL, gtk_name);
return option;
}
static GtkPrinterOption *
create_boolean_option (ppd_file_t *ppd_file,
@ -2019,11 +2013,6 @@ handle_option (GtkPrinterOptionSet *set,
GtkPrinterOption *option;
char *name;
#ifdef HAVE_CUPS_API_1_2
ppd_coption_t *coption = NULL;
coption = ppdFindCustomOption (ppd_file, ppd_option->keyword);
#endif
if (STRING_IN_TABLE (ppd_option->keyword, cups_option_blacklist))
return;
@ -2032,12 +2021,7 @@ handle_option (GtkPrinterOptionSet *set,
option = NULL;
if (ppd_option->ui == PPD_UI_PICKONE)
{
#ifdef HAVE_CUPS_API_1_2
if (coption)
option = create_pickone_option_custom (ppd_file, ppd_option, coption, name);
else
#endif
option = create_pickone_option (ppd_file, ppd_option, name);
option = create_pickone_option (ppd_file, ppd_option, name);
}
else if (ppd_option->ui == PPD_UI_BOOLEAN)
{