1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3
* Copyright 2009-2010 Red Hat, Inc,
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
#ifndef __PP_UTILS_H__
22
#define __PP_UTILS_H__
25
#include <cups/cups.h>
27
#define ALLOWED_CHARACTERS "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
29
#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism"
31
#define SCP_BUS "org.fedoraproject.Config.Printing"
32
#define SCP_PATH "/org/fedoraproject/Config/Printing"
33
#define SCP_IFACE "org.fedoraproject.Config.Printing"
37
typedef void (*UserResponseCallback) (GtkDialog *dialog, gint response_id, gpointer user_data);
40
* Match level of PPD driver.
53
ACQUISITION_METHOD_DEFAULT_CUPS_SERVER = 0,
54
ACQUISITION_METHOD_REMOTE_CUPS_SERVER,
55
ACQUISITION_METHOD_SNMP
61
gchar *ppd_display_name;
67
gchar *manufacturer_name;
68
gchar *manufacturer_display_name;
71
} PPDManufacturerItem;
75
PPDManufacturerItem **manufacturers;
76
gsize num_of_manufacturers;
79
gchar *get_tag_value (const gchar *tag_string,
80
const gchar *tag_name);
82
char *get_dest_attr (const char *dest_name,
85
gchar *get_ppd_attribute (const gchar *ppd_file_name,
86
const gchar *attribute_name);
88
void cancel_cups_subscription (gint id);
90
gint renew_cups_subscription (gint id,
91
const char * const *events,
95
void set_local_default_printer (const gchar *printer_name);
97
gboolean printer_set_location (const gchar *printer_name,
98
const gchar *location);
100
gboolean printer_set_accepting_jobs (const gchar *printer_name,
101
gboolean accepting_jobs,
102
const gchar *reason);
104
gboolean printer_set_enabled (const gchar *printer_name,
107
gboolean printer_rename (const gchar *old_name,
108
const gchar *new_name);
110
gboolean printer_delete (const gchar *printer_name);
112
gboolean printer_set_default (const gchar *printer_name);
114
gboolean printer_set_shared (const gchar *printer_name,
117
gboolean printer_set_job_sheets (const gchar *printer_name,
118
const gchar *start_sheet,
119
const gchar *end_sheet);
121
gboolean printer_set_policy (const gchar *printer_name,
123
gboolean error_policy);
125
gboolean printer_set_users (const gchar *printer_name,
129
gboolean class_add_printer (const gchar *class_name,
130
const gchar *printer_name);
132
gboolean printer_is_local (cups_ptype_t printer_type,
133
const gchar *device_uri);
135
gchar *printer_get_hostname (cups_ptype_t printer_type,
136
const gchar *device_uri,
137
const gchar *printer_uri);
139
void printer_set_default_media_size (const gchar *printer_name);
141
typedef void (*PSPCallback) (gchar *printer_name,
145
void printer_set_ppd_async (const gchar *printer_name,
146
const gchar *ppd_name,
147
GCancellable *cancellable,
148
PSPCallback callback,
151
void printer_set_ppd_file_async (const gchar *printer_name,
152
const gchar *ppd_filename,
153
GCancellable *cancellable,
154
PSPCallback callback,
157
typedef void (*GPNCallback) (PPDName **names,
158
const gchar *printer_name,
162
void get_ppd_names_async (gchar *printer_name,
164
GCancellable *cancellable,
165
GPNCallback callback,
168
typedef void (*GAPCallback) (PPDList *ppds,
171
void get_all_ppds_async (GCancellable *cancellable,
172
GAPCallback callback,
175
PPDList *ppd_list_copy (PPDList *list);
176
void ppd_list_free (PPDList *list);
180
IPP_ATTRIBUTE_TYPE_INTEGER = 0,
181
IPP_ATTRIBUTE_TYPE_STRING,
182
IPP_ATTRIBUTE_TYPE_RANGE,
183
IPP_ATTRIBUTE_TYPE_BOOLEAN
188
gboolean boolean_value;
197
gchar *attribute_name;
198
IPPAttributeValue *attribute_values;
203
typedef void (*GIACallback) (GHashTable *table,
206
void get_ipp_attributes_async (const gchar *printer_name,
207
gchar **attributes_names,
208
GIACallback callback,
211
IPPAttribute *ipp_attribute_copy (IPPAttribute *attr);
213
void ipp_attribute_free (IPPAttribute *attr);
215
gchar *get_standard_manufacturers_name (gchar *name);
217
typedef void (*PGPCallback) (const gchar *ppd_filename,
220
void printer_get_ppd_async (const gchar *printer_name,
221
const gchar *host_name,
223
PGPCallback callback,
226
typedef void (*GNDCallback) (cups_dest_t *destination,
229
void get_named_dest_async (const gchar *printer_name,
230
GNDCallback callback,
233
typedef void (*PAOCallback) (gboolean success,
236
void printer_add_option_async (const gchar *printer_name,
237
const gchar *option_name,
239
gboolean set_default,
240
GCancellable *cancellable,
241
PAOCallback callback,
244
typedef void (*CGJCallback) (cups_job_t *jobs,
248
void cups_get_jobs_async (const gchar *printer_name,
251
CGJCallback callback,
254
typedef void (*JCPCallback) (gpointer user_data);
256
void job_cancel_purge_async (gint job_id,
258
GCancellable *cancellable,
259
JCPCallback callback,
262
typedef void (*JSHUCallback) (gpointer user_data);
264
void job_set_hold_until_async (gint job_id,
265
const gchar *job_hold_until,
266
GCancellable *cancellable,
267
JSHUCallback callback,
273
gchar *device_make_and_model;
275
gchar *device_location;
280
gint acquisition_method;
283
void pp_print_device_free (PpPrintDevice *device);
285
const gchar *get_paper_size_from_locale (void);
287
typedef void (*GCDCallback) (GList *devices,
292
void get_cups_devices_async (GCancellable *cancellable,
293
GCDCallback callback,
298
#endif /* __PP_UTILS_H */