Commit graph

46 commits

Author SHA1 Message Date
Robert Ancell
81392210f2 printers: Add note about callback that passed ownership 2021-02-15 10:34:32 +13:00
Robert Ancell
509beee6dc printers: Fix leak of printer name in callbacks.
printer_set_ppd_async and printer_set_ppd_file_async copy the printer name, but
this isn't freed in any cases that use these callback (the string isn't even
used at all).
2020-10-29 23:10:05 +00:00
Robert Ancell
bc648d9c92 printers: Replace PpDevicesList with standard GPtrArray 2020-07-20 14:14:44 +12:00
Robert Ancell
13d72a79a7 printers: Replace ifdefs with #pragma once 2019-01-30 11:33:28 +13:00
Robert Ancell
09465579b7 printers: Use const for manufacturer string 2018-08-02 10:02:15 +00:00
Felipe Borges
1df4da54fc printers: Drop cups_get_jobs_async
pp_printer_get_jobs_async does the job with more modern GLib API
(GTask).

https://bugzilla.gnome.org/show_bug.cgi?id=779313
2017-03-06 16:07:07 +01:00
Felipe Borges
16d32c4e33 printers: renew cups subscriptions asynchronously
https://bugzilla.gnome.org/show_bug.cgi?id=748336
2016-03-10 11:04:27 +01:00
Felipe Borges
9f9c63fe8d printers: cancel cups subscriptions asynchronously
https://bugzilla.gnome.org/show_bug.cgi?id=748336
2016-03-02 17:16:15 +01:00
Felipe Borges
8baaa81a39 printers: redesign the Printer Jobs Dialog
Update the Printer Jobs Dialog to match the current designs at
https://wiki.gnome.org/Design/SystemSettings/Printers

https://bugzilla.gnome.org/show_bug.cgi?id=755626
2016-01-21 15:08:05 +01:00
Marek Kasik
cb07ee03a0 printers: Use GtkListStore for device list
Remove the GList holding printing devices and use already present
GtkListStore for this in the New printer dialog.

This avoids us to install wrong printer when there is more devices
with the same name since we have GtkTreeIter of the selected row.

Use GtkTreeModelFilter for filtering of current devices.

Update test for canonicalize_device_name() since I had to change one
of its parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=749830
2015-08-03 16:56:41 +02:00
Marek Kasik
7b21b22eef printers: Make PpPrintDevice a regular class
Create class PpPrintDevice with properties taken
from the original PpPrintDevice structure.

https://bugzilla.gnome.org/show_bug.cgi?id=749830
2015-07-30 16:28:06 +02:00
Marek Kasik
b5b421288c printers: Fix setting of page size
Set 'PageSize' instead of 'media' for new printers since we use PPD
for construction of the combo for selecting of default paper size.
Previously, we've been setting 'media' attribute for new printers.
Attribute 'media' is used by IPP but we set paper size using 'PageSize'
which comes from PPD in the options dialog. Sometimes (quite often) IPP
gets priority over PPD in print systems. Therefore there was inconsistency
of what user set as default paper size on the options dialog and what was used.

Also don't mark IPP and user's local options as default in PpPPDOptionWidget
since it should use just PPD (we can change PPD values only in this widget).
Since we use PPD for setting of paper size in the options dialog, we shouldn't
show a value which user does not change actually (IPP's 'media' vs. PPD's
'PageSize').

https://bugzilla.gnome.org/show_bug.cgi?id=748569
2015-06-12 16:23:45 +02:00
Marek Kasik
80dce1ee4c printers: Remove unused function
Function printer_set_default_media_size() is not used anywhere
in Printer panel.

https://bugzilla.gnome.org/show_bug.cgi?id=748569
2015-06-12 16:23:42 +02:00
Marek Kasik
88fa618aca printers: Add function shift_string_left() and its test
shift_string_left() shifts given string by 1 character to the left.
test-shift.c tests whether function shift_string_left() works correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:17 +02:00
Marek Kasik
7eded1afa5 printers: Add functions for searching for LPD printers
Add pp_host_get_lpd_devices_async() and
pp_host_get_lpd_devices_finish() functions to PpHost class.
pp_host_get_lpd_devices_async() starts searching for LPD printer
on given address.
The test consist in connection to the default port 515 (or the one
given by creator of PpHost) of the address and sending a print job
to it, which in turn returns a status (we test several standard
queue names).
We suppose that there is a LPD printer on the address if a buffer
with zero length is returned (rfc 1179 5.2).

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:16 +02:00
Marek Kasik
89fe4eda12 printers: Allow to add AppSocket/HP JetDirect printers
Add pp_host_get_socket_devices_async() and
pp_host_get_socket_devices_finish() functions to PpHost class.
pp_host_get_socket_devices_async() starts searching for socket printer
on given address.
The test consist in connection to the default port 9100 (or the one
given by creator of PpHost) of the address.
We suppose that there is an AppSocket/HP JetDirect printer on the address
if the connection succeeds.

