2011-03-07 17:09:00 +01:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
|
|
|
|
*
|
|
|
|
* Copyright 2009-2010 Red Hat, Inc,
|
|
|
|
*
|
|
|
|
* 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
|
2012-09-06 14:06:01 +02:00
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
2011-03-07 17:09:00 +01:00
|
|
|
* (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
|
2014-01-23 12:57:27 +01:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2011-03-07 17:09:00 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2018-06-15 14:16:20 +12:00
|
|
|
#pragma once
|
2011-03-07 17:09:00 +01:00
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
2012-09-03 19:11:28 +02:00
|
|
|
#include <cups/cups.h>
|
2011-03-07 17:09:00 +01:00
|
|
|
|
2015-07-30 15:28:08 +02:00
|
|
|
#include "pp-print-device.h"
|
|
|
|
|
2012-09-03 21:43:14 +02:00
|
|
|
#define ALLOWED_CHARACTERS "abcdefghijklmnopqrtsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
|
|
|
|
|
|
|
|
#define MECHANISM_BUS "org.opensuse.CupsPkHelper.Mechanism"
|
|
|
|
|
|
|
|
#define SCP_BUS "org.fedoraproject.Config.Printing"
|
|
|
|
#define SCP_PATH "/org/fedoraproject/Config/Printing"
|
|
|
|
#define SCP_IFACE "org.fedoraproject.Config.Printing"
|
|
|
|
|
2011-03-07 17:09:00 +01:00
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2012-09-10 14:55:04 +01:00
|
|
|
typedef void (*UserResponseCallback) (GtkDialog *dialog, gint response_id, gpointer user_data);
|
|
|
|
|
2011-05-06 12:31:42 +02:00
|
|
|
/*
|
|
|
|
* Match level of PPD driver.
|
|
|
|
*/
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
PPD_NO_MATCH = 0,
|
|
|
|
PPD_GENERIC_MATCH,
|
|
|
|
PPD_CLOSE_MATCH,
|
|
|
|
PPD_EXACT_MATCH,
|
|
|
|
PPD_EXACT_CMD_MATCH
|
|
|
|
};
|
|
|
|
|
2012-09-03 19:50:31 +02:00
|
|
|
enum
|
|
|
|
{
|
2012-09-03 20:04:38 +02:00
|
|
|
ACQUISITION_METHOD_DEFAULT_CUPS_SERVER = 0,
|
|
|
|
ACQUISITION_METHOD_REMOTE_CUPS_SERVER,
|
2013-02-14 15:54:20 +01:00
|
|
|
ACQUISITION_METHOD_SNMP,
|
|
|
|
ACQUISITION_METHOD_SAMBA,
|
2014-07-21 10:49:37 +02:00
|
|
|
ACQUISITION_METHOD_SAMBA_HOST,
|
2014-07-30 15:37:46 +02:00
|
|
|
ACQUISITION_METHOD_JETDIRECT,
|
|
|
|
ACQUISITION_METHOD_LPD
|
2012-09-03 19:50:31 +02:00
|
|
|
};
|
|
|
|
|
2011-05-06 12:31:42 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *ppd_name;
|
2012-07-16 11:10:02 +02:00
|
|
|
gchar *ppd_display_name;
|
2011-05-06 12:31:42 +02:00
|
|
|
gint ppd_match_level;
|
|
|
|
} PPDName;
|
|
|
|
|
2012-07-16 11:10:02 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *manufacturer_name;
|
|
|
|
gchar *manufacturer_display_name;
|
|
|
|
PPDName **ppds;
|
|
|
|
gsize num_of_ppds;
|
|
|
|
} PPDManufacturerItem;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
PPDManufacturerItem **manufacturers;
|
|
|
|
gsize num_of_manufacturers;
|
|
|
|
} PPDList;
|
|
|
|
|
2011-03-07 17:09:00 +01:00
|
|
|
gchar *get_tag_value (const gchar *tag_string,
|
|
|
|
const gchar *tag_name);
|
|
|
|
|
|
|
|
char *get_dest_attr (const char *dest_name,
|
|
|
|
const char *attr);
|
|
|
|
|
2011-04-22 14:30:26 +02:00
|
|
|
gchar *get_ppd_attribute (const gchar *ppd_file_name,
|
2011-03-07 17:09:00 +01:00
|
|
|
const gchar *attribute_name);
|
|
|
|
|
2011-05-16 12:11:30 +02:00
|
|
|
void set_local_default_printer (const gchar *printer_name);
|
|
|
|
|
|
|
|
gboolean printer_set_location (const gchar *printer_name,
|
|
|
|
const gchar *location);
|
|
|
|
|
|
|
|
gboolean printer_set_accepting_jobs (const gchar *printer_name,
|
|
|
|
gboolean accepting_jobs,
|
|
|
|
const gchar *reason);
|
|
|
|
|
|
|
|
gboolean printer_set_enabled (const gchar *printer_name,
|
|
|
|
gboolean enabled);
|
|
|
|
|
|
|
|
gboolean printer_rename (const gchar *old_name,
|
|
|
|
const gchar *new_name);
|
|
|
|
|
|
|
|
gboolean printer_delete (const gchar *printer_name);
|
|
|
|
|
|
|
|
gboolean printer_set_default (const gchar *printer_name);
|
|
|
|
|
|
|
|
gboolean printer_set_shared (const gchar *printer_name,
|
|
|
|
gboolean shared);
|
|
|
|
|
|
|
|
gboolean printer_set_job_sheets (const gchar *printer_name,
|
|
|
|
const gchar *start_sheet,
|
|
|
|
const gchar *end_sheet);
|
|
|
|
|
|
|
|
gboolean printer_set_policy (const gchar *printer_name,
|
|
|
|
const gchar *policy,
|
|
|
|
gboolean error_policy);
|
|
|
|
|
|
|
|
gboolean printer_set_users (const gchar *printer_name,
|
|
|
|
gchar **users,
|
|
|
|
gboolean allowed);
|
|
|
|
|
|
|
|
gboolean class_add_printer (const gchar *class_name,
|
|
|
|
const gchar *printer_name);
|
2011-04-12 16:43:36 +02:00
|
|
|
|
2012-01-06 13:08:25 +01:00
|
|
|
gboolean printer_is_local (cups_ptype_t printer_type,
|
|
|
|
const gchar *device_uri);
|
|
|
|
|
|
|
|
gchar *printer_get_hostname (cups_ptype_t printer_type,
|
|
|
|
const gchar *device_uri,
|
|
|
|
const gchar *printer_uri);
|
|
|
|
|
2020-10-30 10:16:11 +13:00
|
|
|
typedef void (*PSPCallback) (const gchar *printer_name,
|
2012-07-16 11:10:02 +02:00
|
|
|
gboolean success,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void printer_set_ppd_async (const gchar *printer_name,
|
|
|
|
const gchar *ppd_name,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
PSPCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void printer_set_ppd_file_async (const gchar *printer_name,
|
|
|
|
const gchar *ppd_filename,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
PSPCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
typedef void (*GPNCallback) (PPDName **names,
|
|
|
|
const gchar *printer_name,
|
|
|
|
gboolean cancelled,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void get_ppd_names_async (gchar *printer_name,
|
|
|
|
gint count,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
GPNCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
typedef void (*GAPCallback) (PPDList *ppds,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2012-08-07 11:54:11 +02:00
|
|
|
void get_all_ppds_async (GCancellable *cancellable,
|
|
|
|
GAPCallback callback,
|
|
|
|
gpointer user_data);
|
2012-07-16 11:10:02 +02:00
|
|
|
|
|
|
|
PPDList *ppd_list_copy (PPDList *list);
|
|
|
|
void ppd_list_free (PPDList *list);
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
IPP_ATTRIBUTE_TYPE_INTEGER = 0,
|
|
|
|
IPP_ATTRIBUTE_TYPE_STRING,
|
|
|
|
IPP_ATTRIBUTE_TYPE_RANGE,
|
|
|
|
IPP_ATTRIBUTE_TYPE_BOOLEAN
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gboolean boolean_value;
|
|
|
|
gchar *string_value;
|
|
|
|
gint integer_value;
|
|
|
|
gint lower_range;
|
|
|
|
gint upper_range;
|
|
|
|
} IPPAttributeValue;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gchar *attribute_name;
|
|
|
|
IPPAttributeValue *attribute_values;
|
|
|
|
gint num_of_values;
|
|
|
|
gint attribute_type;
|
|
|
|
} IPPAttribute;
|
|
|
|
|
|
|
|
typedef void (*GIACallback) (GHashTable *table,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void get_ipp_attributes_async (const gchar *printer_name,
|
|
|
|
gchar **attributes_names,
|
|
|
|
GIACallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
IPPAttribute *ipp_attribute_copy (IPPAttribute *attr);
|
|
|
|
|
|
|
|
void ipp_attribute_free (IPPAttribute *attr);
|
|
|
|
|
2018-07-13 14:02:01 +12:00
|
|
|
gchar *get_standard_manufacturers_name (const gchar *name);
|
2012-07-16 11:10:02 +02:00
|
|
|
|
2012-07-16 15:25:10 +02:00
|
|
|
typedef void (*PGPCallback) (const gchar *ppd_filename,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void printer_get_ppd_async (const gchar *printer_name,
|
2012-09-03 20:33:21 +02:00
|
|
|
const gchar *host_name,
|
|
|
|
gint port,
|
2012-07-16 15:25:10 +02:00
|
|
|
PGPCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2021-02-12 15:22:17 +13:00
|
|
|
/* NOTE: 'destination' is passed with ownership as cupsCopyDest doesn't seem to work as expected */
|
2012-07-16 15:25:10 +02:00
|
|
|
typedef void (*GNDCallback) (cups_dest_t *destination,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void get_named_dest_async (const gchar *printer_name,
|
|
|
|
GNDCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
typedef void (*PAOCallback) (gboolean success,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void printer_add_option_async (const gchar *printer_name,
|
|
|
|
const gchar *option_name,
|
|
|
|
gchar **values,
|
|
|
|
gboolean set_default,
|
|
|
|
GCancellable *cancellable,
|
|
|
|
PAOCallback callback,
|
|
|
|
gpointer user_data);
|
|
|
|
|
2015-05-22 11:23:19 +02:00
|
|
|
const gchar *get_page_size_from_locale (void);
|
2012-09-03 20:27:04 +02:00
|
|
|
|
2020-06-29 11:42:24 +12:00
|
|
|
typedef void (*GCDCallback) (GPtrArray *devices,
|
2012-09-03 19:50:31 +02:00
|
|
|
gboolean finished,
|
|
|
|
gboolean cancelled,
|
|
|
|
gpointer user_data);
|
|
|
|
|
|
|
|
void get_cups_devices_async (GCancellable *cancellable,
|
|
|
|
GCDCallback callback,
|
|
|
|
gpointer user_data);
|
2012-08-07 14:09:33 +02:00
|
|
|
|
2014-02-20 15:17:02 +01:00
|
|
|
gchar *guess_device_hostname (PpPrintDevice *device);
|
|
|
|
|
2015-08-03 16:53:51 +02:00
|
|
|
gchar *canonicalize_device_name (GList *device_names,
|
2020-06-29 11:42:24 +12:00
|
|
|
GPtrArray *local_cups_devices,
|
2014-07-29 16:47:14 +02:00
|
|
|
cups_dest_t *dests,
|
|
|
|
gint num_of_dests,
|
|
|
|
PpPrintDevice *device);
|
|
|
|
|
2014-07-29 16:59:37 +02:00
|
|
|
void shift_string_left (gchar *str);
|
|
|
|
|
2011-03-07 17:09:00 +01:00
|
|
|
G_END_DECLS
|