~ubuntu-branches/ubuntu/trusty/unity-control-center/trusty

« back to all changes in this revision

Viewing changes to panels/printers/pp-utils.h

  • Committer: Package Import Robot
  • Author(s): Robert Ancell
  • Date: 2014-01-08 16:29:18 UTC
  • Revision ID: package-import@ubuntu.com-20140108162918-g29dd08tr913y2qh
Tags: upstream-14.04.0
ImportĀ upstreamĀ versionĀ 14.04.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 
2
 *
 
3
 * Copyright 2009-2010  Red Hat, Inc,
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 *
 
19
 */
 
20
 
 
21
#ifndef __PP_UTILS_H__
 
22
#define __PP_UTILS_H__
 
23
 
 
24
#include <gtk/gtk.h>
 
25
#include <cups/cups.h>
 
26
 
 
27
#define ALLOWED_CHARACTERS "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
 
28
 
 
29
#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism"
 
30
 
 
31
#define SCP_BUS   "org.fedoraproject.Config.Printing"
 
32
#define SCP_PATH  "/org/fedoraproject/Config/Printing"
 
33
#define SCP_IFACE "org.fedoraproject.Config.Printing"
 
34
 
 
35
G_BEGIN_DECLS
 
36
 
 
37
typedef void (*UserResponseCallback) (GtkDialog *dialog, gint response_id, gpointer user_data);
 
38
 
 
39
/*
 
40
 * Match level of PPD driver.
 
41
 */
 
42
enum
 
43
{
 
44
  PPD_NO_MATCH = 0,
 
45
  PPD_GENERIC_MATCH,
 
46
  PPD_CLOSE_MATCH,
 
47
  PPD_EXACT_MATCH,
 
48
  PPD_EXACT_CMD_MATCH
 
49
};
 
50
 
 
51
enum
 
52
{
 
53
  ACQUISITION_METHOD_DEFAULT_CUPS_SERVER = 0,
 
54
  ACQUISITION_METHOD_REMOTE_CUPS_SERVER,
 
55
  ACQUISITION_METHOD_SNMP
 
56
};
 
57
 
 
58
typedef struct
 
59
{
 
60
  gchar *ppd_name;
 
61
  gchar *ppd_display_name;
 
62
  gint   ppd_match_level;
 
63
} PPDName;
 
64
 
 
65
typedef struct
 
66
{
 
67
  gchar    *manufacturer_name;
 
68
  gchar    *manufacturer_display_name;
 
69
  PPDName **ppds;
 
70
  gsize     num_of_ppds;
 
71
} PPDManufacturerItem;
 
72
 
 
73
typedef struct
 
74
{
 
75
  PPDManufacturerItem **manufacturers;
 
76
  gsize                 num_of_manufacturers;
 
77
} PPDList;
 
78
 
 
79
gchar      *get_tag_value (const gchar *tag_string,
 
80
                           const gchar *tag_name);
 
81
 
 
82
char       *get_dest_attr (const char *dest_name,
 
83
                           const char *attr);
 
84
 
 
85
gchar      *get_ppd_attribute (const gchar *ppd_file_name,
 
86
                               const gchar *attribute_name);
 
87
 
 
88
void        cancel_cups_subscription (gint id);
 
89
 
 
90
gint        renew_cups_subscription (gint id,
 
91
                                     const char * const *events,
 
92
                                     gint num_events,
 
93
                                     gint lease_duration);
 
94
 
 
95
void        set_local_default_printer (const gchar *printer_name);
 
96
 
 
97
gboolean    printer_set_location (const gchar *printer_name,
 
98
                                  const gchar *location);
 
99
 
 
100
gboolean    printer_set_accepting_jobs (const gchar *printer_name,
 
101
                                        gboolean     accepting_jobs,
 
102
                                        const gchar *reason);
 
103
 
 
104
gboolean    printer_set_enabled (const gchar *printer_name,
 
105
                                 gboolean     enabled);
 