See these links for additional info:
http://en.wikipedia.org/wiki/JetDirect
http://www.cups.org/documentation.php/network.html

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:16 +02:00
Marek Kasik
6576db1a16 printers: Make pp_devices_list_free() generally available
Move pp_devices_list_free() to pp-utils.h and optimize it
using g_list_free_full().

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:16 +02:00
Marek Kasik
375c5b0086 printers: Separate canonicalization of device name
Move code for canonicalization of device names to
a separate function for reusability.

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:16 +02:00
Marek Kasik
190d27b8aa printers: Merge TDevice into PpPrintDevice
PpPrintDevice has grown quite a lot since its introduction.
It contains almost all members of TDevice now.
Merging members of TDevice into PpPrintDevice saves us some work
and allows us to process TDevice's data out of pp-new-printer-dialog.c.

https://bugzilla.gnome.org/show_bug.cgi?id=695564
2014-07-31 11:44:16 +02:00
Marek Kasik
fc0a68430f printers: Set hostname for devices with no hostname
Guess hostname of found device if it was not provided before.

CUPS browses its printers as "PrinterName @ ComputerName" or
"PrinterInfo @ ComputerName" through DNS-SD. Get the last part
of that string and set it as hostname.

HPLIP printers have URIs of form
hp:/net/PrinterModel?ip=IPAddress&port=Port or
hp:/net/PrinterModel?ip=IPAddress.

URIs of other protocols are parsed by httpSeparateURI().

https://bugzilla.gnome.org/show_bug.cgi?id=693183
2014-02-26 12:09:36 +01:00
Daniel Mustieles
2c5951819d Updated FSF's address 2014-01-29 11:27:38 +01:00
Marek Kasik
22f508a7e1 printers: Authenticate Samba servers only when enabled
Add parameter which enables showing of authentication dialog
for Samba servers which need authentication.
Add samba server to the internal list of found devices if it needs
authentication and the authentication is disabled.

https://bugzilla.gnome.org/show_bug.cgi?id=698532
2013-09-03 22:09:39 +02:00
Marek Kasik
41924f8c75 printers: Add class for searching for samba printers
Add class PpSamba which contains asynchronous function
for searching for samba-shared printers. It can search
for printers on local network or on a specific host if
needed.

https://bugzilla.gnome.org/show_bug.cgi?id=683229
2013-02-15 18:23:53 +01:00
Marek Kasik
1eb906515f printers: Use GPLv2+ for files created by Marek Kasik
This commit is related to the bug #683420.
2012-09-11 15:02:26 +02:00
Bastien Nocera
0a0bc59afa printers: Avoid redefinition of UserResponseCallback
It was declared to be the same value in all three headers, which
causes problems with old version of GCC.

