After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 345590 - get the printer's backend
get the printer's backend
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Printing
unspecified
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 165569
 
 
Reported: 2006-06-21 19:23 UTC by Christian Persch
Modified: 2018-02-10 03:28 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement



Description Christian Persch 2006-06-21 19:23:42 UTC
What I need is a way to get the name of the print backend that a given printer uses ("file", "cups"), like this:

const gchar *gtk_printer_get_backend_name (GtkPrinter *)
Comment 1 Carolyn_MacLeod 2006-06-28 21:21:27 UTC
I needed this also, so for now I used:

G_OBJECT_TYPE_NAME(gtk_printer_get_backend(printer));

Of course, I get strings like:
"GtkPrintBackendCups"
and
"GtkPrintBackendFile"...

It's not very api-like or pretty, but it's ok for now.

just fyi...
Comment 2 Matthias Clasen 2006-06-29 08:50:26 UTC
... and of course, totally unsupported. Don't complain if the backends change
their names or if gtk_printer_get_backend stops being exported without warning
in the future. The backends are called backends for a reason...

Maybe you could explain what the use case for knowing the print backend is ?
Comment 3 Christian Persch 2006-06-29 11:32:33 UTC
Well for Epiphany, I let gecko print to a temp file which I then hand off to gtk-print.
For the "file" backend, I want to cut out the temp file and print directly to the destination filename, so I need to know that that printer is the "file" printer and then I can use the OUTPUT_URI setting.
For the "cups" backend I can also bypass the temp file since gecko supports cups natively.
Comment 4 Carolyn_MacLeod 2006-06-29 16:19:08 UTC
And for SWT (eclipse) I have 3 places that I use this.

Note that we have a pre-existing "cross-platform printing" API (written in Java) that I am now going to support for GTK+. So some of what I am doing is making sure that I can deliver as much of our API as possible using yours <g>.

1) we have a "printToFile" boolean that the user can set/get before and after launching the dialog, and before and after creating a "Printer" object. I need to know whether the backend is a "file" or not in order to set this boolean.

2) I also use the backend type to decide whether or not to get the filename from the printer settings (GTK_PRINT_SETTINGS_OUTPUT_URI).

3) our users create a Printer object by passing in 2 strings: "name" and "driver". On win32, the 2 strings equate to the device name, and the driver name (typically "winspool"). For Xprint, the driver string was the Xprt server (typically ":1").
On Mac, the driver string is typically "Printer" or "File". I wanted an equivalent  string for a GTK+ "driver", so I randomly grabbed the backend type string. The API requested in this bug report would be a much better solution.
Comment 5 Matthias Clasen 2018-02-10 03:28:09 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.