106
 
 
107
gboolean    printer_rename (const gchar *old_name,
 
108
                            const gchar *new_name);
 
109
 
 
110
gboolean    printer_delete (const gchar *printer_name);
 
111
 
 
112
gboolean    printer_set_default (const gchar *printer_name);
 
113
 
 
114
gboolean    printer_set_shared (const gchar *printer_name,
 
115
                                gboolean     shared);
 
116
 
 
117
gboolean    printer_set_job_sheets (const gchar *printer_name,
 
118
                                    const gchar *start_sheet,
 
119
                                    const gchar *end_sheet);
 
120
 
 
121
gboolean    printer_set_policy (const gchar *printer_name,
 
122
                                const gchar *policy,
 
123
                                gboolean     error_policy);
 
124
 
 
125
gboolean    printer_set_users (const gchar  *printer_name,
 
126
                               gchar       **users,
 
127
                               gboolean      allowed);
 
128
 
 
129
gboolean    class_add_printer (const gchar *class_name,
 
130
                               const gchar *printer_name);
 
131
 
 
132
gboolean    printer_is_local (cups_ptype_t  printer_type,
 
133
                              const gchar  *device_uri);
 
134
 
 
135
gchar      *printer_get_hostname (cups_ptype_t  printer_type,
 
136
                                  const gchar  *device_uri,
 
137
                                  const gchar  *printer_uri);
 
138
 
 
139
void        printer_set_default_media_size (const gchar *printer_name);
 
140
 
 
141
typedef void (*PSPCallback) (gchar    *printer_name,
 
142
                             gboolean  success,
 
143
                             gpointer  user_data);
 
144
 
 
145
void        printer_set_ppd_async (const gchar  *printer_name,
 
146
                                   const gchar  *ppd_name,
 
147
                                   GCancellable *cancellable,
 
148
                                   PSPCallback   callback,
 
149
                                   gpointer      user_data);
 
150
 
 
151
void        printer_set_ppd_file_async (const gchar *printer_name,
 
152
                                        const gchar *ppd_filename,
 
153
                                        GCancellable *cancellable,
 
154
                                        PSPCallback   callback,
 
155
                                        gpointer      user_data);
 
156
 
 
157
typedef void (*GPNCallback) (PPDName     **names,
 
158
                             const gchar  *printer_name,
 
159
                             gboolean      cancelled,
 
160
                             gpointer      user_data);
 
161
 
 
162
void        get_ppd_names_async (gchar        *printer_name,
 
163
                                 gint          count,
 
164
                                 GCancellable *cancellable,
 
165
                                 GPNCallback   callback,
 
166
                                 gpointer      user_data);
 
167
 
 
168
typedef void (*GAPCallback) (PPDList  *ppds,
 
169
                             gpointer  user_data);
 
170
 
 
171
void        get_all_ppds_async (GCancellable *cancellable,
 
172
                                GAPCallback   callback,
 
173
                                gpointer      user_data);
 
174
 
 
175
PPDList    *ppd_list_copy (PPDList *list);
 
176
void        ppd_list_free (PPDList *list);
 
177
 
 
178
enum
 
179
{
 
180
  IPP_ATTRIBUTE_TYPE_INTEGER = 0,
 
181
  IPP_ATTRIBUTE_TYPE_STRING,
 
182
  IPP_ATTRIBUTE_TYPE_RANGE,
 
183
  IPP_ATTRIBUTE_TYPE_BOOLEAN
 
184
};
 
185
 
 
186
typedef struct
 
187
{
 
188
  gboolean  boolean_value;
 
189
  gchar    *string_value;
 
190
  gint      integer_value;
 
191
  gint      lower_range;
 
192
  gint      upper_range;
 
193
} IPPAttributeValue;
 
194
 
 
195
typedef struct
 
196
{
 
197
  gchar             *attribute_name;
 
198
  IPPAttributeValue *attribute_values;
 
199
  gint               num_of_values;
 
200
  gint               attribute_type;
 
201
} IPPAttribute;
 
