~ubuntu-branches/ubuntu/oneiric/cups-pk-helper/oneiric-proposed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
 * vim: set et ts=8 sw=8:
 *
 * Copyright (C) 2008 Novell, Inc.
 *
 * Authors: Vincent Untz
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 *
 */

#ifndef CPH_CUPS_H
#define CPH_CUPS_H

#include <glib-object.h>

G_BEGIN_DECLS

#define CPH_TYPE_CUPS         (cph_cups_get_type ())
#define CPH_CUPS(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), CPH_TYPE_CUPS, CphCups))
#define CPH_CUPS_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), CPH_TYPE_CUPS, CphCupsClass))
#define CPH_IS_CUPS(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), CPH_TYPE_CUPS))
#define CPH_IS_CUPS_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), CPH_TYPE_CUPS))
#define CPH_CUPS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CPH_TYPE_CUPS, CphCupsClass))

typedef struct CphCupsPrivate CphCupsPrivate;

typedef struct
{
        GObject         parent;
        CphCupsPrivate *priv;
} CphCups;

typedef struct
{
        GObjectClass parent_class;
} CphCupsClass;

typedef enum
{
        CPH_JOB_STATUS_INVALID,
        CPH_JOB_STATUS_OWNED_BY_USER,
        CPH_JOB_STATUS_NOT_OWNED_BY_USER
} CphJobStatus;

GType     cph_cups_get_type    (void);

CphCups  *cph_cups_new         (void);

const char *cph_cups_last_status_to_string (CphCups *cups);

gboolean cph_cups_is_class (CphCups    *cups,
                            const char *name);

char *cph_cups_printer_get_uri (CphCups    *cups,
                                const char *printer_name);

gboolean cph_cups_is_printer_local (CphCups    *cups,
                                    const char *printer_name);

gboolean cph_cups_file_get (CphCups      *cups,
                            const char   *resource,
                            const char   *filename,
                            unsigned int  sender_uid);

gboolean cph_cups_file_put (CphCups      *cups,
                            const char   *resource,
                            const char   *filename,
                            unsigned int  sender_uid);

GHashTable *cph_cups_server_get_settings (CphCups *cups);

gboolean cph_cups_server_set_settings (CphCups    *cups,
                                       GHashTable *settings);

GHashTable *cph_cups_devices_get (CphCups     *cups,
                                  int          timeout,
                                  int          limit,
                                  const char **include_schemes,
                                  const char **exclude_schemes);

gboolean cph_cups_printer_add (CphCups    *cups,
                               const char *printer_name,
                               const char *printer_uri,
                               const char *ppd_file,
                               const char *info,
                               const char *location);

gboolean cph_cups_printer_add_with_ppd_file (CphCups    *cups,
                                             const char *printer_name,
                                             const char *printer_uri,
                                             const char *ppd_filename,
                                             const char *info,
                                             const char *location);

gboolean cph_cups_printer_delete (CphCups    *cups,
                                  const char *printer_name);

gboolean cph_cups_printer_set_default (CphCups    *cups,
                                       const char *printer_name);

gboolean cph_cups_printer_set_enabled (CphCups    *cups,
                                       const char *printer_name,
                                       gboolean    enabled);

gboolean cph_cups_printer_set_uri (CphCups    *cups,
                                   const char *printer_name,
                                   const char *printer_uri);

gboolean cph_cups_printer_set_accept_jobs (CphCups    *cups,
                                           const char *printer_name,
                                           gboolean    enabled,
                                           const char *reason);

gboolean cph_cups_class_add_printer (CphCups    *cups,
                                     const char *class_name,
                                     const char *printer_name);

gboolean cph_cups_class_delete_printer (CphCups    *cups,
                                        const char *class_name,
                                        const char *printer_name);

gboolean cph_cups_class_delete (CphCups    *cups,
                                const char *class_name);

gboolean cph_cups_printer_class_set_info (CphCups    *cups,
                                          const char *printer_name,
                                          const char *info);

gboolean cph_cups_printer_class_set_location (CphCups    *cups,
                                              const char *printer_name,
                                              const char *location);

gboolean cph_cups_printer_class_set_shared (CphCups    *cups,
                                            const char *printer_name,
                                            gboolean    shared);

gboolean cph_cups_printer_class_set_job_sheets (CphCups    *cups,
                                                const char *printer_name,
                                                const char *start,
                                                const char *end);

gboolean cph_cups_printer_class_set_error_policy (CphCups    *cups,
                                                  const char *printer_name,
                                                  const char *policy);

gboolean cph_cups_printer_class_set_op_policy (CphCups    *cups,
                                               const char *printer_name,
                                               const char *policy);

gboolean cph_cups_printer_class_set_users_allowed (CphCups     *cups,
                                                   const char  *printer_name,
                                                   const char **users);

gboolean cph_cups_printer_class_set_users_denied (CphCups     *cups,
                                                  const char  *printer_name,
                                                  const char **users);

gboolean cph_cups_printer_class_set_option_default (CphCups     *cups,
                                                    const char  *printer_name,
                                                    const char  *option,
                                                    const char **values);

gboolean cph_cups_job_cancel (CphCups    *cups,
                              int         job_id,
                              gboolean    purge_job,
                              const char *user_name);

gboolean cph_cups_job_restart (CphCups    *cups,
                               int         job_id,
                               const char *user_name);

gboolean cph_cups_job_set_hold_until (CphCups    *cups,
                                      int         job_id,
                                      const char *job_hold_until,
                                      const char *user_name);

CphJobStatus cph_cups_job_get_status (CphCups    *cups,
                                      int         job_id,
                                      const char *user);

gboolean cph_cups_is_printer_uri_local (const char *uri);

G_END_DECLS

#endif /* CPH_CUPS_H */