[gnome-control-center] printers: Set transient window externally to dialog code



commit d03da03ee966ddfed627c4d46776ae18ae424f1e
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Sep 10 14:01:04 2019 +1200

    printers: Set transient window externally to dialog code

 panels/printers/pp-jobs-dialog.c   | 6 +-----
 panels/printers/pp-jobs-dialog.h   | 3 +--
 panels/printers/pp-printer-entry.c | 2 +-
 3 files changed, 3 insertions(+), 8 deletions(-)
---
diff --git a/panels/printers/pp-jobs-dialog.c b/panels/printers/pp-jobs-dialog.c
index 7707b43c6..3fb0fb20c 100644
--- a/panels/printers/pp-jobs-dialog.c
+++ b/panels/printers/pp-jobs-dialog.c
@@ -47,7 +47,6 @@ static void pp_jobs_dialog_hide (PpJobsDialog *self);
 
 struct _PpJobsDialog {
   GtkBuilder *builder;
-  GtkWidget  *parent;
 
   GtkWidget  *dialog;
   GListStore *store;
@@ -549,8 +548,7 @@ key_press_event_cb (GtkWidget   *widget,
 }
 
 PpJobsDialog *
-pp_jobs_dialog_new (GtkWindow            *parent,
-                    UserResponseCallback  user_callback,
+pp_jobs_dialog_new (UserResponseCallback  user_callback,
                     gpointer              user_data,
                     gchar                *printer_name)
 {
@@ -565,7 +563,6 @@ pp_jobs_dialog_new (GtkWindow            *parent,
   self = g_new0 (PpJobsDialog, 1);
 
   self->builder = gtk_builder_new ();
-  self->parent = GTK_WIDGET (parent);
 
   builder_result = gtk_builder_add_objects_from_resource (self->builder,
                                                           
"/org/gnome/control-center/printers/jobs-dialog.ui",
@@ -626,7 +623,6 @@ pp_jobs_dialog_new (GtkWindow            *parent,
 
   update_jobs_list (self);
 
-  gtk_window_set_transient_for (GTK_WINDOW (self->dialog), GTK_WINDOW (parent));
   gtk_window_present (GTK_WINDOW (self->dialog));
   gtk_widget_show_all (GTK_WIDGET (self->dialog));
 
diff --git a/panels/printers/pp-jobs-dialog.h b/panels/printers/pp-jobs-dialog.h
index 23c38b907..a1563caf0 100644
--- a/panels/printers/pp-jobs-dialog.h
+++ b/panels/printers/pp-jobs-dialog.h
@@ -27,8 +27,7 @@ G_BEGIN_DECLS
 
 typedef struct _PpJobsDialog PpJobsDialog;
 
-PpJobsDialog *pp_jobs_dialog_new               (GtkWindow            *parent,
-                                                UserResponseCallback  user_callback,
+PpJobsDialog *pp_jobs_dialog_new               (UserResponseCallback  user_callback,
                                                 gpointer              user_data,
                                                 gchar                *printer_name);
 void          pp_jobs_dialog_update            (PpJobsDialog         *dialog);
diff --git a/panels/printers/pp-printer-entry.c b/panels/printers/pp-printer-entry.c
index 7fcc33f06..26cf24a8a 100644
--- a/panels/printers/pp-printer-entry.c
+++ b/panels/printers/pp-printer-entry.c
@@ -657,10 +657,10 @@ pp_printer_entry_show_jobs_dialog (PpPrinterEntry *self)
   if (self->pp_jobs_dialog == NULL)
     {
       self->pp_jobs_dialog = pp_jobs_dialog_new (
-        GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
         jobs_dialog_response_cb,
         self,
         self->printer_name);
+      gtk_window_set_transient_for (GTK_WINDOW (self->pp_jobs_dialog), GTK_WINDOW (gtk_widget_get_toplevel 
(GTK_WIDGET (self))));
     }
 }
 


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