diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2018-11-23 12:35:35 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@gmail.com> | 2019-09-10 00:18:53 +0000 |
commit | fcde07c7700e9a116c975642ea44cf134c7c2d3d (patch) | |
tree | 371bc9c7a2db681d36d1d4c9e598742d50b0c542 /panels/printers | |
parent | fb92795854a61c542b3614b65150c356f38538c3 (diff) | |
download | gnome-control-center-fcde07c7700e9a116c975642ea44cf134c7c2d3d.tar.gz |
printers: Remove pp_details_dialog_free, use gtk_widget_destroy
Diffstat (limited to 'panels/printers')
-rw-r--r-- | panels/printers/pp-details-dialog.c | 46 | ||||
-rw-r--r-- | panels/printers/pp-details-dialog.h | 1 | ||||
-rw-r--r-- | panels/printers/pp-printer-entry.c | 13 |
3 files changed, 27 insertions, 33 deletions
diff --git a/panels/printers/pp-details-dialog.c b/panels/printers/pp-details-dialog.c index a1aa63871..e4613de8f 100644 --- a/panels/printers/pp-details-dialog.c +++ b/panels/printers/pp-details-dialog.c @@ -362,10 +362,34 @@ pp_details_dialog_init (PpDetailsDialog *self) } static void +pp_details_dialog_dispose (GObject *object) +{ + PpDetailsDialog *self = PP_DETAILS_DIALOG (object); + + g_clear_pointer (&self->printer_name, g_free); + g_clear_pointer (&self->printer_location, g_free); + g_clear_pointer (&self->ppd_file_name, g_free); + + if (self->all_ppds_list != NULL) + { + ppd_list_free (self->all_ppds_list); + self->all_ppds_list = NULL; + } + + g_cancellable_cancel (self->cancellable); + g_clear_object (&self->cancellable); + + G_OBJECT_CLASS (pp_details_dialog_parent_class)->dispose (object); +} + +static void pp_details_dialog_class_init (PpDetailsDialogClass *klass) { + GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + object_class->dispose = pp_details_dialog_dispose; + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/control-center/printers/pp-details-dialog.ui"); gtk_widget_class_bind_template_child (widget_class, PpDetailsDialog, dialog_title); @@ -428,25 +452,3 @@ pp_details_dialog_new (GtkWindow *parent, return self; } - -void -pp_details_dialog_free (PpDetailsDialog *self) -{ - if (self != NULL) - { - g_clear_pointer (&self->printer_name, g_free); - g_clear_pointer (&self->printer_location, g_free); - g_clear_pointer (&self->ppd_file_name, g_free); - - if (self->all_ppds_list != NULL) - { - ppd_list_free (self->all_ppds_list); - self->all_ppds_list = NULL; - } - - g_cancellable_cancel (self->cancellable); - g_clear_object (&self->cancellable); - - gtk_widget_destroy (GTK_WIDGET (self)); - } -} diff --git a/panels/printers/pp-details-dialog.h b/panels/printers/pp-details-dialog.h index 6da259859..ec6154b88 100644 --- a/panels/printers/pp-details-dialog.h +++ b/panels/printers/pp-details-dialog.h @@ -34,6 +34,5 @@ PpDetailsDialog *pp_details_dialog_new (GtkWindow *parent, gchar *printer_address, gchar *printer_make_and_model, gboolean sensitive); -void pp_details_dialog_free (PpDetailsDialog *dialog); G_END_DECLS diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c index 0ac802996..c402dae3c 100644 --- a/panels/printers/pp-printer-entry.c +++ b/panels/printers/pp-printer-entry.c @@ -420,21 +420,12 @@ details_dialog_cb (GtkDialog *dialog, { PpPrinterEntry *self = user_data; - pp_details_dialog_free (self->pp_details_dialog); - self->pp_details_dialog = NULL; + g_clear_pointer ((GtkWidget **) &self->pp_details_dialog, gtk_widget_destroy); g_signal_emit_by_name (self, "printer-changed"); } static void -details_dialog_free_cb (GtkDialog *dialog, - gint response_id, - gpointer user_data) -{ - pp_details_dialog_free (PP_DETAILS_DIALOG (dialog)); -} - -static void on_show_printer_details_dialog (GtkButton *button, PpPrinterEntry *self) { @@ -994,6 +985,8 @@ pp_printer_entry_dispose (GObject *object) g_signal_connect (self->pp_details_dialog, "response", G_CALLBACK (details_dialog_free_cb), NULL); } + g_clear_pointer ((GtkWidget **) &self->pp_details_dialog, gtk_widget_destroy); + if (self->pp_options_dialog != NULL) pp_options_dialog_set_callback (self->pp_options_dialog, printer_options_dialog_free_cb, self->pp_options_dialog); |