202
 
 
203
typedef void (*GIACallback) (GHashTable *table,
 
204
                             gpointer    user_data);
 
205
 
 
206
void        get_ipp_attributes_async (const gchar  *printer_name,
 
207
                                      gchar       **attributes_names,
 
208
                                      GIACallback   callback,
 
209
                                      gpointer      user_data);
 
210
 
 
211
IPPAttribute *ipp_attribute_copy (IPPAttribute *attr);
 
212
 
 
213
void        ipp_attribute_free (IPPAttribute *attr);
 
214
 
 
215
gchar      *get_standard_manufacturers_name (gchar *name);
 
216
 
 
217
typedef void (*PGPCallback) (const gchar *ppd_filename,
 
218
                             gpointer     user_data);
 
219
 
 
220
void        printer_get_ppd_async (const gchar *printer_name,
 
221
                                   const gchar *host_name,
 
222
                                   gint         port,
 
223
                                   PGPCallback  callback,
 
224
                                   gpointer     user_data);
 
225
 
 
226
typedef void (*GNDCallback) (cups_dest_t *destination,
 
227
                             gpointer     user_data);
 
228
 
 
229
void        get_named_dest_async (const gchar *printer_name,
 
230
                                  GNDCallback  callback,
 
231
                                  gpointer     user_data);
 
232
 
 
233
typedef void (*PAOCallback) (gboolean success,
 
234
                             gpointer user_data);
 
235
 
 
236
void        printer_add_option_async (const gchar   *printer_name,
 
237
                                      const gchar   *option_name,
 
238
                                      gchar        **values,
 
239
                                      gboolean       set_default,
 
240
                                      GCancellable  *cancellable,
 
241
                                      PAOCallback    callback,
 
242
                                      gpointer       user_data);
 
243
 
 
244
typedef void (*CGJCallback) (cups_job_t *jobs,
 
245
                             gint        num_of_jobs,
 
246
                             gpointer    user_data);
 
247
 
 
248
void        cups_get_jobs_async (const gchar *printer_name,
 
249
                                 gboolean     my_jobs,
 
250
                                 gint         which_jobs,
 
251
                                 CGJCallback  callback,
 
252
                                 gpointer     user_data);
 
253
 
 
254
typedef void (*JCPCallback) (gpointer user_data);
 
255
 
 
256
void job_cancel_purge_async (gint          job_id,
 
257
                             gboolean      job_purge,
 
258
                             GCancellable *cancellable,
 
259
                             JCPCallback   callback,
 
260
                             gpointer      user_data);
 
261
 
 
262
typedef void (*JSHUCallback) (gpointer user_data);
 
263
 
 
264
void job_set_hold_until_async (gint          job_id,
 
265
                               const gchar  *job_hold_until,
 
266
                               GCancellable *cancellable,
 
267
                               JSHUCallback  callback,
 
268
                               gpointer      user_data);
 
269
typedef struct{
 
270
  gchar *device_class;
 
271
  gchar *device_id;
 
272
  gchar *device_info;
 
273
  gchar *device_make_and_model;
 
274
  gchar *device_uri;
 
275
  gchar *device_location;
 
276
  gchar *device_name;
 
277
  gchar *device_ppd;
 
278
  gchar *host_name;
 
279
  gint   host_port;
 
280
  gint   acquisition_method;
 
281
} PpPrintDevice;
 
282
 
 
283
void        pp_print_device_free (PpPrintDevice *device);
 
284
 
 
285
const gchar *get_paper_size_from_locale (void);
 
286
 
 
287
typedef void (*GCDCallback) (GList          *devices,
 
288
                             gboolean        finished,
 
289
                             gboolean        cancelled,
 
290
                             gpointer        user_data);
 
291
 
 
292
void        get_cups_devices_async (GCancellable *cancellable,
 
293
                                    GCDCallback   callback,
 
294
                                    gpointer      user_data);
 
295
 
 
296
G_END_DECLS
 
297
 
 
298
#endif /* __PP_UTILS_H */