2008-07-01 22:57:50 +00:00
|
|
|
/* GTK - The GIMP Toolkit
|
2019-05-26 21:57:23 +00:00
|
|
|
* gtkprintbackendprivate.h: Abstract printer backend interfaces
|
2006-04-21 15:09:32 +00:00
|
|
|
* Copyright (C) 2003, Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library 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
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2006-04-21 15:09:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gmodule.h>
|
|
|
|
|
2022-09-24 13:07:56 +00:00
|
|
|
#include <glib/gi18n-lib.h>
|
2018-02-18 23:00:42 +00:00
|
|
|
#include "gtkdebug.h"
|
2011-10-22 06:48:13 +00:00
|
|
|
#include "gtkmodulesprivate.h"
|
2009-04-21 12:24:32 +00:00
|
|
|
#include "gtkmarshalers.h"
|
2006-04-21 15:09:32 +00:00
|
|
|
#include "gtkprivate.h"
|
2019-05-26 21:57:23 +00:00
|
|
|
#include "gtkprintbackendprivate.h"
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2020-06-01 11:43:54 +00:00
|
|
|
static void gtk_print_backend_finalize (GObject *object);
|
2008-09-17 22:07:10 +00:00
|
|
|
static void gtk_print_backend_dispose (GObject *object);
|
|
|
|
static void gtk_print_backend_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec);
|
|
|
|
static void gtk_print_backend_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec);
|
2006-05-04 13:43:32 +00:00
|
|
|
|
|
|
|
struct _GtkPrintBackendPrivate
|
|
|
|
{
|
2019-12-22 19:43:48 +00:00
|
|
|
GListStore *printers;
|
2006-05-04 13:43:32 +00:00
|
|
|
guint printer_list_requested : 1;
|
|
|
|
guint printer_list_done : 1;
|
2008-09-17 22:07:10 +00:00
|
|
|
GtkPrintBackendStatus status;
|
2009-09-24 13:34:56 +00:00
|
|
|
char **auth_info_required;
|
|
|
|
char **auth_info;
|
2014-08-19 15:55:47 +00:00
|
|
|
gboolean store_auth_info;
|
2006-05-04 13:43:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PRINTER_LIST_CHANGED,
|
|
|
|
PRINTER_LIST_DONE,
|
|
|
|
PRINTER_ADDED,
|
|
|
|
PRINTER_REMOVED,
|
|
|
|
PRINTER_STATUS_CHANGED,
|
2009-04-21 12:24:32 +00:00
|
|
|
REQUEST_PASSWORD,
|
2006-05-04 13:43:32 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
|
|
|
|
2008-09-17 22:07:10 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
PROP_ZERO,
|
|
|
|
PROP_STATUS
|
|
|
|
};
|
|
|
|
|
2015-09-14 17:27:43 +00:00
|
|
|
static GObjectClass *backend_parent_class;
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
GQuark
|
|
|
|
gtk_print_backend_error_quark (void)
|
|
|
|
{
|
|
|
|
static GQuark quark = 0;
|
|
|
|
if (quark == 0)
|
|
|
|
quark = g_quark_from_static_string ("gtk-print-backend-error-quark");
|
|
|
|
return quark;
|
|
|
|
}
|
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
void
|
|
|
|
gtk_print_backends_init (void)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2018-02-18 23:00:42 +00:00
|
|
|
GIOExtensionPoint *ep;
|
|
|
|
GIOModuleScope *scope;
|
|
|
|
char **paths;
|
|
|
|
int i;
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2022-09-23 14:11:59 +00:00
|
|
|
GTK_DEBUG (MODULES, "Registering extension point %s", GTK_PRINT_BACKEND_EXTENSION_POINT_NAME);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
ep = g_io_extension_point_register (GTK_PRINT_BACKEND_EXTENSION_POINT_NAME);
|
|
|
|
g_io_extension_point_set_required_type (ep, GTK_TYPE_PRINT_BACKEND);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
paths = _gtk_get_module_path ("printbackends");
|
|
|
|
for (i = 0; paths[i]; i++)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2022-09-23 14:11:59 +00:00
|
|
|
GTK_DEBUG (MODULES, "Scanning io modules in %s", paths[i]);
|
2018-02-18 23:00:42 +00:00
|
|
|
g_io_modules_scan_all_in_directory_with_scope (paths[i], scope);
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
2018-02-18 23:00:42 +00:00
|
|
|
g_strfreev (paths);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
g_io_module_scope_free (scope);
|
2018-02-24 05:44:21 +00:00
|
|
|
|
|
|
|
if (GTK_DEBUG_CHECK (MODULES))
|
|
|
|
{
|
|
|
|
GList *list, *l;
|
|
|
|
|
|
|
|
list = g_io_extension_point_get_extensions (ep);
|
|
|
|
for (l = list; l; l = l->next)
|
|
|
|
{
|
|
|
|
GIOExtension *ext = l->data;
|
|
|
|
g_print ("extension: %s: type %s\n",
|
|
|
|
g_io_extension_get_name (ext),
|
|
|
|
g_type_name (g_io_extension_get_type (ext)));
|
|
|
|
}
|
|
|
|
}
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
|
2009-12-10 10:23:40 +00:00
|
|
|
/**
|
2011-02-09 04:14:46 +00:00
|
|
|
* gtk_print_backend_load_modules:
|
2009-12-10 10:23:40 +00:00
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
* Returns: (element-type GtkPrintBackend) (transfer container):
|
2009-12-10 10:23:40 +00:00
|
|
|
*/
|
2006-04-21 15:09:32 +00:00
|
|
|
GList *
|
2006-06-12 04:39:55 +00:00
|
|
|
gtk_print_backend_load_modules (void)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
|
|
|
GList *result;
|
|
|
|
GtkPrintBackend *backend;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *setting;
|
|
|
|
char **backends;
|
2020-07-24 13:54:49 +00:00
|
|
|
int i;
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkSettings *settings;
|
2018-02-18 23:00:42 +00:00
|
|
|
GIOExtensionPoint *ep;
|
2006-04-21 15:09:32 +00:00
|
|
|
|
|
|
|
result = NULL;
|
|
|
|
|
2018-02-18 23:00:42 +00:00
|
|
|
ep = g_io_extension_point_lookup (GTK_PRINT_BACKEND_EXTENSION_POINT_NAME);
|
|
|
|
|
2006-04-21 15:09:32 +00:00
|
|
|
settings = gtk_settings_get_default ();
|
2006-06-19 03:52:10 +00:00
|
|
|
if (settings)
|
|
|
|
g_object_get (settings, "gtk-print-backends", &setting, NULL);
|
|
|
|
else
|
|
|
|
setting = g_strdup (GTK_PRINT_BACKENDS);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
|
|
|
backends = g_strsplit (setting, ",", -1);
|
|
|
|
|
|
|
|
for (i = 0; backends[i]; i++)
|
|
|
|
{
|
2018-02-18 23:00:42 +00:00
|
|
|
GIOExtension *ext;
|
|
|
|
GType type;
|
|
|
|
|
|
|
|
ext = g_io_extension_point_get_extension_by_name (ep, backends[i]);
|
|
|
|
if (!ext)
|
|
|
|
continue;
|
|
|
|
|
2022-09-23 14:11:59 +00:00
|
|
|
GTK_DEBUG (PRINTING, "Found %s print backend", backends[i]);
|
2018-02-18 23:00:42 +00:00
|
|
|
|
|
|
|
type = g_io_extension_get_type (ext);
|
|
|
|
backend = g_object_new (type, NULL);
|
|
|
|
result = g_list_append (result, backend);
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
g_strfreev (backends);
|
|
|
|
g_free (setting);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************
|
|
|
|
* GtkPrintBackend *
|
|
|
|
*****************************************/
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
G_DEFINE_TYPE_WITH_PRIVATE (GtkPrintBackend, gtk_print_backend, G_TYPE_OBJECT)
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2008-05-21 02:17:30 +00:00
|
|
|
static void fallback_printer_request_details (GtkPrinter *printer);
|
|
|
|
static gboolean fallback_printer_mark_conflicts (GtkPrinter *printer,
|
|
|
|
GtkPrinterOptionSet *options);
|
2008-02-06 22:58:47 +00:00
|
|
|
static gboolean fallback_printer_get_hard_margins (GtkPrinter *printer,
|
2020-07-24 20:32:16 +00:00
|
|
|
double *top,
|
|
|
|
double *bottom,
|
|
|
|
double *left,
|
|
|
|
double *right);
|
2018-04-12 09:31:37 +00:00
|
|
|
static gboolean fallback_printer_get_hard_margins_for_paper_size (GtkPrinter *printer,
|
|
|
|
GtkPaperSize *paper_size,
|
2020-07-24 20:32:16 +00:00
|
|
|
double *top,
|
|
|
|
double *bottom,
|
|
|
|
double *left,
|
|
|
|
double *right);
|
2008-05-21 02:17:30 +00:00
|
|
|
static GList * fallback_printer_list_papers (GtkPrinter *printer);
|
|
|
|
static GtkPageSetup * fallback_printer_get_default_page_size (GtkPrinter *printer);
|
|
|
|
static GtkPrintCapabilities fallback_printer_get_capabilities (GtkPrinter *printer);
|
2009-04-21 12:24:32 +00:00
|
|
|
static void request_password (GtkPrintBackend *backend,
|
2009-09-24 13:34:56 +00:00
|
|
|
gpointer auth_info_required,
|
|
|
|
gpointer auth_info_default,
|
|
|
|
gpointer auth_info_display,
|
|
|
|
gpointer auth_info_visible,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *prompt,
|
2014-08-19 15:55:47 +00:00
|
|
|
gboolean can_store_auth_info);
|
2018-02-18 23:00:42 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_print_backend_set_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkPrintBackend *backend = GTK_PRINT_BACKEND (object);
|
|
|
|
GtkPrintBackendPrivate *priv = backend->priv;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_STATUS:
|
|
|
|
priv->status = g_value_get_int (value);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_print_backend_get_property (GObject *object,
|
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
GtkPrintBackend *backend = GTK_PRINT_BACKEND (object);
|
|
|
|
GtkPrintBackendPrivate *priv = backend->priv;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_STATUS:
|
|
|
|
g_value_set_int (value, priv->status);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
static void
|
|
|
|
gtk_print_backend_class_init (GtkPrintBackendClass *class)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2006-05-04 13:43:32 +00:00
|
|
|
GObjectClass *object_class;
|
|
|
|
object_class = (GObjectClass *) class;
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2015-09-14 17:27:43 +00:00
|
|
|
backend_parent_class = g_type_class_peek_parent (class);
|
|
|
|
|
2020-06-01 11:43:54 +00:00
|
|
|
object_class->finalize = gtk_print_backend_finalize;
|
2006-05-04 13:43:32 +00:00
|
|
|
object_class->dispose = gtk_print_backend_dispose;
|
2008-09-17 22:07:10 +00:00
|
|
|
object_class->set_property = gtk_print_backend_set_property;
|
|
|
|
object_class->get_property = gtk_print_backend_get_property;
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2006-05-24 10:50:57 +00:00
|
|
|
class->printer_request_details = fallback_printer_request_details;
|
|
|
|
class->printer_mark_conflicts = fallback_printer_mark_conflicts;
|
|
|
|
class->printer_get_hard_margins = fallback_printer_get_hard_margins;
|
2018-04-12 09:31:37 +00:00
|
|
|
class->printer_get_hard_margins_for_paper_size = fallback_printer_get_hard_margins_for_paper_size;
|
2006-05-24 10:50:57 +00:00
|
|
|
class->printer_list_papers = fallback_printer_list_papers;
|
2008-05-21 02:17:30 +00:00
|
|
|
class->printer_get_default_page_size = fallback_printer_get_default_page_size;
|
2006-05-24 10:50:57 +00:00
|
|
|
class->printer_get_capabilities = fallback_printer_get_capabilities;
|
2009-04-21 12:24:32 +00:00
|
|
|
class->request_password = request_password;
|
2006-05-24 10:50:57 +00:00
|
|
|
|
2008-09-17 22:07:10 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_STATUS,
|
2022-05-11 12:19:39 +00:00
|
|
|
g_param_spec_int ("status", NULL, NULL,
|
2008-09-17 22:07:10 +00:00
|
|
|
GTK_PRINT_BACKEND_STATUS_UNKNOWN,
|
|
|
|
GTK_PRINT_BACKEND_STATUS_UNAVAILABLE,
|
|
|
|
GTK_PRINT_BACKEND_STATUS_UNKNOWN,
|
|
|
|
GTK_PARAM_READWRITE));
|
2006-05-04 13:43:32 +00:00
|
|
|
|
|
|
|
signals[PRINTER_LIST_CHANGED] =
|
2006-06-01 05:02:56 +00:00
|
|
|
g_signal_new (I_("printer-list-changed"),
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, printer_list_changed),
|
|
|
|
NULL, NULL,
|
2019-05-29 20:05:19 +00:00
|
|
|
NULL,
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
signals[PRINTER_LIST_DONE] =
|
2006-06-01 05:02:56 +00:00
|
|
|
g_signal_new (I_("printer-list-done"),
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, printer_list_done),
|
|
|
|
NULL, NULL,
|
2019-05-29 20:05:19 +00:00
|
|
|
NULL,
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_NONE, 0);
|
|
|
|
signals[PRINTER_ADDED] =
|
2006-06-01 05:02:56 +00:00
|
|
|
g_signal_new (I_("printer-added"),
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, printer_added),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_NONE, 1, GTK_TYPE_PRINTER);
|
|
|
|
signals[PRINTER_REMOVED] =
|
2006-06-01 05:02:56 +00:00
|
|
|
g_signal_new (I_("printer-removed"),
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, printer_removed),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_NONE, 1, GTK_TYPE_PRINTER);
|
|
|
|
signals[PRINTER_STATUS_CHANGED] =
|
2006-06-01 05:02:56 +00:00
|
|
|
g_signal_new (I_("printer-status-changed"),
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, printer_status_changed),
|
|
|
|
NULL, NULL,
|
2019-05-31 03:56:50 +00:00
|
|
|
NULL,
|
2006-05-04 13:43:32 +00:00
|
|
|
G_TYPE_NONE, 1, GTK_TYPE_PRINTER);
|
2009-04-21 12:24:32 +00:00
|
|
|
signals[REQUEST_PASSWORD] =
|
|
|
|
g_signal_new (I_("request-password"),
|
|
|
|
G_TYPE_FROM_CLASS (class),
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
G_STRUCT_OFFSET (GtkPrintBackendClass, request_password),
|
2014-08-19 15:55:47 +00:00
|
|
|
NULL, NULL, NULL,
|
|
|
|
G_TYPE_NONE, 6, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_POINTER,
|
|
|
|
G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_print_backend_init (GtkPrintBackend *backend)
|
|
|
|
{
|
|
|
|
GtkPrintBackendPrivate *priv;
|
|
|
|
|
2013-06-27 19:02:52 +00:00
|
|
|
priv = backend->priv = gtk_print_backend_get_instance_private (backend);
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
priv->printers = g_list_store_new (GTK_TYPE_PRINTER);
|
2009-09-24 13:34:56 +00:00
|
|
|
priv->auth_info_required = NULL;
|
|
|
|
priv->auth_info = NULL;
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gtk_print_backend_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
GtkPrintBackend *backend;
|
|
|
|
GtkPrintBackendPrivate *priv;
|
|
|
|
|
|
|
|
backend = GTK_PRINT_BACKEND (object);
|
|
|
|
priv = backend->priv;
|
|
|
|
|
|
|
|
/* We unref the printers in dispose, not in finalize so that
|
2006-06-12 04:39:55 +00:00
|
|
|
* we can break refcount cycles with gtk_print_backend_destroy
|
|
|
|
*/
|
2020-06-01 11:43:54 +00:00
|
|
|
g_list_store_remove_all (priv->printers);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2015-09-14 17:27:43 +00:00
|
|
|
backend_parent_class->dispose (object);
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
|
2020-06-01 11:43:54 +00:00
|
|
|
static void
|
|
|
|
gtk_print_backend_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
GtkPrintBackend *backend = GTK_PRINT_BACKEND (object);
|
|
|
|
GtkPrintBackendPrivate *priv = backend->priv;
|
|
|
|
|
|
|
|
g_clear_object (&priv->printers);
|
|
|
|
|
|
|
|
backend_parent_class->finalize (object);
|
|
|
|
}
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2006-05-24 10:50:57 +00:00
|
|
|
static void
|
|
|
|
fallback_printer_request_details (GtkPrinter *printer)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2006-06-12 04:39:55 +00:00
|
|
|
fallback_printer_mark_conflicts (GtkPrinter *printer,
|
2020-06-01 11:43:54 +00:00
|
|
|
GtkPrinterOptionSet *options)
|
2006-05-24 10:50:57 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2008-02-06 22:58:47 +00:00
|
|
|
static gboolean
|
2006-05-24 10:50:57 +00:00
|
|
|
fallback_printer_get_hard_margins (GtkPrinter *printer,
|
2020-07-24 20:32:16 +00:00
|
|
|
double *top,
|
|
|
|
double *bottom,
|
|
|
|
double *left,
|
|
|
|
double *right)
|
2006-05-24 10:50:57 +00:00
|
|
|
{
|
2009-11-21 09:38:17 +00:00
|
|
|
return FALSE;
|
2006-05-24 10:50:57 +00:00
|
|
|
}
|
|
|
|
|
2018-04-12 09:31:37 +00:00
|
|
|
static gboolean
|
|
|
|
fallback_printer_get_hard_margins_for_paper_size (GtkPrinter *printer,
|
|
|
|
GtkPaperSize *paper_size,
|
2020-07-24 20:32:16 +00:00
|
|
|
double *top,
|
|
|
|
double *bottom,
|
|
|
|
double *left,
|
|
|
|
double *right)
|
2018-04-12 09:31:37 +00:00
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-05-24 10:50:57 +00:00
|
|
|
static GList *
|
|
|
|
fallback_printer_list_papers (GtkPrinter *printer)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-05-21 02:17:30 +00:00
|
|
|
static GtkPageSetup *
|
|
|
|
fallback_printer_get_default_page_size (GtkPrinter *printer)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2006-05-24 10:50:57 +00:00
|
|
|
static GtkPrintCapabilities
|
|
|
|
fallback_printer_get_capabilities (GtkPrinter *printer)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
void
|
|
|
|
gtk_print_backend_add_printer (GtkPrintBackend *backend,
|
2006-06-12 04:39:55 +00:00
|
|
|
GtkPrinter *printer)
|
2006-05-04 13:43:32 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
g_list_store_append (backend->priv->printers, printer);
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_print_backend_remove_printer (GtkPrintBackend *backend,
|
2006-06-12 04:39:55 +00:00
|
|
|
GtkPrinter *printer)
|
2006-05-04 13:43:32 +00:00
|
|
|
{
|
2019-12-22 19:43:48 +00:00
|
|
|
guint position;
|
2006-05-04 13:43:32 +00:00
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
|
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
if (g_list_store_find (backend->priv->printers, printer, &position))
|
|
|
|
g_list_store_remove (backend->priv->printers, position);
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gtk_print_backend_set_list_done (GtkPrintBackend *backend)
|
|
|
|
{
|
|
|
|
if (!backend->priv->printer_list_done)
|
|
|
|
{
|
|
|
|
backend->priv->printer_list_done = TRUE;
|
|
|
|
g_signal_emit (backend, signals[PRINTER_LIST_DONE], 0);
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2009-12-10 10:23:40 +00:00
|
|
|
/**
|
|
|
|
* gtk_print_backend_get_printer_list:
|
|
|
|
*
|
2010-10-01 17:05:12 +00:00
|
|
|
* Returns the current list of printers.
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
* Returns: (element-type GtkPrinter) (transfer container):
|
2021-05-20 13:17:04 +00:00
|
|
|
* A list of `GtkPrinter` objects
|
2009-12-10 10:23:40 +00:00
|
|
|
*/
|
2006-04-21 15:09:32 +00:00
|
|
|
GList *
|
2006-05-04 13:43:32 +00:00
|
|
|
gtk_print_backend_get_printer_list (GtkPrintBackend *backend)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2019-12-22 19:43:48 +00:00
|
|
|
GList *result = NULL;
|
|
|
|
guint i;
|
2006-05-04 13:43:32 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_PRINT_BACKEND (backend), NULL);
|
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (backend->priv->printers)); i++)
|
|
|
|
{
|
|
|
|
GtkPrinter *printer = g_list_model_get_item (G_LIST_MODEL (backend->priv->printers), i);
|
|
|
|
result = g_list_prepend (result, printer);
|
|
|
|
g_object_unref (printer);
|
|
|
|
}
|
2006-05-04 13:43:32 +00:00
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
if (!backend->priv->printer_list_requested)
|
2006-05-04 13:43:32 +00:00
|
|
|
{
|
|
|
|
if (GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list)
|
|
|
|
GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list (backend);
|
2019-12-22 19:43:48 +00:00
|
|
|
backend->priv->printer_list_requested = TRUE;
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
2008-09-17 22:07:10 +00:00
|
|
|
|
2006-06-12 04:39:55 +00:00
|
|
|
return result;
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2019-12-22 19:49:26 +00:00
|
|
|
GListModel *
|
|
|
|
gtk_print_backend_get_printers (GtkPrintBackend *backend)
|
|
|
|
{
|
|
|
|
if (!backend->priv->printer_list_requested)
|
|
|
|
{
|
|
|
|
if (GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list)
|
|
|
|
GTK_PRINT_BACKEND_GET_CLASS (backend)->request_printer_list (backend);
|
|
|
|
backend->priv->printer_list_requested = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return G_LIST_MODEL (backend->priv->printers);
|
|
|
|
}
|
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
gboolean
|
2019-12-22 19:43:48 +00:00
|
|
|
gtk_print_backend_printer_list_is_done (GtkPrintBackend *backend)
|
2006-05-04 13:43:32 +00:00
|
|
|
{
|
2019-12-22 19:43:48 +00:00
|
|
|
g_return_val_if_fail (GTK_IS_PRINT_BACKEND (backend), TRUE);
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
return backend->priv->printer_list_done;
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GtkPrinter *
|
2006-05-04 13:43:32 +00:00
|
|
|
gtk_print_backend_find_printer (GtkPrintBackend *backend,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *printer_name)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2019-12-22 19:43:48 +00:00
|
|
|
GtkPrinter *result = NULL;
|
|
|
|
guint i;
|
2006-05-04 13:43:32 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GTK_IS_PRINT_BACKEND (backend), NULL);
|
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
for (i = 0; !result && i < g_list_model_get_n_items (G_LIST_MODEL (backend->priv->printers)); i++)
|
|
|
|
{
|
|
|
|
GtkPrinter *printer = g_list_model_get_item (G_LIST_MODEL (backend->priv->printers), i);
|
|
|
|
if (strcmp (gtk_printer_get_name (printer), printer_name) == 0)
|
|
|
|
result = printer;
|
|
|
|
g_object_unref (printer);
|
|
|
|
}
|
2006-04-21 15:09:32 +00:00
|
|
|
|
2019-12-22 19:43:48 +00:00
|
|
|
return result;
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2006-06-12 04:39:55 +00:00
|
|
|
gtk_print_backend_print_stream (GtkPrintBackend *backend,
|
|
|
|
GtkPrintJob *job,
|
2006-06-21 18:16:58 +00:00
|
|
|
GIOChannel *data_io,
|
2006-04-21 15:09:32 +00:00
|
|
|
GtkPrintJobCompleteFunc callback,
|
2006-06-12 04:39:55 +00:00
|
|
|
gpointer user_data,
|
2006-06-21 18:16:58 +00:00
|
|
|
GDestroyNotify dnotify)
|
2006-04-21 15:09:32 +00:00
|
|
|
{
|
2006-05-04 13:43:32 +00:00
|
|
|
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
|
|
|
|
|
|
|
|
GTK_PRINT_BACKEND_GET_CLASS (backend)->print_stream (backend,
|
|
|
|
job,
|
2006-06-21 18:16:58 +00:00
|
|
|
data_io,
|
2006-05-04 13:43:32 +00:00
|
|
|
callback,
|
|
|
|
user_data,
|
2006-06-21 18:16:58 +00:00
|
|
|
dnotify);
|
2006-05-04 13:43:32 +00:00
|
|
|
}
|
|
|
|
|
2009-04-21 12:24:32 +00:00
|
|
|
void
|
2009-09-24 13:34:56 +00:00
|
|
|
gtk_print_backend_set_password (GtkPrintBackend *backend,
|
2020-07-24 18:40:36 +00:00
|
|
|
char **auth_info_required,
|
|
|
|
char **auth_info,
|
2014-08-19 15:55:47 +00:00
|
|
|
gboolean store_auth_info)
|
2009-04-21 12:24:32 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GTK_IS_PRINT_BACKEND (backend));
|
|
|
|
|
|
|
|
if (GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password)
|
2014-08-19 15:55:47 +00:00
|
|
|
GTK_PRINT_BACKEND_GET_CLASS (backend)->set_password (backend,
|
|
|
|
auth_info_required,
|
|
|
|
auth_info,
|
|
|
|
store_auth_info);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
store_auth_info_toggled (GtkCheckButton *chkbtn,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gboolean *data = (gboolean *) user_data;
|
2020-08-30 23:36:27 +00:00
|
|
|
*data = gtk_check_button_get_active (GTK_CHECK_BUTTON (chkbtn));
|
2009-04-21 12:24:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-09-24 13:34:56 +00:00
|
|
|
store_entry (GtkEntry *entry,
|
|
|
|
gpointer user_data)
|
2009-04-21 12:24:32 +00:00
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
char **data = (char **) user_data;
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
if (*data != NULL)
|
2009-04-21 12:24:32 +00:00
|
|
|
{
|
2009-09-24 13:34:56 +00:00
|
|
|
memset (*data, 0, strlen (*data));
|
|
|
|
g_free (*data);
|
2009-04-21 12:24:32 +00:00
|
|
|
}
|
|
|
|
|
2019-02-28 19:31:36 +00:00
|
|
|
*data = g_strdup (gtk_editable_get_text (GTK_EDITABLE (entry)));
|
2009-04-21 12:24:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
password_dialog_response (GtkWidget *dialog,
|
2020-07-24 13:54:49 +00:00
|
|
|
int response_id,
|
2009-04-21 12:24:32 +00:00
|
|
|
GtkPrintBackend *backend)
|
|
|
|
{
|
|
|
|
GtkPrintBackendPrivate *priv = backend->priv;
|
2020-07-24 13:54:49 +00:00
|
|
|
int i, auth_info_len;
|
2009-04-21 12:24:32 +00:00
|
|
|
|
|
|
|
if (response_id == GTK_RESPONSE_OK)
|
2014-08-19 15:55:47 +00:00
|
|
|
gtk_print_backend_set_password (backend, priv->auth_info_required, priv->auth_info, priv->store_auth_info);
|
2009-04-21 12:24:32 +00:00
|
|
|
else
|
2014-08-19 15:55:47 +00:00
|
|
|
gtk_print_backend_set_password (backend, priv->auth_info_required, NULL, FALSE);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2015-07-16 15:12:35 +00:00
|
|
|
/* We want to clear the data before freeing it */
|
|
|
|
auth_info_len = g_strv_length (priv->auth_info_required);
|
|
|
|
for (i = 0; i < auth_info_len; i++)
|
|
|
|
{
|
|
|
|
if (priv->auth_info[i] != NULL)
|
|
|
|
{
|
|
|
|
memset (priv->auth_info[i], 0, strlen (priv->auth_info[i]));
|
|
|
|
g_free (priv->auth_info[i]);
|
|
|
|
priv->auth_info[i] = NULL;
|
|
|
|
}
|
|
|
|
}
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2015-07-16 15:12:35 +00:00
|
|
|
g_clear_pointer (&priv->auth_info, g_free);
|
|
|
|
g_clear_pointer (&priv->auth_info_required, g_strfreev);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2020-05-09 14:26:22 +00:00
|
|
|
gtk_window_destroy (GTK_WINDOW (dialog));
|
2009-04-21 12:24:32 +00:00
|
|
|
|
|
|
|
g_object_unref (backend);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2009-09-24 13:34:56 +00:00
|
|
|
request_password (GtkPrintBackend *backend,
|
|
|
|
gpointer auth_info_required,
|
|
|
|
gpointer auth_info_default,
|
|
|
|
gpointer auth_info_display,
|
|
|
|
gpointer auth_info_visible,
|
2020-07-24 18:40:36 +00:00
|
|
|
const char *prompt,
|
2014-08-19 15:55:47 +00:00
|
|
|
gboolean can_store_auth_info)
|
2009-04-21 12:24:32 +00:00
|
|
|
{
|
|
|
|
GtkPrintBackendPrivate *priv = backend->priv;
|
2014-08-19 15:55:47 +00:00
|
|
|
GtkWidget *dialog, *box, *main_box, *label, *icon, *vbox, *entry, *chkbtn;
|
2009-09-24 13:34:56 +00:00
|
|
|
GtkWidget *focus = NULL;
|
2010-06-03 07:36:39 +00:00
|
|
|
GtkWidget *content_area;
|
2020-07-24 18:40:36 +00:00
|
|
|
char *markup;
|
2020-07-24 13:54:49 +00:00
|
|
|
int length;
|
|
|
|
int i;
|
2020-07-24 18:40:36 +00:00
|
|
|
char **ai_required = (char **) auth_info_required;
|
|
|
|
char **ai_default = (char **) auth_info_default;
|
|
|
|
char **ai_display = (char **) auth_info_display;
|
2009-09-24 13:34:56 +00:00
|
|
|
gboolean *ai_visible = (gboolean *) auth_info_visible;
|
|
|
|
|
|
|
|
priv->auth_info_required = g_strdupv (ai_required);
|
|
|
|
length = g_strv_length (ai_required);
|
2020-07-24 18:40:36 +00:00
|
|
|
priv->auth_info = g_new0 (char *, length + 1);
|
2014-08-19 15:55:47 +00:00
|
|
|
priv->store_auth_info = FALSE;
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2022-10-29 17:53:47 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2009-04-21 12:24:32 +00:00
|
|
|
dialog = gtk_dialog_new_with_buttons ( _("Authentication"), NULL, GTK_DIALOG_MODAL,
|
2013-06-24 23:28:53 +00:00
|
|
|
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
|
|
|
_("_OK"), GTK_RESPONSE_OK,
|
2009-04-21 12:24:32 +00:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
|
2022-10-29 17:53:47 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2010-10-31 17:07:20 +00:00
|
|
|
main_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
|
|
|
/* Left */
|
2017-11-15 00:43:13 +00:00
|
|
|
icon = gtk_image_new_from_icon_name ("dialog-password-symbolic");
|
2017-11-15 02:14:47 +00:00
|
|
|
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
|
2011-06-09 01:44:03 +00:00
|
|
|
gtk_widget_set_halign (icon, GTK_ALIGN_CENTER);
|
|
|
|
gtk_widget_set_valign (icon, GTK_ALIGN_START);
|
2020-02-26 01:57:20 +00:00
|
|
|
gtk_widget_set_margin_start (icon, 12);
|
|
|
|
gtk_widget_set_margin_end (icon, 12);
|
|
|
|
gtk_widget_set_margin_top (icon, 12);
|
|
|
|
gtk_widget_set_margin_bottom (icon, 12);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
|
|
|
/* Right */
|
2010-10-31 17:07:20 +00:00
|
|
|
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
2009-04-21 12:24:32 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (vbox), 320, -1);
|
|
|
|
|
|
|
|
/* Right - 1. */
|
|
|
|
label = gtk_label_new (NULL);
|
|
|
|
markup = g_markup_printf_escaped ("<span weight=\"bold\" size=\"large\">%s</span>", prompt);
|
|
|
|
gtk_label_set_markup (GTK_LABEL (label), markup);
|
2019-08-22 10:41:39 +00:00
|
|
|
gtk_label_set_wrap (GTK_LABEL (label), TRUE);
|
2009-04-21 12:24:32 +00:00
|
|
|
gtk_widget_set_size_request (GTK_WIDGET (label), 320, -1);
|
|
|
|
g_free (markup);
|
|
|
|
|
|
|
|
/* Packing */
|
2022-10-29 17:53:47 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
2010-06-03 07:36:39 +00:00
|
|
|
content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
2022-10-29 17:53:47 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (content_area), main_box);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (main_box), icon);
|
|
|
|
gtk_box_append (GTK_BOX (main_box), vbox);
|
2016-10-02 15:37:22 +00:00
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (vbox), label);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
/* Right - 2. */
|
|
|
|
for (i = 0; i < length; i++)
|
|
|
|
{
|
|
|
|
priv->auth_info[i] = g_strdup (ai_default[i]);
|
|
|
|
if (ai_display[i] != NULL)
|
|
|
|
{
|
2010-10-31 17:07:20 +00:00
|
|
|
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
|
|
|
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_widget_set_margin_top (box, 6);
|
|
|
|
gtk_widget_set_margin_bottom (box, 6);
|
2009-09-24 13:34:56 +00:00
|
|
|
|
|
|
|
label = gtk_label_new (ai_display[i]);
|
2011-06-09 01:44:03 +00:00
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
entry = gtk_entry_new ();
|
|
|
|
focus = entry;
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
if (ai_default[i] != NULL)
|
2019-02-28 19:31:36 +00:00
|
|
|
gtk_editable_set_text (GTK_EDITABLE (entry), ai_default[i]);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
gtk_entry_set_visibility (GTK_ENTRY (entry), ai_visible[i]);
|
|
|
|
gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (vbox), box);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (box), label);
|
|
|
|
gtk_box_append (GTK_BOX (box), entry);
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
g_signal_connect (entry, "changed",
|
|
|
|
G_CALLBACK (store_entry), &(priv->auth_info[i]));
|
|
|
|
}
|
|
|
|
}
|
2009-04-21 12:24:32 +00:00
|
|
|
|
2014-08-19 15:55:47 +00:00
|
|
|
if (can_store_auth_info)
|
|
|
|
{
|
|
|
|
chkbtn = gtk_check_button_new_with_mnemonic (_("_Remember password"));
|
2016-10-02 15:37:22 +00:00
|
|
|
gtk_widget_set_margin_top (chkbtn, 6);
|
|
|
|
gtk_widget_set_margin_bottom (chkbtn, 6);
|
2020-08-30 23:36:27 +00:00
|
|
|
gtk_check_button_set_active (GTK_CHECK_BUTTON (chkbtn), FALSE);
|
2020-05-09 12:26:52 +00:00
|
|
|
gtk_box_append (GTK_BOX (vbox), chkbtn);
|
2014-08-19 15:55:47 +00:00
|
|
|
g_signal_connect (chkbtn, "toggled",
|
|
|
|
G_CALLBACK (store_auth_info_toggled),
|
|
|
|
&(priv->store_auth_info));
|
|
|
|
}
|
|
|
|
|
2009-09-24 13:34:56 +00:00
|
|
|
if (focus != NULL)
|
|
|
|
{
|
|
|
|
gtk_widget_grab_focus (focus);
|
|
|
|
focus = NULL;
|
|
|
|
}
|
2009-04-21 12:24:32 +00:00
|
|
|
|
|
|
|
g_object_ref (backend);
|
|
|
|
g_signal_connect (G_OBJECT (dialog), "response",
|
|
|
|
G_CALLBACK (password_dialog_response), backend);
|
|
|
|
|
2022-11-28 18:43:36 +00:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
2009-04-21 12:24:32 +00:00
|
|
|
}
|
|
|
|
|
2006-05-04 13:43:32 +00:00
|
|
|
void
|
2019-12-22 19:43:48 +00:00
|
|
|
gtk_print_backend_destroy (GtkPrintBackend *backend)
|
2006-05-04 13:43:32 +00:00
|
|
|
{
|
|
|
|
/* The lifecycle of print backends and printers are tied, such that
|
2006-06-12 04:39:55 +00:00
|
|
|
* the backend owns the printers, but the printers also ref the backend.
|
|
|
|
* This is so that if the app has a reference to a printer its backend
|
|
|
|
* will be around. However, this results in a cycle, which we break
|
|
|
|
* with this call, which causes the print backend to release its printers.
|
|
|
|
*/
|
2019-12-22 19:43:48 +00:00
|
|
|
g_object_run_dispose (G_OBJECT (backend));
|
2006-04-21 15:09:32 +00:00
|
|
|
}
|