https://bugzilla.gnome.org/show_bug.cgi?id=683696
2012-09-10 14:55:58 +01:00
Marek Kasik
a0ad46365f printers: Remove redundant functions
Remove functions which are not used anymore. (#683229)
2012-09-04 14:09:06 +02:00
Marek Kasik
6f8b9e8825 printers: Allow printer_get_ppd_async() to get PPD from remote host
Adds host_name and port parameters to printer_get_ppd_async(). If host_name
is NULL then it gets the PPD from local CUPS server. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
8695554557 printers: Make get_paper_size_from_locale() available to other source files
Export get_paper_size_from_locale() in pp-utils.h. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
142d2c65b4 printers: Add PpHost object for listing print devices
This commit adds PpHost object which represents a remote
host from which we want to get printers. It contains
asynchronous method for enumerating printers list from the host
using CUPS' SNMP backend and method for enumerating printers list
directly from the remote CUPS server running on the host. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
0cb0dab377 printers: Add async method for listing print devices
This commit adds asynchronous function get_cups_devices_async() which
sequentially executes CUPS' backends and returns found devices
by a callback. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
cc2e15a592 printers: Move common constants to pp-utils.h
Move constants which are used in more than one source file
to pp-utils.h. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
1f76a739e3 printers: Include missing header
<cups/cups.h> has to be included in pp-utils.h because there
are functions in pp-utils.h which accepts types defined
in the cups.h as their parameters. (#683229)
2012-09-04 14:09:05 +02:00
Marek Kasik
c6d8b9c825 printers: Place jobs to separate dialog
This commit places list of jobs to separate dialog. The dialog
is updated through calling of pp_jobs_dialog_update()
from "Printers" panel because the panel is already subscribed
to cups notifications.
2012-08-07 14:09:33 +02:00
Marek Kasik
a6b2db1e17 printers: Cancel async operations properly
Don't call callbacks of async functions called
from Printers panel if they were cancelled.
User data are not valid in that case (rhbz#845496).
2012-08-07 11:54:11 +02:00
Marek Kasik
7ae3027b47 printer: Add "Options" dialog
Add Options dialog which allows users to set more options than current dialog.
The dialog reads printer's PPD file and add its options to the dialog together
with some preselected IPP options (#678637).
All operations in the dialog are asynchronous.
During implementation of this, the option for setting allowed users was removed
because this is not suitable for this panel (the option is intended for
administrators).
2012-07-16 15:26:33 +02:00
Marek Kasik
dd7479caea printers: Allow users to change printer's PPD file
This commit adds popup window which when activated allows
user to select PPD from local database of installed PPDs,
select directly PPD from filesystem or select one from 3
recommended PPDs (#678637).
The popup is activated by clicking on model field (the panel
has to be unlocked). It starts to search for the best PPDs
available immediately after its popup.
All operations are asynchronous.
2012-07-16 13:53:40 +02:00
Marek Kasik
5272bcc06d printers: Use PrinterAddOption method to set media size
Use new cups-pk-helper's method PrinterAddOption for setting
default media size for new printers. This fixes problem with
setting default media size (#672694).
2012-04-13 13:09:38 +02:00
Robert Ancell
7dd5ae6b94 printers: Port to GDBus 2012-03-01 09:34:11 +11:00
Marek Kasik
07c7ffaf0c Printers: Show correct hostnames for printers
Show correct hostname for each remote printer. G-c-c gets
it from printer-uri-supported or from device-uri CUPS options now.
It also set 'printer-network' icon for remote printers to have them
easily recognizable from local printers.
2012-01-06 13:08:25 +01:00
Marek Kasik
8951bc41a7 Printers: Use system-config-printer's GetBestDrivers method
If available, use DBus method GetBestDriver which determines the best PPD file
for the given printer. This method is available in system-config-printer
since version 1.3.5 (#654742).
2011-08-02 14:20:29 +02:00
Marek Kasik
8f4895559a Printers: Allow editing of printer name and location
Use CcEditableEntry for editing name and location of local printers
(#649511).
2011-05-27 13:38:15 +02:00
Marek Kasik
8164c8f7f9 printers: Improve search for PPDs for new devices
Improve logic for selecting PPD from available PPDs.
Try to find the best PPD if there is not an exact match
(rhbz#691808, rhbz#691701).
2011-05-06 12:31:42 +02:00
Marek Kasik
7b830a3c6a printers: Cache PPD files for later use
Don't get PPD file from CUPS server every time user needs
an information from it. Have PPD files stored on disk and
delete them on exit.
2011-04-22 14:30:26 +02:00
Marek Kasik
2b3da7feb8 printers: Set default printer properly
Clean "~/.cups/lpoptions" file before setting default printer
on local CUPS server. Store default printer to "~/.cups/lpoptions"
if we are connected to a remote CUPS server (#646100).
2011-04-12 16:43:36 +02:00
Marek Kasik
3349308ea2 printers: Actualize printer list and job list automatically
This patch makes Printers panel to automatically refresh printers list
when a new printer is added or removed. It is refreshed also when a printer
changes its state (to see changes in paused/unpaused state) (rhbz#691718).
It also automatically refresh list of jobs (and also number of active jobs in
main tab) for actual printer (rhbz#691737).
2011-04-05 15:54:09 +02:00
Marek Kasik
3fb4d4af27 printers: Add dialog for adding new printers
The dialog is able to add printers discovered by cupsGetDevices().
It can also add printers from a remote CUPS server by typing
its address and selecting printer we want to add (#640734).
2011-03-07 17:09:00 +01:00