[gtk+] Make print dialog destruction work



commit 2392b1e534c8e176ecff773ff22699de2d4bf358
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 17 21:40:36 2014 -0500

    Make print dialog destruction work
    
    This was also causing the templates test to fail.

 gtk/gtkprintunixdialog.c               |   13 ++++++++++---
 gtk/resources/ui/gtkprintunixdialog.ui |    1 -
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 052271b..170f368 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -121,7 +121,7 @@
 static GObject *gtk_print_unix_dialog_constructor  (GType               type,
                                                     guint               n_params,
                                                     GObjectConstructParam *params);
-static void     gtk_print_unix_dialog_destroy      (GtkPrintUnixDialog *dialog);
+static void     gtk_print_unix_dialog_destroy      (GtkWidget          *widget);
 static void     gtk_print_unix_dialog_finalize     (GObject            *object);
 static void     gtk_print_unix_dialog_set_property (GObject            *object,
                                                     guint               prop_id,
@@ -400,6 +400,7 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
   object_class->get_property = gtk_print_unix_dialog_get_property;
 
   widget_class->style_updated = gtk_print_unix_dialog_style_updated;
+  widget_class->destroy = gtk_print_unix_dialog_destroy;
 
   g_object_class_install_property (object_class,
                                    PROP_PAGE_SETUP,
@@ -538,7 +539,6 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
   gtk_widget_class_bind_template_child_private (widget_class, GtkPrintUnixDialog, number_up_layout);
 
   /* Callbacks handled in the UI */
-  gtk_widget_class_bind_template_callback (widget_class, gtk_print_unix_dialog_destroy);
   gtk_widget_class_bind_template_callback (widget_class, redraw_page_layout_preview);
   gtk_widget_class_bind_template_callback (widget_class, error_dialogs);
   gtk_widget_class_bind_template_callback (widget_class, emit_ok_response);
@@ -812,10 +812,14 @@ gtk_print_unix_dialog_constructor (GType                  type,
 }
 
 static void
-gtk_print_unix_dialog_destroy (GtkPrintUnixDialog *dialog)
+gtk_print_unix_dialog_destroy (GtkWidget *widget)
 {
+  GtkPrintUnixDialog *dialog = GTK_PRINT_UNIX_DIALOG (widget);
+
   /* Make sure we don't destroy custom widgets owned by the backends */
   clear_per_printer_ui (dialog);
+
+  GTK_WIDGET_CLASS (gtk_print_unix_dialog_parent_class)->destroy (widget);
 }
 
 static void
@@ -1949,6 +1953,9 @@ clear_per_printer_ui (GtkPrintUnixDialog *dialog)
 {
   GtkPrintUnixDialogPrivate *priv = dialog->priv;
 
+  if (priv->finishing_table == NULL)
+    return;
+
   gtk_container_foreach (GTK_CONTAINER (priv->finishing_table),
                          (GtkCallback)gtk_widget_destroy, NULL);
   gtk_container_foreach (GTK_CONTAINER (priv->image_quality_table),
diff --git a/gtk/resources/ui/gtkprintunixdialog.ui b/gtk/resources/ui/gtkprintunixdialog.ui
index 0f62385..9d428ab 100644
--- a/gtk/resources/ui/gtkprintunixdialog.ui
+++ b/gtk/resources/ui/gtkprintunixdialog.ui
@@ -50,7 +50,6 @@
   <template class="GtkPrintUnixDialog" parent="GtkDialog">
     <property name="can_focus">False</property>
     <property name="type_hint">normal</property>
-    <signal name="destroy" handler="gtk_print_unix_dialog_destroy" swapped="no"/>
     <signal name="notify::page-setup" handler="redraw_page_layout_preview" swapped="no"/>
     <signal name="response" handler="error_dialogs" swapped="no"/>
     <child internal-child="vbox">


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]