[passepartout] properly set the transient-for window for the preferences



commit ba093ba19382ecbeccceac3f8bb7bfaae9c28487
Author: Sven Herzberg <herzi lanedo com>
Date:   Mon Apr 27 17:11:52 2009 +0200

    properly set the transient-for window for the preferences
    
    * src/pptout/config.cc,
    * src/pptout/config.h: added a "toplevel" parameter to show_dialog()
    * src/pptout/window.cc,
    * src/pptout/window.h: added a signal handler to open the dialog (so we can
      properly pass ourselves as the toplevel window for the dialog)
    * src/pptout/windowmenus.cc: use the new signal handler instead of opening
      the dialog directly
---
 src/pptout/config.cc      |    7 +++++--
 src/pptout/config.h       |    2 +-
 src/pptout/window.cc      |    6 ++++++
 src/pptout/window.h       |    1 +
 src/pptout/windowmenus.cc |    2 +-
 5 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/pptout/config.cc b/src/pptout/config.cc
index f28515a..7a144ca 100644
--- a/src/pptout/config.cc
+++ b/src/pptout/config.cc
@@ -136,10 +136,13 @@ Gtk::Dialog &PFile::get_dialog() {
   return *dialog;
 }
 
-void PFile::dialog_show() {
+void PFile::dialog_show (Gtk::Window* const toplevel) {
   get_dialog(); // create it if necessary
   if(dialog)
-    dialog->show_all();
+    {
+      dialog->set_transient_for (*toplevel);
+      dialog->show_all();
+    }
 }
 
 
diff --git a/src/pptout/config.h b/src/pptout/config.h
index fe9672d..bae438f 100644
--- a/src/pptout/config.h
+++ b/src/pptout/config.h
@@ -49,7 +49,7 @@ public:
   PFile();
   ~PFile();
   Gtk::Dialog &get_dialog();
-  void dialog_show();
+  void dialog_show(Gtk::Window* const toplevel);
 
   /// Read the config file.
   /** main() calls this after the cerr aliases are set. */
diff --git a/src/pptout/window.cc b/src/pptout/window.cc
index 7e4d7ef..8e55283 100644
--- a/src/pptout/window.cc
+++ b/src/pptout/window.cc
@@ -312,6 +312,12 @@ void FrameWindow::save() {
     save_dialog->show();
 }
 
+void
+FrameWindow::show_preferences ()
+{
+  config.dialog_show (this);
+}
+
 bool FrameWindow::on_delete_event(GdkEventAny *event) {
   close();
   return true;
diff --git a/src/pptout/window.h b/src/pptout/window.h
index 250976a..036e27a 100644
--- a/src/pptout/window.h
+++ b/src/pptout/window.h
@@ -67,6 +67,7 @@ private:
   void create_menus();
   void open_dialog_done();
   void save_dialog_done();
+  void show_preferences ();
   void import_dialog_done();
   void save();
   void close();
diff --git a/src/pptout/windowmenus.cc b/src/pptout/windowmenus.cc
index 36d9bb3..efc702f 100644
--- a/src/pptout/windowmenus.cc
+++ b/src/pptout/windowmenus.cc
@@ -274,7 +274,7 @@ void FrameWindow::create_menus() {
                   mem_fun(*import_dialog, &Filesel::show_all));
   
   main_group->add(Action::create("EditPrefs", Stock::PREFERENCES),
-                  mem_fun(config, &PFile::dialog_show));
+                  mem_fun (*this, &FrameWindow::show_preferences));
   
   
   // *** page menu ***



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