Commit graph

50 commits

Author SHA1 Message Date
Corey Berla
df51bed16c printers: Check for invalid characters in printer names
Currently when you rename a printer through the print details page
there is no indication of errors produced by CUPS, most notable
about any invalid characters used. Adds a function to check
for invalid characters and shows a warning to users.  No
attempt will be made to rename the printer if it contains an
invalid character.  Users are currently shown an elevation prompt
before this fix
https://www.cups.org/doc/man-lpstat.html

Partially addresses #1008
2022-05-10 05:11:51 +00:00
Georges Basile Stavracas Neto
8141af469c printers: Port to GTK4
Fortunately for us GtkTreeView still operates pretty
much exactly like in GTK3. Other than that, it's a
dense junction of all that we've done so far to port
other panels.
2021-12-14 22:34:21 -03:00
Robert Ancell
902f90e5ea printers: Add methods for getting printer name and location
Remove the GObject properties that aren't type safe.
2020-10-29 20:36:48 +00:00
Robert Ancell
703d833e2f printers: Don't pass PpPrinter references around
An internal GTask will hold a reference to it for the duration of the async call.
2020-09-22 21:23:05 +00:00
Robert Ancell
e6a05e535e printers: Fix PpPrinter reference leaks
They were not unreferenced in the callback.
2020-09-22 21:23:05 +00:00
Robert Ancell
7c1f84b4d3 printers: Don't pass PpMaintenanceCommand references around
An internal GTask will hold a reference to it for the duration of the async call.
2020-09-22 21:23:05 +00:00
Yuri Chornoivan
e7050ab6f4 Fix minor typos 2020-07-20 10:38:09 +03:00
Robert Ancell
b994237acd printers: Remove unused class members 2020-07-02 16:20:25 +00:00
Marek Kasik
dfbe1faea2 printers: Update GtkListBox of printers consecutively
Goal of this commit is to not overwhelm UI when a lot of printers is added
to CUPS. You can reproduce this situation when you add e.g. 30 printers using
lpadmin. Th UI stops to respond for some time.

To do so, the printer entries are not deleted every time there is a request
for updating of the list of printers but only new printer entries are added
and printer entries of deleted printers are removed. Other printer
entries are just updated by new method pp_printer_entry_update().
Which, by the way, is almost whole taken from pp_printer_entry_new().

This needed to add sort function for the list of printer entries. It sorts
printers according to their names not taking case into account.

In the similar manner, the filter function was extended to not show printers
which are being deleted. This needs a list of names of deleted printers
which we keep until they are really deleted.
One important thing here is the "reference" object which points to the panel
itself via its "self" key. We pass this object to the pp_printer_delete_async()'s
callback so it knows whether it can remove the printer's name from the list
of deleted printers (once the panel is being destroyed it clears the key itself).
2020-06-22 11:57:57 +00:00
Robert Ancell
4502673b6c printers: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:50 +13:00
Robert Ancell
c0cd99d2a8 printers: Convert jobs dialog to use GtkTemplate 2020-01-28 14:46:53 +00:00
Robert Ancell
d03da03ee9 printers: Set transient window externally to dialog code 2020-01-28 14:46:53 +00:00
Robert Ancell
181a496a4e printers: Return a GPtrArray instead of GList
This makes the memory able to be managed with g_autoptr.
This fixes a memory leak where the job list was leaked if the operation was cancelled.
2020-01-21 23:12:14 +00:00
Robert Ancell
60ea08cc64 printers: Make the options dialog a full widget using GtkTemplate 2019-09-10 12:36:38 +12:00
Robert Ancell
d4adf67549 printers: use gtk_dialog_run 2019-09-10 00:18:53 +00:00
Robert Ancell
3a027bddd0 printers: Set transient window externally to dialog code 2019-09-10 00:18:53 +00:00
Robert Ancell
7f67f6b24f printers: Don't use gtk_widget_show_all
It is removed in GTK+ 4
2019-09-10 00:18:53 +00:00
Robert Ancell
fcde07c770 printers: Remove pp_details_dialog_free, use gtk_widget_destroy 2019-09-10 00:18:53 +00:00
Robert Ancell
e9b9966e7d printers: Use g_autoptr with strings 2019-02-05 10:26:15 +13:00
Robert Ancell
47cd15d911 printers: Use self variable to match coding style 2019-01-30 11:33:28 +13:00
Robert Ancell
85604ab4f0 printers: Simplify finalize/dispose methods
Use g_clear_* functions to simplify code and ensure values are set to NULL after freeing.
2019-01-30 11:33:28 +13:00
Robert Ancell
4042cb5d33 printers: Replace GObject boilerplace with G_DECLARE_TYPE 2019-01-30 11:33:28 +13:00
Robert Ancell
3ed16310a1 printers: Fix printer delete signal passing an extra argument.
The extra argument doesn't seem to be used, but is confusing.
2018-09-17 16:07:48 +00:00
Robert Ancell
877445cbaf printers: Use g_autoptr for GError handling 2018-09-17 15:19:21 +00:00
Robert Ancell
b4e081d7f9 printers: Fix branch depending on uninitialized variable 2018-07-30 04:07:19 +00:00
Robert Ancell
55d47bc83e printers: Plug memory leaks 2018-06-25 22:53:10 +00:00
Robert Ancell
a64ef75ad7 Simplify use of GCancellable
g_cancellable_cancell can be called without checking for a NULL value.
Use g_clear_object instead of g_object_unref
2018-06-01 21:03:19 +00:00
Marek Kasik
873c2c6839 Printers: Add commandline action "show-jobs"
Add action "show-jobs" to printers panel which
gets printer name as a parameter and shows user
jobs dialog.
Syntax for trigerring this action looks like:
"gnome-control-center printers show-jobs my-local-printer".

