summaryrefslogtreecommitdiff
path: root/modules/devices/printers.c
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:07:32 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2024-04-22 18:07:32 -0300
commit5bba5c481d7273b475a39eb61e5eacec65d3c8e5 (patch)
tree514a1919f16464138651f925bb64eac3aa5cd7f9 /modules/devices/printers.c
parent5f01c706267c595de92406a32e7f31ef5056c2d0 (diff)
New upstream version 2.0.5preupstream/2.0.5pre
Diffstat (limited to 'modules/devices/printers.c')
-rw-r--r--modules/devices/printers.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/devices/printers.c b/modules/devices/printers.c
index fb9389ac..d880e691 100644
--- a/modules/devices/printers.c
+++ b/modules/devices/printers.c
@@ -42,7 +42,8 @@ struct _CUPSDest {
static int (*cups_dests_get) (CUPSDest **dests) = NULL;
static int (*cups_dests_free) (int num_dests, CUPSDest *dests) = NULL;
-static gboolean cups_init = FALSE;
+static void (*cups_set_server)(const char *server) = NULL;
+volatile static gboolean cups_init = FALSE;
GModule *cups;
@@ -66,9 +67,11 @@ init_cups(void)
}
if (!g_module_symbol(cups, "cupsGetDests", (gpointer) & cups_dests_get)
- || !g_module_symbol(cups, "cupsFreeDests", (gpointer) & cups_dests_free)) {
- if(cups) g_module_close(cups);
+ || !g_module_symbol(cups, "cupsFreeDests", (gpointer) & cups_dests_free)
+ || !g_module_symbol(cups, "cupsSetServer", (gpointer) & cups_set_server)) {
+ g_module_close(cups);
cups_init = FALSE;
+ return;
}
}
@@ -190,11 +193,16 @@ scan_printers_do(void)
if (!cups_init) {
init_cups();
+ }
+ if(!cups_init) {
printer_icons = g_strdup("");
printer_list = g_strdup(_("[Printers]\n"
"No suitable CUPS library found="));
return;
+ }else{
+ //only list from our own cups, use ip for faster/secure answer
+ cups_set_server("127.0.0.1");
}
/* remove old devices from global device table */