Commit graph

561 commits

Author SHA1 Message Date
Jan Beich
37b29c32cb meson: drop unused argument for i18n.merge_file()
Ignored in Meson < 0.60.0, deprecated since 0.60.1 and fatal since 0.61.0.

panels/applications/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/background/meson.build:10:5: ERROR: Function does not take positional arguments.
panels/camera/meson.build:10:5: ERROR: Function does not take positional arguments.
[...]
2022-01-07 17:22:43 +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
zhuyaliang
51760441b3 printers: Add adjust printer task priority button
Add a new  button to the 'PpJobRow',This button can adjust the priority of tasks in the print queue to the highest
2021-11-10 15:10:20 +00:00
Brandon Nielsen
c3c58aae38 Code cleanup based on feedback. 2021-07-26 16:03:05 +00:00
Brandon Nielsen
a73a095d76 ppd_list is not a copy, don't free it.
Both consumers of PpPPDSelectionDialog (PpNewPrinterDialog,
PpDetailsDialog) free the PPDList they pass to
pp_ppd_selection_dialog_set_ppd_list and they do not pass a copy, so
PpPPDSelectionDialog should not free the pointer on dispose.

This fixes a racy segfault when closing a PpDetailsDialog after PPD
selection (introduced with this series), did not appear with
PpNewPrinterDialog for some reason.
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
6223858c5e Formatting cleanup. 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
Brandon Nielsen
179bda1b64 Make PpNewPrinterDialog a GtkDialog instead of GObject
This is accomplished by moving the calls to pp_printer_add_async
directly to CcPrintersPanel. pp_printer_delete_async calls are already
done directly in the CcPrintersPanel so there is consistency gained by
this implementation in addition to PpNewPrinterDialog actually being a
GtkDialog.

A pp_new_printer_dialog_get_new_print_device method has been added to
PpNewPrinterDialog to allow getting the PpPrintDevice selected by the
user to add. This can be called anytime after a response callback
with a GTK_RESPONSE_OK reponse_id.

PpNewPrinterDialog still does asynchronous operations to populate the
dialog, but the create dialog -> receive signal -> destroy dialog flow
can all be handled like a traditional GtkDialog without additional
callbacks or signalling.
2021-07-26 16:03:05 +00:00
Eric
1fc8b772a4 printers: Make "Add…" button consistent with user accounts panel
The "Add..." toolbar button on the printers panel is currently hidden until the panel is unlocked.
This commit makes the button visible but insensitive when the panel is locked (becoming sensitive when unlocked),
as suggested in #1213. It also changes the text from "Add..." to "Add Printer..."
and updates the subtitle in the infobar to "Unlock to Add Printers and Change Settings."
These changes make the button's UI consistent with the Accounts panel's "Add User..." toolbar button.

Closes #1213
2021-06-09 13:34:01 +00:00
Robert Ancell
2ee5f1422a printers: Ensure PPD copy is always deleted 2021-02-15 10:34:32 +13:00
Robert Ancell
81392210f2 printers: Add note about callback that passed ownership 2021-02-15 10:34:32 +13:00
Robert Ancell
797c36dc0a printers: Improve memory management of backend list 2021-02-15 10:34:32 +13: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
98fd38278a printers: Don't pass ownership in get_ipp_attributes_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
Robert Ancell
0d913f7283 printers: Remove use of goto 2021-02-15 10:34:32 +13:00
Robert Ancell
cede2f5a81 printers: Use g_autoptr for utility functions 2021-02-15 10:34:32 +13:00
Robert Ancell
005b18f2f1 printers: Make helper functions for callback data 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
6622b39632 printers: Make PpJobRow widget 2020-12-14 09:51:19 +13:00
Robert Ancell
cd070d2e5a printers: Clear up use of gpointer value 2020-12-14 09:51:19 +13:00
Robert Ancell
ae1a37b009 printers: Remove use of gtk_widget_show_all
It is removed in GTK 4.
2020-11-26 16:02:57 +00:00
Robert Ancell
ce23d7e0b1 printers: Ensure objects are destroyed when dialog destroyed 2020-11-24 12:31:21 +13:00
Robert Ancell
2c46436636 printers: Remove redundant variable set to NULL 2020-11-24 12:24:38 +13:00
Robert Ancell
5e2e4a55af printers: Cancel adding printer if PPD dialog is cancelled 2020-11-24 12:23:42 +13:00
Robert Ancell
388e59e66a printers: Fix string leaks in new printer dialog 2020-11-24 12:23:42 +13:00
Robert Ancell
7fb336e17b printers: Make printers panel have a smaller minimum width.
Allow the ink-level to overlap with the buttons.
2020-11-19 23:24:31 +00:00
Robert Ancell
06eb07bbd6 printers: Remove dead PPD dialog code 2020-11-10 14:47:20 +13:00
Robert Ancell
7bbbef5fde printers: Fix autoptr object not being initialized to NULL.
Won't cause a problem in this case but should be done for safety.

Introduced in ad226b420c
2020-11-02 09:25:04 +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
ad226b420c printers: Use g_autoptr with GThread 2020-10-30 11:42:14 +13: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
Marek Kasik
c18875c623 printers: Do not cleanup task after getting bus
Use g_steal_pointer() on task in get_bus_cb() in pp-printer.c
to not invalidate a pointer passed to a DBus call.
Cleanup the task in callback of the DBus call.
2020-10-29 20:19:01 +00:00
Robert Ancell
2def271824 printers: Add pp_job_new and associated methods.
The previous code was leaking a string (job title), used an integer pointer
instead of an integer for an id and requited a lot of memory management for a
string array. There was a lot of boilerplate code required for property
management which was not being used much. This is why type safe methods are a
much better idea than GObject properties. :)
2020-10-27 13:03:56 +00:00
Brandon Nielsen
9364deba3e Code cleanup as per HACKING. 2020-09-25 01:59:57 +00:00
Brandon Nielsen
68dca0e748 Consumers clean up the PPD list, not the dialog itself. 2020-09-25 01:59:57 +00:00
Brandon Nielsen
bee87f1b0a Spaces over tabs. 2020-09-25 01:59:57 +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
68042c95c1 printers: Use a shared PpCups object 2020-09-22 21:23:05 +00:00
Robert Ancell
f8204635ce printers: Fix location where GTask is unreffed 2020-09-22 21:23:05 +00:00
Robert Ancell
b25db4f601 printers: Don't pass PpJob references around
An internal GTask will hold a reference to it for the duration of the async calls.
2020-09-22 21:23:05 +00:00
Robert Ancell
f42d7cca9a printers: Don't pass PpNewPrinter references around
An internal GTask will hold a reference to it for the duration of the async calls.
2020-09-22 21:23:05 +00:00
Robert Ancell
9d0815bb90 printers: Don't pass PpCups references around
An internal GTask will hold a reference to it for the duration of the async calls.
2020-09-22 21:23:05 +00:00
Robert Ancell
519c390b04 printers: Don't pass PpHost references around
An internal GTask will hold a reference to it for the duration of the async calls.

Correctly unref these objects in finalize.
2020-09-22 21:23:05 +00:00
Robert Ancell
7ebf0f22aa printers: Don't pass PpSamba references around
An internal GTask will hold a reference to it for the duration of the async calls.
2020-09-22 21:23:05 +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
Robert Ancell
5f4599d649 printers: Don't pass GFile references around
An internal GTask will hold a reference to it for the duration of the async call.
2020-09-22 21:23:04 +00:00