https://bugzilla.gnome.org/show_bug.cgi?id=758170
2018-02-26 14:33:30 +01:00
Marek Kasik
212b8a6504 Printers: Add method for authentication of jobs to PpPrinterEntry
This commit adds method for triggerring of authentication of print jobs
to PpPrinterEntry. This is needed for asking for authentication of jobs
of a printer from the main panel.

https://bugzilla.gnome.org/show_bug.cgi?id=758170
2018-02-20 01:13:09 +01:00
Felipe Borges
34565466a2 printers: Don't show duplicates while renaming printer
During the time it took to rename a printer asynchronously, we had
cases where two entries were shown for the same printer: one with
the old name and another with a new name.

Now we signal from DetailsDialog to the given PrinterEntry which
passes it along to the main panel object. The CcPrintersPanel object
blacklists the renamed printer old name.

https://bugzilla.gnome.org/show_bug.cgi?id=790361
2018-02-05 14:15:10 +01:00
Felipe Borges
5d4cb8ea9c printer: Don't show the supply level bar by default
We were checking for the ink supply level at the callback of the
supply bar "draw" signal. This way we were making the the widget
visible, causing it to allocate vertical space even when it isn't
desired.

Now we check for the supply level before setting the visiblity of
the supply level widget.

https://bugzilla.gnome.org/show_bug.cgi?id=790667
2017-11-21 17:28:15 +01:00
Felipe Borges
756eb883df printers: Fix visibility guard for the printer "Model" label
This is a typo related to the fix at commit 7d25444.
2017-07-25 14:49:41 +02:00
Felipe Borges
7d254442a0 printers: Fix visibility guard for the printer "Model" label
We just present the printer "Model" when printer_make_and_model
is different than NULL OR not an empty string.

We were using the wrong logic operator in the conditional that
toggles the visibility of this info.
2017-07-20 13:35:38 +02:00
Felipe Borges
0d0b42eb50 printers: Hide supply level bar when there is no inklevel data
https://bugzilla.gnome.org/show_bug.cgi?id=779702
2017-06-15 15:39:22 +02:00
Felipe Borges
ee42831fcd printers: Add print "Test Page" button to Options Dialog
https://bugzilla.gnome.org/show_bug.cgi?id=779708
2017-06-14 10:45:25 +02:00
Felipe Borges
f065f5005f printers: Allow undoing deletion of a printer
Instead of directly applying the deletion of a printer, we should
follow the GNOME in-app notification deletion guidelines.

This patch introduces the in-app notification following the HIG[0]
for the deletion of a printer. It allows to "undo" the deletion.

The default behavior for these notification is to dismiss a previous
notification. In doing so, when deleting multiple printers, the
"Undo" button only restores the last deleted one. We don't do batch/
bulk removal in the printers panel.

[0] https://developer.gnome.org/hig/stable/in-app-notifications.html.en

https://bugzilla.gnome.org/show_bug.cgi?id=693187
2017-05-26 13:16:39 +02:00
Felipe Borges
5aca01cd65 printers: Remove printers asynchronously
Introduce pp_printer_delete_async ()

