Commit graph

34 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
Marek Kasik
634d622c7a printers: Show file chooser dialog when selecting PPD
A regression from the GTK4 port.
2022-02-04 17:15:53 +01: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
Brandon Nielsen
c3c58aae38 Code cleanup based on feedback. 2021-07-26 16:03:05 +00:00
Brandon Nielsen
b19325167d gtk_widget_show over gtk_widget_show_all. 2021-07-26 16:03:05 +00:00
Brandon Nielsen
16aa95bdc8 Return a PpNewPrinter instead of PpPrintDevice, use gtk_show_all
pp_new_printer_dialog_get_new_print_device is replaced with
pp_new_printer_dialog_get_new_printer which returns a PpNewPrinter.

gtk_show_all is used instead of gtk_dialog_run for PpNewPrinterDialog
and PpPPDSelectionDialog.

This is in response to feedback:
https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/930#note_1202114
2021-07-26 16:03:05 +00:00
Robert Ancell
5b086c44e8 printers: Don't pass ownership in get_all_ppds_async callback 2021-02-15 10:34:32 +13:00
Robert Ancell
d970ae48b4 printers: Don't pass ownership in get_ppd_names_async callback 2021-02-15 10:34:32 +13:00
Brandon Nielsen
c239521e9d Change PpPPDSelectionDialog to GtkDialog
The dialog is now displayed by calling gtk_dialog_run and
gtk_window_set_transient_for in the window displaying the dialog.
Cleanup is handled using gtk_widget_destroy.

Destructors in the windows using the dialog no longer cleanup the dialog
as it is assumed it will be either cleaned up after the response
callback, or handled by the destroy_with_parent property set on the
dialog itself.
2021-01-08 02:49:32 +00: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
Brandon Nielsen
26e8f11566 component: PpPPDSelectionDialog
G_IS_OBJECT checks fail when calling g_signal_connect_object because
PpPPDSelectionDialog is a struct, not a type descending from G_OBJECT.

This makes the changes required for PpPPDSelectionDialog to be a
GObject, and defines PpPPDSelectionDialog as a GObject. It also updates
consumers of PpPPDSelectionDialog to destroy created PpPPDSelectionDialogs as GObjects.

https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1126
2020-09-25 01:59:57 +00:00
Robert Ancell
b994237acd printers: Remove unused class members 2020-07-02 16:20:25 +00:00
Robert Ancell
d4b47bd9ff printers: Sort variables 2019-09-10 00:18:53 +00:00
Robert Ancell
1b999f36e2 printers: Use gtk_stack_set_visible_child instead of names 2019-09-10 00:18:53 +00:00
Robert Ancell
2c28987e41 printers: Connect signals in swapped form 2019-09-10 00:18:53 +00:00
Robert Ancell
d4adf67549 printers: use gtk_dialog_run 2019-09-10 00:18:53 +00:00
Robert Ancell
a50ce39689 printers: Drop unused class structure 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
fcde07c770 printers: Remove pp_details_dialog_free, use gtk_widget_destroy 2019-09-10 00:18:53 +00:00
Robert Ancell
fb92795854 printers: Make .ui filename match the .c filename 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
2c6eb2b4fd printers: Fix GCancellable leak
Use the dialog cancellable instead of leaking one each time the PPD is set.
2019-01-30 11:41:07 +13:00
Robert Ancell
e20fd185c8 printers: Use dialog cancellable in async call
Otherwise this could crash if the dialog is destroyed before the PPD is set.
2019-01-30 11:41:07 +13:00
Robert Ancell
3dda349aa3 printers: Use a single GCancellable for PpDetailsDialog
The cancellable is only used to cancel when the dialog is destroyed, so you can
share it for all calls.
2019-01-30 11:41:07 +13:00
Robert Ancell
4042cb5d33 printers: Replace GObject boilerplace with G_DECLARE_TYPE 2019-01-30 11:33:28 +13: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
Benjamin Berg
e1593b3c02 shell: Remove CcEditableEntry, it is not used anywhere 2018-04-17 14:59:31 +02: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
4cfb211761 printers: Ellipsize the "Details Dialog" title
Printers with long names were causing the "Printer Details Dialog"
to expande horizontally.

This patch ellipsizes the custom title of the dialog.

https://bugzilla.gnome.org/show_bug.cgi?id=779071
2017-02-26 12:49:43 +01:00
Felipe Borges
ca30e0ead9 printers: Use async rename method
pp_printer_rename_async is better than the old printer_rename
utility.

The PpDetailsDialog doesn't need to do anything in the callback
since we are emiting the "printer-changed" signal when the dialog
is closed.

https://bugzilla.gnome.org/show_bug.cgi?id=769114
2017-02-22 17:05:50 +01:00
Felipe Borges
5fa1dede21 printers: Do not apply rename/location changes in focus-out-event
Since we are already applying the changing in the PpDetailsDialog
when it gets closed, there's no need to apply these changes in
the focus-out-event of its respective GtkEntries.

https://bugzilla.gnome.org/show_bug.cgi?id=769114
2017-02-22 17:05:50 +01:00
Felipe Borges
6bfc60b779 printers: Make the printer address always sensitive
This patch individually updates the sensitivity of the
PpDetailsDialog child widgets, so we can leave the printer
address label always sensitive.

https://bugzilla.gnome.org/show_bug.cgi?id=778682
2017-02-15 15:56:32 +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