[gnome-control-center] printers: Don't pass PpSamba references around
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] printers: Don't pass PpSamba references around
- Date: Tue, 22 Sep 2020 21:30:36 +0000 (UTC)
commit 7ebf0f22aa2b4d8ae9153e310ea77dd7c8911822
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Jun 26 17:01:01 2020 +1200
printers: Don't pass PpSamba references around
An internal GTask will hold a reference to it for the duration of the async calls.
panels/printers/pp-new-printer-dialog.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
---
diff --git a/panels/printers/pp-new-printer-dialog.c b/panels/printers/pp-new-printer-dialog.c
index 04b6b0469..e17e36ce5 100644
--- a/panels/printers/pp-new-printer-dialog.c
+++ b/panels/printers/pp-new-printer-dialog.c
@@ -248,13 +248,9 @@ get_authenticated_samba_devices_cb (GObject *source_object,
PpNewPrinterDialog *self = PP_NEW_PRINTER_DIALOG (data->dialog);
g_autoptr(GPtrArray) devices = NULL;
gboolean cancelled = FALSE;
- PpSamba *samba = (PpSamba *) source_object;
g_autoptr(GError) error = NULL;
- g_object_ref (samba);
-
- devices = pp_samba_get_devices_finish (samba, res, &error);
- g_object_unref (source_object);
+ devices = pp_samba_get_devices_finish (PP_SAMBA (source_object), res, &error);
if (devices != NULL)
{
@@ -546,6 +542,7 @@ pp_new_printer_dialog_finalize (GObject *object)
g_clear_object (&self->local_printer_icon);
g_clear_object (&self->remote_printer_icon);
g_clear_object (&self->authenticated_server_icon);
+ g_clear_object (&self->samba_host);
if (self->num_of_dests > 0)
{
@@ -1131,16 +1128,13 @@ get_samba_host_devices_cb (GObject *source_object,
{
PpNewPrinterDialog *self = user_data;
g_autoptr(GPtrArray) devices = NULL;
- PpSamba *samba = (PpSamba *) source_object;
g_autoptr(GError) error = NULL;
- devices = pp_samba_get_devices_finish (samba, res, &error);
- g_object_unref (source_object);
+ devices = pp_samba_get_devices_finish (PP_SAMBA (source_object), res, &error);
if (devices != NULL)
{
- if ((gpointer) source_object == (gpointer) self->samba_host)
- self->samba_host = NULL;
+ g_clear_object(&self->samba_host);
add_devices_to_list (self, devices);
@@ -1152,8 +1146,7 @@ get_samba_host_devices_cb (GObject *source_object,
{
g_warning ("%s", error->message);
- if ((gpointer) source_object == (gpointer) self->samba_host)
- self->samba_host = NULL;
+ g_clear_object(&self->samba_host);
update_dialog_state (self);
}
@@ -1167,11 +1160,9 @@ get_samba_devices_cb (GObject *source_object,
{
PpNewPrinterDialog *self = user_data;
g_autoptr(GPtrArray) devices = NULL;
- PpSamba *samba = (PpSamba *) source_object;
g_autoptr(GError) error = NULL;
- devices = pp_samba_get_devices_finish (samba, res, &error);
- g_object_unref (source_object);
+ devices = pp_samba_get_devices_finish (PP_SAMBA (source_object), res, &error);
if (devices != NULL)
{
@@ -1828,7 +1819,7 @@ static void
populate_devices_list (PpNewPrinterDialog *self)
{
GtkTreeViewColumn *column;
- PpSamba *samba;
+ g_autoptr(PpSamba) samba = NULL;
g_autoptr(GEmblem) emblem = NULL;
PpCups *cups;
g_autoptr(GIcon) icon = NULL;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]