https://bugzilla.gnome.org/show_bug.cgi?id=693187
2017-05-26 13:16:36 +02:00
Felipe Borges
870b4e7190 printers: Filter the printer-location in the search
Show printer search results where the searched string matches
the printer-location.

https://bugzilla.gnome.org/show_bug.cgi?id=779656
2017-05-10 11:04:29 +02:00
Felipe Borges
34aedbe992 printers: Add search capabilities to the panel
Due to the recent changes towards the new design, it became slightly
harder to find a printer given a long list of entries.

This patch introduces search capabilities to the panel, filtering
based on the printer name.

https://bugzilla.gnome.org/show_bug.cgi?id=779656
2017-05-09 15:52:12 +02:00
Felipe Borges
e26756d7e3 printers: Make printers-list a GtkListBox
By making the printers list a GtkListBox instead of a GtkBox, we
can use listbox's capabilities for sorting and filter.

https://bugzilla.gnome.org/show_bug.cgi?id=779656
2017-05-09 15:47:04 +02:00
Mario Sanchez Prada
b742936970 printers: Expose the newly added 'Clean' maintenance command to users
Add an extra button "Clean Print Heads" that will be shown when the relevant
maintenance command is available for a printer, to bring this feature back.

Additionally, this commit adds a 'parameters' attribute to PpMaintenanceCommand,
which is needed as the "Clean" command requires to at least be passed "all" as
its single parameter: https://www.cups.org/doc/spec-command.html#Clean

https://bugzilla.gnome.org/show_bug.cgi?id=764620
2017-03-23 13:30:22 +00:00
Felipe Borges
909eb2ac31 printers: Make the dialogs independent of the PpPrinterEntry lifetime
https://bugzilla.gnome.org/show_bug.cgi?id=779846
2017-03-13 09:20:23 +01:00
Felipe Borges
1d0ae49685 printers: Introduce pp_printer_get_jobs_async ()
It is a PpPrinter method to query asychronously for printing jobs
information.

It should replace cups_get_jobs_async ()

https://bugzilla.gnome.org/show_bug.cgi?id=779313
2017-03-06 16:05:29 +01:00
Felipe Borges
5dd8e58585 printers: Free the PpJobsDialog after closing it
Now we can safely pp_jobs_dialog_free () the PpJobsDialog.

https://bugzilla.gnome.org/show_bug.cgi?id=779079
2017-02-27 16:52:17 +01:00
Felipe Borges
fe51a743c3 printers: Count only current users job
Instead of querying for all the jobs, query just for jobs belonging
to the current user.

https://bugzilla.gnome.org/show_bug.cgi?id=779079
2017-02-27 16:29:44 +01:00
Felipe Borges
5302047ff1 printers: Subscribe to jobs notifications
The previous implementation of the panel was unable to individually
update a PpPrinterEntry jobs count and its PpJobsDialog.

These changes make the job notifications trigger updates in the
PpPrinterEntry UIs, keeping track of job events on the go.

https://bugzilla.gnome.org/show_bug.cgi?id=779079
2017-02-27 16:29:43 +01:00
Felipe Borges
86c028ff9b printers: Fill the supply_frame background when supply is empty
According to the mockups at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines
The supply level bar should have a grey background when there are
no colors in the supply bar.

This patch sets the "background" css name to the supply_frame when
there's not a single color in the supply bar.

https://bugzilla.gnome.org/show_bug.cgi?id=779075
2017-02-26 12:52:29 +01:00
Felipe Borges
2c7fc8653d printers: Tweak the printer supply level bar
Make the supply level bar size, margin, border, background, and
saturation match the mockups at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines

Even though we would obtain primary colors by querying the printer
supply info, it is more eye-candy to desaturate (tone down) the
colors in the UI.

https://bugzilla.gnome.org/show_bug.cgi?id=779075
2017-02-26 12:52:29 +01:00
Felipe Borges
7e3d89e13a printers: Introduce PpDetailsDialog
This dialog handles the editing of printer properties such as
name, location, automatic discovery of driver, manual selection
of printer driver, and manual selection of ppd file.

https://bugzilla.gnome.org/show_bug.cgi?id=767600
2017-02-13 19:40:09 +01:00
Felipe Borges
37e37961e5 printers: introduce PpPrinterEntry widget
This commit introduces the following regressions:
- no possibility of renaming properties such as printer names,
location, or changing model/driver. This issue is going to be
solved nextly by the introduction of the PpDetailsDialog.

https://bugzilla.gnome.org/show_bug.cgi?id=767600
2017-02-13 19:27:49 +01:00