Commit graph

124 commits

Author SHA1 Message Date
Alice Mikhaylenko
8473c78b22 printers: Port dialogs to AdwWindow and AdwToolbarView 2023-08-25 08:00:43 +00:00
Maksym Hazevych
d831e5cb48 Replace all occurrences of 'gtk_widget_show'
Replace all occurrences of 'gtk_widget_show(smth)' with
'gtk_widget_set_visible(smth, TRUE)'.
2023-03-29 14:26:55 +13:00
Marek Kasik
9f0733182a printers: Destroy ppd selection dialog explicitly
Destroy PpPPDSelectionDialog in dispose method of PpNewPrinterDialog
as its transient-for property was unset by previous commit
and the dialog is not destroyed automatically now.
2022-03-02 11:03:59 +00:00
Marek Kasik
e81651873c printers: Unset transient-for
Unset transient-for for PpPPDSelectionDialog in its responce callback
since due some reason its parent PpNewPrinterDialog is destroyed first
and once the PpPPDSelectionDialog is being destroyed it tries to
unset the transient-for but unsuccesfully resulting in warnings like:

"instance with invalid (NULL) class pointer"
"g_signal_handlers_disconnect_matched: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed"
2022-03-02 11:03:59 +00:00
Brandon Nielsen
18b7f6f026 Simplify callback logic in ppd_selection_cb.
This ensures user_callback does not get called twice when cancelling out
of the ppd selection dialog. Fixes #1599, introduced with 179bda1b / MR: 1011.
2022-02-25 11:44:14 +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
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
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
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
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
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
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
f3bf0080d7 printers: Don't pass GDBusConnection 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
Robert Ancell
b2c5056031 printers: Use g_autoptr 2020-09-22 21:23:04 +00:00
Yuri Chornoivan
e7050ab6f4 Fix minor typos 2020-07-20 10:38:09 +03:00
Robert Ancell
bc648d9c92 printers: Replace PpDevicesList with standard GPtrArray 2020-07-20 14:14:44 +12:00
Robert Ancell
b994237acd printers: Remove unused class members 2020-07-02 16:20:25 +00:00
Elia Geretto
1bf5d4f55f printers: Do not authenticate SMB servers when search field is edited
When the search field in the "Add Printer" dialog is edited, no
authentication with a remote SMB server should be attempted. The server
should just be added to the list and marked with "Server requires
authentication". The user can then authenticate the server by clicking
on it.

The behavior described above is probably the intended one when the code
was written, since there is no closure registered for the
"authentication-required" signal in the function this commit modifies.
This commit should simply restore the intended behavior.

Resolves: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/755
2020-05-12 22:16:32 +00:00
Robert Ancell
815db8f404 printers: Replace explicit g_variant_unref calls with g_autoptr 2020-03-30 03:24:58 +00:00
Robert Ancell
3a7533da1b printers: Use g_autoptr for the results of D-Bus calls 2020-03-30 03:24:58 +00:00
Robert Ancell
67074b7aea printers: Fix GVariantIter leaks 2020-03-30 03:24:58 +00:00
Robert Ancell
46443af0ca printers: Replace GVariant iteration with direct call to copy value 2020-03-30 03:24:58 +00:00
Robert Ancell
9065850b92 printers: Replace g_variant_iter_next_value with the simpler g_variant_iter_next 2020-03-30 03:24:58 +00:00
Robert Ancell
4502673b6c printers: Connect signals with g_signal_connect_object in swapped form 2020-03-30 16:18:50 +13:00
Marek Kasik
923b726b3b printers: Provide a scheme to address parser
Add a scheme to the address which we test for correctness
by g_network_address_parse_uri(). It does not work without it.
Use "none" scheme if user did not entered one.
Use port number 0 if user did not specify any.

Fixes #679
2019-10-08 18:05:56 +02:00
Robert Ancell
9a2e821fe5 Initialize autoptr values to NULL.
These cases were safe, but if the code changed this risked freeing uninitialized
memory.
2019-10-03 10:58:38 +13:00
Felipe Borges
e497ad900d printers: Check whether URI is valid while searching for printers
Fixes #679
2019-10-01 18:56:23 +02: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
fb09d9c090 printers: Use g_error_matches where appropriate 2018-12-10 10:13:28 +13:00
Robert Ancell
877445cbaf printers: Use g_autoptr for GError handling 2018-09-17 15:19:21 +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
f3257ce82a printers: Focus search entry in new printer dialog
Focus search entry in the new printer dialog once user starts to type
so he does not need to click on it.

Closes #41
2018-05-10 16:47:10 +00:00
Felipe Borges
fc073f2185 printers: Authenticate samba server also on double-click
The "Add Printer" dialog should be smart enough to know whether
an item listed in the dialog is a samba server or just a printer.
If it is a samba server, it should go for the authentication page
instead of emitting a GTK_RESPONSE_*.

https://bugzilla.gnome.org/show_bug.cgi?id=778277
2017-02-07 13:14:40 +01:00
Felipe Borges
6f3ed9087d printers: Allow dismissing authentication in "Add New Printer" dialog
Introduce a "go-back" button allowing to get back to the list of
printers when the user is exposed to the authentication form in
the "Add New Printer" dialog.

This is a redesign based on the newest mockups available at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines

https://bugzilla.gnome.org/show_bug.cgi?id=760783
2017-02-01 17:53:40 +01:00
Felipe Borges
e8cdaea332 printers: Decouple PpSamba and the PpNewPrinterDialog
PpSamba no longer needs to hold a reference to the dialog window.

https://bugzilla.gnome.org/show_bug.cgi?id=760783
2017-01-18 15:21:38 +01:00
Felipe Borges
ebe21b68ab printers: Use "hostname" in the "Add Printer" dialog
https://bugzilla.gnome.org/show_bug.cgi?id=760783
2017-01-18 15:21:38 +01:00
Felipe Borges
afac6d5340 printers: Merge authentication dialog into "Add Printer"
This is a redesign based on the newest mockups available at
https://wiki.gnome.org/Design/SystemSettings/Printers#Guidelines

https://bugzilla.gnome.org/show_bug.cgi?id=760783
2017-01-18 10:20:20 +01:00