[PATCH 3/3] Make all dialogs transient on top of the workbench root window



Hello,

While using Nemiver on Fedora Rawhide, linked against the latest
versions of the GNOME libraries (e.g, gtk3-3.13), it appeared that the
dialogs of the application where not setup as being transient over the
root window of the workbench, as they should be.  I thus went over the
code and required all the dialogs (well, most of them) to be made
transient over the root window of the workbench.

Tested and applying to master.

        * src/uicommon/nmv-dialog.h (Dialog::Dialog): Add a parent window
        parameter.
        * src/uicommon/nmv-dialog.cc (Dialog::Dialog): Add a parent window
        parameter.  Add apidoc comments.
        * src/common/nmv-asm-utils.h (class Gtk::Window): Forward declare
        this here.
        (ReadLine::ReadLine): Take a Gtk::Window& as the parent window for
        the dialogs it might use.
        * src/uicommon/nmv-ui-utils.h (ask_user_to_select_file)
        (find_file_or_ask_user, find_file_and_read_line, display_info)
        (display_error, display_warning, ask_yes_no_question)
        (ask_yes_no_cancel_question): Add a parent window parameter.
        (display_error_not_transient): New function for cases where we
        cannot really pass a parent window to the dialog yet.
        (NEMIVER_CATCH, NEMIVER_CATCH_AND_RETURN): Use
        display_error_not_transient because this is used in contexts where
        we cannot yet get the parent window.  We could, but that'll
        involve even more changes.  So let's do this for now.
        * src/uicommon/nmv-ui-utils.cc (ask_user_to_select_file)
        (find_file_or_ask_user, find_file_and_read_line): Add a parent
        window parameter.  Add apidoc comments.  Adjust.
        (DontShowAgainMsgDialog::DontShowAgainMsgDialog): Likewise.
        Adjust call to Gtk::MessageDialog constructor.
        * src/persp/dbgperspective/nmv-call-function-dialog.h
        (CallFunctionDialog::CallFunctionDialog): Likewise.
        * src/persp/dbgperspective/nmv-call-function-dialog.cc
        (CallFunctionDialog::CallFunctionDialog): Likewise.  Add comment.
        * src/persp/dbgperspective/nmv-choose-overloads-dialog.h
        (ChooseOverloadsDialog::ChooseOverloadsDialog): Likewise.
        * src/persp/dbgperspective/nmv-choose-overloads-dialog.cc
        (ChooseOverloadsDialog::ChooseOverloadsDialog): Likewise.  Add
        comment.
        * src/persp/dbgperspective/nmv-expr-inspector-dialog.h
        (ExprInspectorDialog::ExprInspectorDialog): Add a new parent
        window parameter.
        * src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
        (ExprInspectorDialog::ExprInspectorDialog): Add a new parent
        window parameter.
        * src/persp/dbgperspective/nmv-expr-monitor.cc
        (ExprMonitor::Priv::on_add_expression_action): Adjust call to
        ExprInspectorDialog constructor.
        * src/persp/dbgperspective/nmv-find-text-dialog.h
        (FindTextDialog::FindTextDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-find-text-dialog.cc
        (FindTextDialog::FindTextDialog): Add a parent window parameter.
        Add apidoc comments.
        * src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
        (GlobalVarsInspectorDialog::GlobalVarsInspectorDialog): Add a
        parent window parameter.  Add apidoc comments.
        (GlobalVarsInspectorDialog::Priv::show_variable_type_in_dialog):
        Adjust call to ui_utils::display_info.
        * src/persp/dbgperspective/nmv-load-core-dialog.h
        (LoadCoreDialog::LoadCoreDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-load-core-dialog.cc
        (LoadCoreDialog::LoadCoreDialog): Add a parent window parameter.
        Add apidoc comments.
        * src/persp/dbgperspective/nmv-open-file-dialog.h
        (OpenFileDialog::OpenFileDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-open-file-dialog.cc
        (OpenFileDialog::OpenFileDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-preferences-dialog.h
        (PreferencesDialog::PreferencesDialog): Add a parent window
        parameter.
        * src/persp/dbgperspective/nmv-preferences-dialog.cc
        (PreferencesDialog::PreferencesDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-proc-list-dialog.h
        (ProcListDialog::ProcListDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-proc-list-dialog.cc
        (ProcListDialog::ProcListDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-remote-target-dialog.h
        (RemoteTargetDialog::RemoteTargetDialog): Add a parent window
        parameter.
        * src/persp/dbgperspective/nmv-remote-target-dialog.cc
        (RemoteTargetDialog::RemoteTargetDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-run-program-dialog.h
        (RunProgramDialog::RunProgramDialog): Add a parent window
        parameter.
        * src/persp/dbgperspective/nmv-run-program-dialog.cc
        (RunProgramDialog::RunProgramDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-saved-sessions-dialog.h
        (SavedSessionsDialog::SavedSessionsDialog): Add a parent window
        parameter.
        * src/persp/dbgperspective/nmv-saved-sessions-dialog.cc
        (SavedSessionsDialog::SavedSessionsDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-set-breakpoint-dialog.h
        (SetBreakpointDialog::SetBreakpointDialog): Add a parent window
        parameter.
        * src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
        (SetBreakpointDialog::SetBreakpointDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-set-jump-to-dialog.h
        (SetJumpToDialog::SetJumpToDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
        (SetJumpToDialog::SetJumpToDialog): Add a parent window
        parameter. Add apidoc comments.
        * src/persp/dbgperspective/nmv-watchpoint-dialog.h
        (WatchpointDialog::WatchpointDialog): Add a parent window parameter.
        * src/persp/dbgperspective/nmv-watchpoint-dialog.cc
        (WatchpointDialog::WatchpointDialog): Add a parent window
        parameter.  Add apidoc comments.
        * src/uicommon/nmv-locate-file-dialog.h
        (LocateFileDialog::LocateFileDialog): Add a parent window parameter.
        * src/uicommon/nmv-locate-file-dialog.cc
        (LocateFileDialog::LocateFileDialog): Add a parent window
        parameter. Add apidoc comments.
        Misc style fixes.
        * src/uicommon/nmv-source-editor.h (SourceEditor::{SourceEditor,
        add_asm, load_asm, load_file}): Add a parent window parameter.
        * src/uicommon/nmv-source-editor.cc (SourceEditor::Priv::Priv):
        Add a parent window parameter.
        (SourceEditor::SourceEditor): Remove the unused default
        constructor.  Add a parent window parameter to the other
        constructors and add apidoc comments there.
        (SourceEditor::{add_asm, load_asm, load_file): Add a parent window
        parameter.  Adjust.
        (SourceEditor::load_file): Likewise.  Adjust call to
        ui_utils::display_error.
        * src/persp/dbgperspective/nmv-local-vars-inspector.cc
        (LocalVarsInspector::Priv::show_variable_type_in_dialog): Adjust
        call to ui_utils::display_info.
        * src/uicommon/nmv-terminal.cc (on_button_press_signal): Misc
        style fixes.
        * src/persp/dbgperspective/nmv-dbg-perspective.cc
        (DBGPerspective::Priv::find_file_or_ask_user): Adjust call to
        ui_utils::find_file_or_ask_user.
        (DBGPerspective::Priv::load_file): Adjust call to
        SourceEditor::load_file.
        (DBGPerspective::{on_find_text_response_signal,
        on_debugger_connected_to_remote_target_signal,
        on_program_finished_signal, on_engine_died_signal,
        on_signal_received_by_target_signal, on_debugger_error_signal,
        on_file_content_changed, restart_inferior, execute_program,
        attach_to_program, connect_to_remote_target, stop, set_breakpoint,
        agree_to_shutdown}): Adjust call to ui_utils::{display_info,
        display_warning, display_error}.
        (DBGPerspective::on_jump_to_location_action): Adjust call to
        constructor for SetJumpToDialog.
        (DBGPerspective::get_find_text_dialog): Adjust call to constructor
        for FindTextDialog.
        (DBGPerspective::create_source_editor): Adjust call to constructor
        for SourceEditor and OpenFileDialog.
        (DBGPerspective::load_asm ): Adjust.
        (DBGPerspective::execute_session): Adjust call to
        SourceEditor::load_asm.
        (DBGPerspective::execute_program): Adjust call to
        RunProgramDialog and ProcListDialog.
        (DBGPerspective::choose_a_saved_session): Adjust call to
        SavedSessionsDialog.
        (DBGPerspective::edit_preferences): Adjust call to
        PreferencesDialog.
        (DBGPerspective::load_core_file): Adjust call to LoadCoreDialog.
        (DBGPerspective::ask_user_to_select_file): Adjust call to
        ui_utils::ask_user_to_select_file.
        (DBGPerspective::choose_function_overload): Adjust call to
        ChooseOverloadsDialog.
        (DBGPerspective::set_breakpoint_using_dialog): Adjust call to
        SetBreakpointDialog.
        (DBGPerspective::set_watchpoint_using_dialog): Adjust call to
        WatchpointDialog.
        (DBGPerspective::inspect_expression): Adjust call to
        ExprInspectorDialog.
        (DBGPerspective::call_function): Adjust call to CallFunctionDialog
        constructor.

Signed-off-by: Dodji Seketeli <dodji seketeli org>
---
 src/common/nmv-asm-utils.h                         |  41 +++++--
 .../dbgperspective/nmv-call-function-dialog.cc     |  12 +-
 .../dbgperspective/nmv-call-function-dialog.h      |   3 +-
 .../dbgperspective/nmv-choose-overloads-dialog.cc  |  14 ++-
 .../dbgperspective/nmv-choose-overloads-dialog.h   |   5 +-
 src/persp/dbgperspective/nmv-dbg-perspective.cc    | 126 ++++++++++++++-------
 .../dbgperspective/nmv-expr-inspector-dialog.cc    |  16 ++-
 .../dbgperspective/nmv-expr-inspector-dialog.h     |   7 +-
 src/persp/dbgperspective/nmv-expr-inspector.cc     |   3 +-
 src/persp/dbgperspective/nmv-expr-monitor.cc       |   5 +-
 src/persp/dbgperspective/nmv-find-text-dialog.cc   |  12 +-
 src/persp/dbgperspective/nmv-find-text-dialog.h    |   3 +-
 .../nmv-global-vars-inspector-dialog.cc            |  22 +++-
 src/persp/dbgperspective/nmv-load-core-dialog.cc   |   6 +-
 src/persp/dbgperspective/nmv-load-core-dialog.h    |   3 +-
 .../dbgperspective/nmv-local-vars-inspector.cc     |   3 +-
 src/persp/dbgperspective/nmv-open-file-dialog.cc   |  17 ++-
 src/persp/dbgperspective/nmv-open-file-dialog.h    |   3 +-
 src/persp/dbgperspective/nmv-preferences-dialog.cc |  16 ++-
 src/persp/dbgperspective/nmv-preferences-dialog.h  |   3 +-
 src/persp/dbgperspective/nmv-proc-list-dialog.cc   |  14 ++-
 src/persp/dbgperspective/nmv-proc-list-dialog.h    |   3 +-
 .../dbgperspective/nmv-remote-target-dialog.cc     |  12 +-
 .../dbgperspective/nmv-remote-target-dialog.h      |   3 +-
 src/persp/dbgperspective/nmv-run-program-dialog.cc |  12 +-
 src/persp/dbgperspective/nmv-run-program-dialog.h  |   3 +-
 .../dbgperspective/nmv-saved-sessions-dialog.cc    |  14 ++-
 .../dbgperspective/nmv-saved-sessions-dialog.h     |   3 +-
 .../dbgperspective/nmv-set-breakpoint-dialog.cc    |  13 ++-
 .../dbgperspective/nmv-set-breakpoint-dialog.h     |   3 +-
 src/persp/dbgperspective/nmv-set-jump-to-dialog.cc |  12 +-
 src/persp/dbgperspective/nmv-set-jump-to-dialog.h  |   3 +-
 src/persp/dbgperspective/nmv-watchpoint-dialog.cc  |  16 ++-
 src/persp/dbgperspective/nmv-watchpoint-dialog.h   |   3 +-
 src/uicommon/nmv-dialog.cc                         |  15 ++-
 src/uicommon/nmv-dialog.h                          |   3 +-
 src/uicommon/nmv-locate-file-dialog.cc             |  24 +++-
 src/uicommon/nmv-locate-file-dialog.h              |   3 +-
 src/uicommon/nmv-source-editor.cc                  | 124 ++++++++++++++++----
 src/uicommon/nmv-source-editor.h                   |  12 +-
 src/uicommon/nmv-terminal.cc                       |   4 +-
 src/uicommon/nmv-ui-utils.cc                       | 113 ++++++++++++++----
 src/uicommon/nmv-ui-utils.h                        |  41 ++++---
 43 files changed, 595 insertions(+), 178 deletions(-)

diff --git a/src/common/nmv-asm-utils.h b/src/common/nmv-asm-utils.h
index 885aab2..70d0047 100644
--- a/src/common/nmv-asm-utils.h
+++ b/src/common/nmv-asm-utils.h
@@ -27,6 +27,10 @@
 
 #include "nmv-asm-instr.h"
 
+namespace Gtk {
+  class Window;
+}
+
 using nemiver::common::UString;
 
 NEMIVER_BEGIN_NAMESPACE (nemiver)
@@ -114,20 +118,41 @@ class ReadLine
     ReadLine (const ReadLine &);
 
  protected:
+    Gtk::Window &m_parent;
     const std::list<UString> &m_where_to_look;
     list<UString> &m_session_dirs;
     map<UString, bool> &m_ignore_paths;
     FindFileAndReadLine read_line;
 
  public:
-    ReadLine (const std::list<UString> &where_to_look,
+
+    /// Constructor for the ReadLine functor.
+    ///
+    /// \param a_parent the parent window used by the dialog used by
+    /// the functor to interact with the user, should the need arise.
+    ///
+    /// \param where_to_look a list of directories where to look for
+    /// the file the function call operators of the functor might be
+    /// interested in.
+    ///
+    /// \param session_dirs if the file is found in a directory D,
+    /// that D is put in this list.
+    ///
+    /// \param ignore_path if the file is not found but is part of
+    /// this map, do not ask the user for help in finding it.
+    ///
+    /// \param read_line_func the function to use to do the actual job
+    /// of finding the file.
+    ReadLine (Gtk::Window& a_parent,
+             const std::list<UString> &where_to_look,
              list<UString> &session_dirs,
              map<UString, bool> &ignore_paths,
               FindFileAndReadLine read_line_func) :
-    m_where_to_look (where_to_look),
-      m_session_dirs (session_dirs),
-      m_ignore_paths (ignore_paths),
-      read_line (read_line_func)
+    m_parent(a_parent),
+        m_where_to_look (where_to_look),
+        m_session_dirs (session_dirs),
+        m_ignore_paths (ignore_paths),
+        read_line (read_line_func)
     {
     }
 
@@ -145,8 +170,10 @@ class ReadLine
                       int a_line_number,
                       std::string &a_line)
     {
-        return read_line (a_file_path, m_where_to_look, m_session_dirs,
-                          m_ignore_paths, a_line_number, a_line);
+        return read_line (m_parent, a_file_path,
+                          m_where_to_look, m_session_dirs,
+                          m_ignore_paths, a_line_number,
+                          a_line);
     }
 };
 
diff --git a/src/persp/dbgperspective/nmv-call-function-dialog.cc 
b/src/persp/dbgperspective/nmv-call-function-dialog.cc
index b7c8cd5..0f7bfb6 100644
--- a/src/persp/dbgperspective/nmv-call-function-dialog.cc
+++ b/src/persp/dbgperspective/nmv-call-function-dialog.cc
@@ -196,8 +196,16 @@ struct CallFunctionDialog::Priv {
     }
 };//end struct CallFunctionDialog::Priv
 
-CallFunctionDialog::CallFunctionDialog (const UString &a_root_path):
-    Dialog (a_root_path, "callfunctiondialog.ui", "callfunctiondialog")
+/// Constructor of the CallFunctionDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+CallFunctionDialog::CallFunctionDialog (Gtk::Window &a_parent,
+                                        const UString &a_root_path):
+    Dialog (a_root_path, "callfunctiondialog.ui",
+            "callfunctiondialog", a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
 }
diff --git a/src/persp/dbgperspective/nmv-call-function-dialog.h 
b/src/persp/dbgperspective/nmv-call-function-dialog.h
index 952d317..4403412 100644
--- a/src/persp/dbgperspective/nmv-call-function-dialog.h
+++ b/src/persp/dbgperspective/nmv-call-function-dialog.h
@@ -41,7 +41,8 @@ class CallFunctionDialog : public Dialog {
 
 public:
 
-    CallFunctionDialog (const UString &a_resource_root_path);
+    CallFunctionDialog (Gtk::Window &a_parent,
+                        const UString &a_resource_root_path);
     virtual ~CallFunctionDialog ();
 
     UString call_expression () const;
diff --git a/src/persp/dbgperspective/nmv-choose-overloads-dialog.cc 
b/src/persp/dbgperspective/nmv-choose-overloads-dialog.cc
index 7c9a97b..faa0752 100644
--- a/src/persp/dbgperspective/nmv-choose-overloads-dialog.cc
+++ b/src/persp/dbgperspective/nmv-choose-overloads-dialog.cc
@@ -163,12 +163,20 @@ struct ChooseOverloadsDialog::Priv {
 
 };//end ChooseOverloadsDialog
 
+/// Constructor of the ChooseOverloadsDialog type.
+///
+/// \param a_parent the parent window of the dialog.x
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
 ChooseOverloadsDialog::ChooseOverloadsDialog
-                (const UString &a_root_path,
-                 const vector<IDebugger::OverloadsChoiceEntry> &a_entries ) :
+(Gtk::Window &a_parent,
+ const UString &a_root_path,
+ const vector<IDebugger::OverloadsChoiceEntry> &a_entries) :
     Dialog (a_root_path,
             "chooseoverloadsdialog.ui",
-            "chooseoverloadsdialog")
+            "chooseoverloadsdialog",
+            a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
     THROW_IF_FAIL (m_priv);
diff --git a/src/persp/dbgperspective/nmv-choose-overloads-dialog.h 
b/src/persp/dbgperspective/nmv-choose-overloads-dialog.h
index 77988b3..a0c0c45 100644
--- a/src/persp/dbgperspective/nmv-choose-overloads-dialog.h
+++ b/src/persp/dbgperspective/nmv-choose-overloads-dialog.h
@@ -37,8 +37,9 @@ class ChooseOverloadsDialog : public Dialog {
 
 public:
     ChooseOverloadsDialog
-                (const UString &a_res_root_path,
-                 const vector<IDebugger::OverloadsChoiceEntry> &a_entries);
+      (Gtk::Window &a_parent,
+       const UString &a_res_root_path,
+       const vector<IDebugger::OverloadsChoiceEntry> &a_entries);
     virtual ~ChooseOverloadsDialog ();
 
     void set_overloads_choice_entries
diff --git a/src/persp/dbgperspective/nmv-dbg-perspective.cc b/src/persp/dbgperspective/nmv-dbg-perspective.cc
index dfff86b..be652db 100644
--- a/src/persp/dbgperspective/nmv-dbg-perspective.cc
+++ b/src/persp/dbgperspective/nmv-dbg-perspective.cc
@@ -1094,7 +1094,8 @@ struct DBGPerspective::Priv {
     {
         list<string> supported_encodings;
         get_supported_encodings (supported_encodings);
-        return SourceEditor::load_file (a_path, supported_encodings,
+        return SourceEditor::load_file (workbench->get_root_window (),
+                                        a_path, supported_encodings,
                                         enable_syntax_highlight,
                                         a_buffer);
     }
@@ -1154,7 +1155,8 @@ struct DBGPerspective::Priv {
     {
         list<UString> where_to_look;
         build_find_file_search_path (where_to_look);
-        return ui_utils::find_file_or_ask_user (a_file_path,
+        return ui_utils::find_file_or_ask_user (workbench->get_root_window (),
+                                                a_file_path,
                                                 where_to_look,
                                                 session_search_paths,
                                                 paths_to_ignore,
@@ -1471,7 +1473,8 @@ DBGPerspective::on_continue_until_action ()
 void
 DBGPerspective::on_jump_to_location_action ()
 {
-    SetJumpToDialog dialog (plugin_path ());
+    SetJumpToDialog dialog (workbench ().get_root_window (),
+                            plugin_path ());
 
     SourceEditor *editor = get_current_source_editor ();
 
@@ -1716,7 +1719,8 @@ DBGPerspective::on_find_text_response_signal (int a_response)
                             search_str.c_str ());
             find_text_dialog.clear_selection_before_search (false);
         }
-        ui_utils::display_info (message);
+        ui_utils::display_info (workbench ().get_root_window (),
+                                message);
     } else {
         find_text_dialog.clear_selection_before_search (false);
     }
@@ -2288,7 +2292,8 @@ DBGPerspective::on_debugger_connected_to_remote_target_signal ()
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     NEMIVER_TRY
 
-    ui_utils::display_info (_("Connected to remote target!"));
+        ui_utils::display_info (workbench ().get_root_window (),
+                                _("Connected to remote target!"));
     debugger ()->list_breakpoints ();
 
     NEMIVER_CATCH
@@ -2489,7 +2494,8 @@ DBGPerspective::on_program_finished_signal ()
 
     unset_where ();
 
-    display_info (_("Program exited"));
+    display_info (workbench ().get_root_window (),
+                  _("Program exited"));
     workbench ().set_title_extension ("");
 
     //****************************
@@ -2518,7 +2524,8 @@ DBGPerspective::on_engine_died_signal ()
     m_priv->debugger_busy_action_group->set_sensitive (false);
     m_priv->inferior_loaded_action_group->set_sensitive (false);
 
-    ui_utils::display_info (_("The underlying debugger engine process died."));
+    ui_utils::display_info (workbench ().get_root_window (),
+                            _("The underlying debugger engine process died."));
 
     NEMIVER_CATCH
 
@@ -2624,7 +2631,8 @@ DBGPerspective::on_signal_received_by_target_signal (const UString &a_signal,
     // translators: first %s is the signal name, second one is the reason
     message.printf (_("Target received a signal: %s, %s"),
             a_signal.c_str (), a_meaning.c_str ());
-    ui_utils::display_info (message);
+    ui_utils::display_info (workbench ().get_root_window (),
+                            message);
 
     NEMIVER_CATCH
 }
@@ -2638,7 +2646,8 @@ DBGPerspective::on_debugger_error_signal (const UString &a_msg)
     if (m_priv->show_dbg_errors) {
         UString message;
         message.printf (_("An error occurred: %s"), a_msg.c_str ());
-        ui_utils::display_error (message);
+        ui_utils::display_error (workbench ().get_root_window (),
+                                 message);
     }
 
     NEMIVER_CATCH
@@ -2806,7 +2815,8 @@ DBGPerspective::on_file_content_changed (const UString &a_path)
             bool dont_ask_again = !m_priv->confirm_before_reload_source;
             bool need_to_reload_file = m_priv->allow_auto_reload_source;
             if (!dont_ask_again) {
-                if (ask_yes_no_question (msg,
+                if (ask_yes_no_question (workbench ().get_root_window (),
+                                         msg,
                                          true /*propose to not ask again*/,
                                          dont_ask_again)
                         == Gtk::RESPONSE_YES) {
@@ -5083,7 +5093,9 @@ DBGPerspective::get_find_text_dialog ()
 {
     THROW_IF_FAIL (m_priv);
     if (!m_priv->find_text_dialog) {
-        m_priv->find_text_dialog.reset (new FindTextDialog (plugin_path ()));
+        m_priv->find_text_dialog.reset
+            (new FindTextDialog (workbench ().get_root_window (),
+                                 plugin_path ()));
         m_priv->find_text_dialog->signal_response ().connect
             (sigc::mem_fun (*this,
                             &DBGPerspective::on_find_text_response_signal));
@@ -5365,9 +5377,11 @@ DBGPerspective::create_source_editor (Glib::RefPtr<Gsv::Buffer> &a_source_buf,
     int current_line =  -1;
 
     if (a_asm_view) {
-        source_editor = Gtk::manage (new SourceEditor (plugin_path (),
-                                                       a_source_buf,
-                                                       true));
+        source_editor =
+            Gtk::manage (new SourceEditor (workbench ().get_root_window (),
+                                           plugin_path (),
+                                           a_source_buf,
+                                           true));
         if (!a_current_address.empty ()) {
             source_editor->assembly_buf_addr_to_line
                                 (Address (a_current_address.raw ()),
@@ -5375,9 +5389,11 @@ DBGPerspective::create_source_editor (Glib::RefPtr<Gsv::Buffer> &a_source_buf,
                                  current_line);
         }
     } else {
-        source_editor = Gtk::manage (new SourceEditor (plugin_path (),
-                                                       a_source_buf,
-                                                       false));
+        source_editor =
+            Gtk::manage (new SourceEditor (workbench ().get_root_window (),
+                                           plugin_path (),
+                                           a_source_buf,
+                                           false));
         source_editor->source_view ().set_show_line_numbers
                                                 (m_priv->show_line_numbers);
         current_line = a_current_line;
@@ -5430,7 +5446,8 @@ DBGPerspective::create_source_editor (Glib::RefPtr<Gsv::Buffer> &a_source_buf,
 void
 DBGPerspective::open_file ()
 {
-    OpenFileDialog dialog (plugin_path (),
+    OpenFileDialog dialog (workbench ().get_root_window (),
+                           plugin_path (),
                            debugger (),
                            get_current_file_path ());
 
@@ -5567,7 +5584,8 @@ DBGPerspective::load_asm (const common::DisassembleInfo &a_info,
 {
     list<UString> where_to_look_for_src;
     m_priv->build_find_file_search_path (where_to_look_for_src);
-    return SourceEditor::load_asm (a_info, a_asm, /*a_append=*/true,
+    return SourceEditor::load_asm (workbench ().get_root_window (),
+                                   a_info, a_asm, /*a_append=*/true,
                                    where_to_look_for_src,
                                    m_priv->session_search_paths,
                                    m_priv->paths_to_ignore,
@@ -5954,7 +5972,8 @@ DBGPerspective::execute_session (ISessMgr::Session &a_session)
 void
 DBGPerspective::execute_program ()
 {
-    RunProgramDialog dialog (plugin_path ());
+    RunProgramDialog dialog (workbench ().get_root_window (),
+                             plugin_path ());
 
     // set defaults from session
     if (debugger ()->get_target_path () != "") {
@@ -6006,7 +6025,8 @@ DBGPerspective::restart_inferior ()
     } else {
         // We cannot restart an inferior running on a remote target at
         // the moment.
-        ui_utils::display_error (_("Sorry, it's impossible to restart "
+        ui_utils::display_error (workbench ().get_root_window (),
+                                 _("Sorry, it's impossible to restart "
                                    "a remote inferior"));
     }
 }
@@ -6152,7 +6172,8 @@ DBGPerspective::execute_program
             || !env::build_path_to_executable (prog, prog)) {
             UString msg;
             msg.printf (_("Could not find file %s"), prog.c_str ());
-            ui_utils::display_error (msg);
+            ui_utils::display_error (workbench ().get_root_window (),
+                                     msg);
             return;
         }
     }
@@ -6216,7 +6237,8 @@ DBGPerspective::execute_program
         UString message;
         message.printf (_("Could not load program: %s"),
                         prog.c_str ());
-        display_error (message);
+        display_error (workbench ().get_root_window (),
+                       message);
         return;
     }
 
@@ -6308,7 +6330,8 @@ DBGPerspective::attach_to_program ()
 
     IProcMgr *process_manager = get_process_manager ();
     THROW_IF_FAIL (process_manager);
-    ProcListDialog dialog (plugin_path (),
+    ProcListDialog dialog (workbench ().get_root_window (),
+                           plugin_path (),
                            *process_manager);
     int result = dialog.run ();
     if (result != Gtk::RESPONSE_OK) {
@@ -6330,7 +6353,8 @@ DBGPerspective::attach_to_program (unsigned int a_pid,
     LOG_DD ("a_pid: " << (int) a_pid);
 
     if (a_pid == (unsigned int) getpid ()) {
-        ui_utils::display_warning (_("You cannot attach to Nemiver itself"));
+        ui_utils::display_warning (workbench ().get_root_window (),
+                                   _("You cannot attach to Nemiver itself"));
         return;
     }
 
@@ -6343,7 +6367,8 @@ DBGPerspective::attach_to_program (unsigned int a_pid,
     if (!debugger ()->attach_to_target (a_pid,
                                         get_terminal_name ())) {
 
-        ui_utils::display_warning (_("You cannot attach to the "
+        ui_utils::display_warning (workbench ().get_root_window (),
+                                   _("You cannot attach to the "
                                      "underlying debugger engine"));
         return;
     }
@@ -6354,7 +6379,8 @@ DBGPerspective::connect_to_remote_target ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-    RemoteTargetDialog dialog (plugin_path ());
+    RemoteTargetDialog dialog (workbench ().get_root_window (),
+                               plugin_path ());
 
     // try to pre-fill the remote target dialog with the relevant info
     // if we have it.
@@ -6402,7 +6428,7 @@ DBGPerspective::connect_to_remote_target (const UString &a_server_address,
         UString message;
         message.printf (_("Could not load program: %s"),
                         a_prog_path.c_str ());
-        display_error (message);
+        display_error (workbench ().get_root_window (), message);
         return;
     }
     LOG_DD ("solib prefix path: '" <<  a_solib_prefix << "'");
@@ -6437,7 +6463,7 @@ DBGPerspective::connect_to_remote_target (const UString &a_serial_line,
         UString message;
         message.printf (_("Could not load program: %s"),
                         a_prog_path.c_str ());
-        display_error (message);
+        display_error (workbench ().get_root_window (), message);
         return;
     }
     LOG_DD ("solib prefix path: '" <<  a_solib_prefix << "'");
@@ -6543,7 +6569,8 @@ DBGPerspective::save_current_session ()
 void
 DBGPerspective::choose_a_saved_session ()
 {
-    SavedSessionsDialog dialog (plugin_path (), session_manager_ptr ());
+    SavedSessionsDialog dialog (workbench ().get_root_window (),
+                                plugin_path (), session_manager_ptr ());
     int result = dialog.run ();
     if (result != Gtk::RESPONSE_OK) {
         return;
@@ -6556,7 +6583,9 @@ void
 DBGPerspective::edit_preferences ()
 {
     THROW_IF_FAIL (m_priv);
-    PreferencesDialog dialog (*this, m_priv->layout_mgr, plugin_path ());
+    PreferencesDialog dialog (workbench ().get_root_window (),
+                              *this, m_priv->layout_mgr,
+                              plugin_path ());
     dialog.run ();
 }
 
@@ -6597,7 +6626,7 @@ void
 DBGPerspective::load_core_file ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
-    LoadCoreDialog dialog (plugin_path ());
+    LoadCoreDialog dialog (workbench ().get_root_window (), plugin_path ());
 
     int result = dialog.run ();
     if (result != Gtk::RESPONSE_OK) {
@@ -6634,7 +6663,8 @@ DBGPerspective::stop ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_D (NMV_DEFAULT_DOMAIN);
     if (!debugger ()->stop_target ()) {
-        ui_utils::display_error (_("Failed to stop the debugger"));
+        ui_utils::display_error (workbench ().get_root_window (),
+                                 _("Failed to stop the debugger"));
     }
 }
 
@@ -6879,7 +6909,7 @@ DBGPerspective::set_breakpoint (const UString &a_file_path,
             LOG_ERROR ("invalid line number: " << a_line);
             UString msg;
             msg.printf (_("Invalid line number: %i"), a_line);
-            display_warning (msg);
+            display_warning (workbench ().get_root_window (), msg);
         }
 }
 
@@ -7186,7 +7216,8 @@ bool
 DBGPerspective::ask_user_to_select_file (const UString &a_file_name,
                                          UString &a_selected_file_path)
 {
-    return ui_utils::ask_user_to_select_file (a_file_name, m_priv->prog_cwd,
+    return ui_utils::ask_user_to_select_file (workbench ().get_root_window (),
+                                              a_file_name, m_priv->prog_cwd,
                                               a_selected_file_path);
 }
 
@@ -7306,7 +7337,8 @@ DBGPerspective::choose_function_overload
         return;
     }
     THROW_IF_FAIL (debugger ());
-    ChooseOverloadsDialog dialog (plugin_path (), a_entries);
+    ChooseOverloadsDialog dialog (workbench ().get_root_window (),
+                                  plugin_path (), a_entries);
     int result = dialog.run ();
     if (result != Gtk::RESPONSE_OK) {
         debugger ()->choose_function_overload (0)/*cancel*/;
@@ -7792,7 +7824,8 @@ DBGPerspective::set_breakpoint_using_dialog ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-    SetBreakpointDialog dialog (plugin_path ());
+    SetBreakpointDialog dialog (workbench ().get_root_window (),
+                                plugin_path ());
 
     // Checkout if the user did select a function number.
     // If she did, pre-fill the breakpoint setting dialog with the
@@ -7838,7 +7871,8 @@ DBGPerspective::set_breakpoint_using_dialog (const UString &a_file_name,
     THROW_IF_FAIL (!a_file_name.empty ());
     THROW_IF_FAIL (a_line_num > 0);
 
-    SetBreakpointDialog dialog (plugin_path ());
+    SetBreakpointDialog dialog (workbench ().get_root_window (),
+                                plugin_path ());
     dialog.mode (SetBreakpointDialog::MODE_SOURCE_LOCATION);
     dialog.file_name (a_file_name);
     dialog.line_number (a_line_num);
@@ -7853,7 +7887,8 @@ void
 DBGPerspective::set_breakpoint_using_dialog (const UString &a_function_name)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
-    SetBreakpointDialog dialog (plugin_path ());
+    SetBreakpointDialog dialog (workbench ().get_root_window (),
+                                plugin_path ());
     dialog.mode (SetBreakpointDialog::MODE_FUNCTION_NAME);
     dialog.file_name (a_function_name);
     int result = dialog.run ();
@@ -7868,7 +7903,8 @@ DBGPerspective::set_watchpoint_using_dialog ()
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-    WatchpointDialog dialog (plugin_path (), *debugger (), *this);
+    WatchpointDialog dialog (workbench ().get_root_window (),
+                             plugin_path (), *debugger (), *this);
     int result = dialog.run ();
     if (result != Gtk::RESPONSE_OK) {
         return;
@@ -8123,7 +8159,8 @@ void
 DBGPerspective::inspect_expression (const UString &a_expression)
 {
     THROW_IF_FAIL (debugger ());
-    ExprInspectorDialog dialog (*debugger (),
+    ExprInspectorDialog dialog (workbench ().get_root_window (),
+                                *debugger (),
                                *this);
     dialog.set_history (m_priv->var_inspector_dialog_history);
     dialog.expr_monitoring_requested ().connect
@@ -8142,7 +8179,8 @@ DBGPerspective::call_function ()
 {
     THROW_IF_FAIL (m_priv);
 
-    CallFunctionDialog dialog (plugin_path ());
+    CallFunctionDialog dialog (workbench ().get_root_window (),
+                               plugin_path ());
 
     // Fill the dialog with the "function call" expression history.
     if (!m_priv->call_expr_history.empty ())
@@ -8512,8 +8550,8 @@ DBGPerspective::agree_to_shutdown ()
         UString message;
         message.printf (_("There is a program being currently debugged. "
                           "Do you really want to exit from the debugger?"));
-        if (nemiver::ui_utils::ask_yes_no_question (message) ==
-            Gtk::RESPONSE_YES) {
+        if (nemiver::ui_utils::ask_yes_no_question
+            (workbench ().get_root_window (), message) == Gtk::RESPONSE_YES) {
             return true;
         } else {
             return false;
diff --git a/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc 
b/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
index dde1c6f..81d37a7 100644
--- a/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
+++ b/src/persp/dbgperspective/nmv-expr-inspector-dialog.cc
@@ -386,11 +386,21 @@ public:
     //*************************
 };//end class ExprInspectorDialog::Priv
 
-ExprInspectorDialog::ExprInspectorDialog (IDebugger &a_debugger,
-                                        IPerspective &a_perspective) :
+/// The constructor of the ExprInspectorDilaog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_debugger the IDebugger interface to use to inspect the
+/// expression.
+///
+/// \param a_perspective the IPerspective interface to use.
+ExprInspectorDialog::ExprInspectorDialog (Gtk::Window &a_parent,
+                                          IDebugger &a_debugger,
+                                          IPerspective &a_perspective) :
     Dialog (a_perspective.plugin_path (),
             "exprinspectordialog.ui",
-            "exprinspectordialog")
+            "exprinspectordialog",
+            a_parent)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     m_priv.reset
diff --git a/src/persp/dbgperspective/nmv-expr-inspector-dialog.h 
b/src/persp/dbgperspective/nmv-expr-inspector-dialog.h
index 5aaae28..ad93112 100644
--- a/src/persp/dbgperspective/nmv-expr-inspector-dialog.h
+++ b/src/persp/dbgperspective/nmv-expr-inspector-dialog.h
@@ -64,14 +64,15 @@ public:
        | FUNCTIONALITY_EXPR_MONITOR_PICKER)
     };
 
-    ExprInspectorDialog (IDebugger &a_debugger,
-                        IPerspective &a_perspective);
+    ExprInspectorDialog (Gtk::Window &a_parent,
+                         IDebugger &a_debugger,
+                         IPerspective &a_perspective);
     virtual ~ExprInspectorDialog ();
 
     UString expression_name () const;
     void inspect_expression (const UString &a_expression_name);
     void inspect_expression (const UString &a_expression_name,
-                            const sigc::slot<void, 
+                            const sigc::slot<void,
                             const IDebugger::VariableSafePtr> &);
     const IDebugger::VariableSafePtr expression () const;
     ExprInspector& inspector () const;
diff --git a/src/persp/dbgperspective/nmv-expr-inspector.cc b/src/persp/dbgperspective/nmv-expr-inspector.cc
index 24ecc79..77bb197 100644
--- a/src/persp/dbgperspective/nmv-expr-inspector.cc
+++ b/src/persp/dbgperspective/nmv-expr-inspector.cc
@@ -239,7 +239,8 @@ class ExprInspector::Priv : public sigc::trackable {
         THROW_IF_FAIL (variable);
         // message += "\nDumped for debug: \n";
         // variable->to_string (message, false);
-        ui_utils::display_info (message);
+        ui_utils::display_info (perspective.get_workbench ().get_root_window (),
+                                message);
     }
 
     /// Creates a variable (or more generally, an expression).
diff --git a/src/persp/dbgperspective/nmv-expr-monitor.cc b/src/persp/dbgperspective/nmv-expr-monitor.cc
index 6b09a44..651fc4b 100644
--- a/src/persp/dbgperspective/nmv-expr-monitor.cc
+++ b/src/persp/dbgperspective/nmv-expr-monitor.cc
@@ -1158,7 +1158,10 @@ struct ExprMonitor::Priv
     {
         LOG_FUNCTION_SCOPE_NORMAL_DD;
 
-        ExprInspectorDialog dialog (debugger, perspective);
+        ExprInspectorDialog dialog
+            (perspective.get_workbench ().get_root_window(),
+             debugger, perspective);
+
         dialog.expr_monitoring_requested ().connect
             (sigc::mem_fun (*this,
                             &ExprMonitor::Priv::on_expr_monitoring_requested));
diff --git a/src/persp/dbgperspective/nmv-find-text-dialog.cc 
b/src/persp/dbgperspective/nmv-find-text-dialog.cc
index 71575ce..94d00e1 100644
--- a/src/persp/dbgperspective/nmv-find-text-dialog.cc
+++ b/src/persp/dbgperspective/nmv-find-text-dialog.cc
@@ -199,8 +199,16 @@ public:
 
 };//end FindTextDialog
 
-FindTextDialog::FindTextDialog (const UString &a_root_path) :
-    Dialog (a_root_path, "findtextdialog.ui", "findtextdialog")
+/// Constructor of the FindTextDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+FindTextDialog::FindTextDialog (Gtk::Window &a_parent,
+                                const UString &a_root_path) :
+    Dialog (a_root_path, "findtextdialog.ui",
+            "findtextdialog", a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
     THROW_IF_FAIL (m_priv);
diff --git a/src/persp/dbgperspective/nmv-find-text-dialog.h b/src/persp/dbgperspective/nmv-find-text-dialog.h
index 63fd1ea..4d3d787 100644
--- a/src/persp/dbgperspective/nmv-find-text-dialog.h
+++ b/src/persp/dbgperspective/nmv-find-text-dialog.h
@@ -41,7 +41,8 @@ class FindTextDialog : public Dialog {
 
 public:
 
-    FindTextDialog (const UString &a_resource_root_path);
+    FindTextDialog (Gtk::Window &a_parent,
+                    const UString &a_resource_root_path);
     virtual ~FindTextDialog ();
 
     Gtk::TextIter& get_search_match_start () const;
diff --git a/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc 
b/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
index 4f7a7e2..ecd5455 100644
--- a/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
+++ b/src/persp/dbgperspective/nmv-global-vars-inspector-dialog.cc
@@ -305,17 +305,31 @@ public:
         THROW_IF_FAIL (variable);
         //message += "\nDumped for debug: \n";
         //variable->to_string (message, false);
-        ui_utils::display_info (message);
+        ui_utils::display_info (workbench.get_root_window (),
+                                message);
     }
 
 };//end GlobalVarsInspectorDialog::Priv
 
+/// Constructor of the GlobalVarsInspectorDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+///
+/// \param a_debugger the IDebugger interface to use to inspect the
+/// variables.
+///
+/// \param a_workbench the IWorkbench interface to use.
 GlobalVarsInspectorDialog::GlobalVarsInspectorDialog
-                                            (const UString &a_root_path,
-        IDebuggerSafePtr &a_debugger, IWorkbench &a_workbench) :
+(const UString &a_root_path,
+ IDebuggerSafePtr &a_debugger,
+ IWorkbench &a_workbench) :
     Dialog (a_root_path,
             "globalvarsinspector.ui",
-            "globalvarsinspector")
+            "globalvarsinspector",
+            a_workbench.get_root_window ())
 {
     m_priv.reset (new Priv (widget (), gtkbuilder (), a_debugger, a_workbench));
 }
diff --git a/src/persp/dbgperspective/nmv-load-core-dialog.cc 
b/src/persp/dbgperspective/nmv-load-core-dialog.cc
index 87c3dcc..3fc6980 100644
--- a/src/persp/dbgperspective/nmv-load-core-dialog.cc
+++ b/src/persp/dbgperspective/nmv-load-core-dialog.cc
@@ -96,8 +96,10 @@ public:
     }
 };//end class LoadCoreDialog::Priv
 
-LoadCoreDialog::LoadCoreDialog (const UString &a_root_path) :
-    Dialog (a_root_path, "loadcoredialog.ui", "loadcoredialog")
+LoadCoreDialog::LoadCoreDialog (Gtk::Window &a_parent,
+                                const UString &a_root_path) :
+    Dialog (a_root_path, "loadcoredialog.ui",
+            "loadcoredialog", a_parent)
 {
     m_priv.reset (new Priv (gtkbuilder ()));
 }
diff --git a/src/persp/dbgperspective/nmv-load-core-dialog.h b/src/persp/dbgperspective/nmv-load-core-dialog.h
index 50849ed..64f3d91 100644
--- a/src/persp/dbgperspective/nmv-load-core-dialog.h
+++ b/src/persp/dbgperspective/nmv-load-core-dialog.h
@@ -41,7 +41,8 @@ class LoadCoreDialog : public Dialog {
     class Priv;
     SafePtr<Priv> m_priv;
 public:
-    LoadCoreDialog (const UString &a_resource_root_path);
+    LoadCoreDialog (Gtk::Window &a_parent,
+                    const UString &a_resource_root_path);
     virtual ~LoadCoreDialog ();
 
     UString program_name () const;
diff --git a/src/persp/dbgperspective/nmv-local-vars-inspector.cc 
b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
index 9dcf3cc..89a4edd 100644
--- a/src/persp/dbgperspective/nmv-local-vars-inspector.cc
+++ b/src/persp/dbgperspective/nmv-local-vars-inspector.cc
@@ -596,7 +596,8 @@ public:
                 cur_selected_row->get_value
                         (vutil::get_variable_columns ().variable);
         THROW_IF_FAIL (variable);
-        ui_utils::display_info (message);
+        ui_utils::display_info (workbench.get_root_window (),
+                                message);
     }
 
     /// Add the new local variables @a_vars to the list of local
diff --git a/src/persp/dbgperspective/nmv-open-file-dialog.cc 
b/src/persp/dbgperspective/nmv-open-file-dialog.cc
index 39ba08e..f6446aa 100644
--- a/src/persp/dbgperspective/nmv-open-file-dialog.cc
+++ b/src/persp/dbgperspective/nmv-open-file-dialog.cc
@@ -227,10 +227,23 @@ public:
     }
 };//end class OpenFileDialog::Priv
 
-OpenFileDialog::OpenFileDialog (const UString &a_root_path,
+/// Constructor of the OpenFileDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+///
+/// \param a_debugger the IDebugger interface to use.
+///
+/// \param a_working_dir the directory to consider as the current
+/// working directory.
+OpenFileDialog::OpenFileDialog (Gtk::Window &a_parent,
+                                const UString &a_root_path,
                                 IDebuggerSafePtr &a_debugger,
                                 const UString  &a_working_dir) :
-    Dialog (a_root_path, "openfiledialog.ui", "dialog_open_source_file")
+    Dialog (a_root_path, "openfiledialog.ui",
+            "dialog_open_source_file", a_parent)
 {
     m_priv.reset (new Priv (gtkbuilder (), a_debugger, a_working_dir));
 }
diff --git a/src/persp/dbgperspective/nmv-open-file-dialog.h b/src/persp/dbgperspective/nmv-open-file-dialog.h
index 2868f2b..e3c9448 100644
--- a/src/persp/dbgperspective/nmv-open-file-dialog.h
+++ b/src/persp/dbgperspective/nmv-open-file-dialog.h
@@ -43,7 +43,8 @@ class OpenFileDialog : public Dialog {
     SafePtr<Priv> m_priv;
 
 public:
-    OpenFileDialog (const UString &a_resource_root_path,
+    OpenFileDialog (Gtk::Window &a_parent,
+                    const UString &a_resource_root_path,
                     IDebuggerSafePtr& a_debugger,
                     const UString &a_working_dir);
     virtual ~OpenFileDialog ();
diff --git a/src/persp/dbgperspective/nmv-preferences-dialog.cc 
b/src/persp/dbgperspective/nmv-preferences-dialog.cc
index d40d1a5..611cbfd 100644
--- a/src/persp/dbgperspective/nmv-preferences-dialog.cc
+++ b/src/persp/dbgperspective/nmv-preferences-dialog.cc
@@ -917,12 +917,24 @@ public:
     }
 };//end PreferencesDialog
 
-PreferencesDialog::PreferencesDialog (IPerspective &a_perspective,
+/// Constructor of the PreferenceDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_perspective the IPerspective interface to use.
+///
+/// \param a_layout_manager the layout manager to use.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+PreferencesDialog::PreferencesDialog (Gtk::Window &a_parent,
+                                      IPerspective &a_perspective,
                                       LayoutManager &a_layout_manager,
                                       const UString &a_root_path) :
     Dialog (a_root_path,
             "preferencesdialog.ui",
-            "preferencesdialog")
+            "preferencesdialog",
+            a_parent)
 {
     m_priv.reset (new Priv (gtkbuilder (), a_perspective, a_layout_manager));
     m_priv->update_widget_from_conf ();
diff --git a/src/persp/dbgperspective/nmv-preferences-dialog.h 
b/src/persp/dbgperspective/nmv-preferences-dialog.h
index c2f2a84..ea62bab 100644
--- a/src/persp/dbgperspective/nmv-preferences-dialog.h
+++ b/src/persp/dbgperspective/nmv-preferences-dialog.h
@@ -43,7 +43,8 @@ class PreferencesDialog : public Dialog {
     PreferencesDialog ();
 
 public:
-    PreferencesDialog (IPerspective &a_perspective,
+    PreferencesDialog (Gtk::Window &a_parent,
+                       IPerspective &a_perspective,
                        LayoutManager &a_layout_manager,
                        const UString &a_root_path);
     virtual ~PreferencesDialog ();
diff --git a/src/persp/dbgperspective/nmv-proc-list-dialog.cc 
b/src/persp/dbgperspective/nmv-proc-list-dialog.cc
index cbffab5..0c7dc43 100644
--- a/src/persp/dbgperspective/nmv-proc-list-dialog.cc
+++ b/src/persp/dbgperspective/nmv-proc-list-dialog.cc
@@ -269,10 +269,18 @@ public:
     }
 };//end class ProcListDialog::Priv
 
-
-ProcListDialog::ProcListDialog (const UString &a_root_path,
+/// Constructor of the ProcListDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+///
+/// \param a_proc_mgr the IProcMgr interface to use.
+ProcListDialog::ProcListDialog (Gtk::Window &a_parent,
+                                const UString &a_root_path,
                                 IProcMgr &a_proc_mgr) :
-    Dialog(a_root_path, "proclistdialog.ui", "proclistdialog")
+    Dialog(a_root_path, "proclistdialog.ui", "proclistdialog", a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder (), a_proc_mgr));
     widget ().hide ();
diff --git a/src/persp/dbgperspective/nmv-proc-list-dialog.h b/src/persp/dbgperspective/nmv-proc-list-dialog.h
index 6fde7a9..c35c93a 100644
--- a/src/persp/dbgperspective/nmv-proc-list-dialog.h
+++ b/src/persp/dbgperspective/nmv-proc-list-dialog.h
@@ -43,7 +43,8 @@ class ProcListDialog : public Dialog {
 
 public:
 
-    ProcListDialog (const UString &a_root_path,
+    ProcListDialog (Gtk::Window &a_parent,
+                    const UString &a_root_path,
                     IProcMgr &a_proc_mgr);
     virtual ~ProcListDialog ();
     virtual gint run ();
diff --git a/src/persp/dbgperspective/nmv-remote-target-dialog.cc 
b/src/persp/dbgperspective/nmv-remote-target-dialog.cc
index 22cdc0b..3ea0120 100644
--- a/src/persp/dbgperspective/nmv-remote-target-dialog.cc
+++ b/src/persp/dbgperspective/nmv-remote-target-dialog.cc
@@ -328,10 +328,18 @@ struct RemoteTargetDialog::Priv {
 
 };//end RemoteTargetDialog::Priv
 
-RemoteTargetDialog::RemoteTargetDialog (const UString &a_root_path) :
+/// Constructor of the RemoteTargetDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+RemoteTargetDialog::RemoteTargetDialog (Gtk::Window &a_parent,
+                                        const UString &a_root_path) :
     Dialog (a_root_path,
             "remotetargetdialog.ui",
-            "remotetargetdialog")
+            "remotetargetdialog",
+            a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
     THROW_IF_FAIL (m_priv);
diff --git a/src/persp/dbgperspective/nmv-remote-target-dialog.h 
b/src/persp/dbgperspective/nmv-remote-target-dialog.h
index 32042c6..38d04e0 100644
--- a/src/persp/dbgperspective/nmv-remote-target-dialog.h
+++ b/src/persp/dbgperspective/nmv-remote-target-dialog.h
@@ -39,7 +39,8 @@ public:
         SERIAL_CONNECTION_TYPE
     };
 
-    RemoteTargetDialog (const UString &a_root_path);
+    RemoteTargetDialog (Gtk::Window &a_parent,
+                        const UString &a_root_path);
     virtual ~RemoteTargetDialog ();
 
     const UString& get_cwd () const;
diff --git a/src/persp/dbgperspective/nmv-run-program-dialog.cc 
b/src/persp/dbgperspective/nmv-run-program-dialog.cc
index 562c330..117face 100644
--- a/src/persp/dbgperspective/nmv-run-program-dialog.cc
+++ b/src/persp/dbgperspective/nmv-run-program-dialog.cc
@@ -188,8 +188,16 @@ public:
     }
 };//end struct RunProgramDialog::Priv
 
-RunProgramDialog::RunProgramDialog (const UString &a_root_path) :
-    Dialog (a_root_path, "runprogramdialog.ui", "runprogramdialog")
+/// Constructor of the RunProgramDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+RunProgramDialog::RunProgramDialog (Gtk::Window &a_parent,
+                                    const UString &a_root_path) :
+    Dialog (a_root_path, "runprogramdialog.ui",
+            "runprogramdialog", a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
     THROW_IF_FAIL (m_priv);
diff --git a/src/persp/dbgperspective/nmv-run-program-dialog.h 
b/src/persp/dbgperspective/nmv-run-program-dialog.h
index a72e001..d5ad326 100644
--- a/src/persp/dbgperspective/nmv-run-program-dialog.h
+++ b/src/persp/dbgperspective/nmv-run-program-dialog.h
@@ -45,7 +45,8 @@ class RunProgramDialog : public Dialog {
 
 public:
 
-    RunProgramDialog (const UString &a_resource_root_path);
+    RunProgramDialog (Gtk::Window &a_parent,
+                      const UString &a_resource_root_path);
 
     virtual ~RunProgramDialog ();
 
diff --git a/src/persp/dbgperspective/nmv-saved-sessions-dialog.cc 
b/src/persp/dbgperspective/nmv-saved-sessions-dialog.cc
index 3bb1fdc..b4cb54f 100644
--- a/src/persp/dbgperspective/nmv-saved-sessions-dialog.cc
+++ b/src/persp/dbgperspective/nmv-saved-sessions-dialog.cc
@@ -174,9 +174,19 @@ public:
     }
 }; //end struct SavedSessionsDialog::Priv
 
-SavedSessionsDialog::SavedSessionsDialog (const UString &a_root_path,
+/// Constructor of the SavedSessionsDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+///
+/// \param a_session_manager the session manager to use.
+SavedSessionsDialog::SavedSessionsDialog (Gtk::Window &a_parent,
+                                          const UString &a_root_path,
                                           ISessMgr *a_session_manager) :
-    Dialog(a_root_path, "savedsessionsdialog.ui", "savedsessionsdialog")
+    Dialog(a_root_path, "savedsessionsdialog.ui",
+           "savedsessionsdialog", a_parent)
 {
     THROW_IF_FAIL (a_session_manager);
     m_priv.reset (new Priv (widget (), gtkbuilder (), *a_session_manager));
diff --git a/src/persp/dbgperspective/nmv-saved-sessions-dialog.h 
b/src/persp/dbgperspective/nmv-saved-sessions-dialog.h
index 9d48e4c..cd0636d 100644
--- a/src/persp/dbgperspective/nmv-saved-sessions-dialog.h
+++ b/src/persp/dbgperspective/nmv-saved-sessions-dialog.h
@@ -46,7 +46,8 @@ class SavedSessionsDialog : public Dialog {
     SafePtr<SavedSessionsDialog::Priv> m_priv;
 
 public:
-    SavedSessionsDialog (const UString &a_root_path,
+    SavedSessionsDialog (Gtk::Window &a_parent,
+                         const UString &a_root_path,
                          ISessMgr *a_sesssion_manager);
     virtual ~SavedSessionsDialog ();
 
diff --git a/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc 
b/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
index 2ad656a..f68846d 100644
--- a/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
+++ b/src/persp/dbgperspective/nmv-set-breakpoint-dialog.cc
@@ -378,8 +378,17 @@ public:
     }
 };//end class SetBreakpointDialog::Priv
 
-SetBreakpointDialog::SetBreakpointDialog (const UString &a_root_path) :
-    Dialog (a_root_path, "setbreakpointdialog.ui", "setbreakpointdialog")
+/// Constructor of the SetBreakpointDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+SetBreakpointDialog::SetBreakpointDialog (Gtk::Window &a_parent,
+                                          const UString &a_root_path) :
+    Dialog (a_root_path, "setbreakpointdialog.ui",
+            "setbreakpointdialog",
+            a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
 }
diff --git a/src/persp/dbgperspective/nmv-set-breakpoint-dialog.h 
b/src/persp/dbgperspective/nmv-set-breakpoint-dialog.h
index 4e9c755..d5dc6b8 100644
--- a/src/persp/dbgperspective/nmv-set-breakpoint-dialog.h
+++ b/src/persp/dbgperspective/nmv-set-breakpoint-dialog.h
@@ -55,7 +55,8 @@ public:
         MODE_EVENT
     };
 
-    SetBreakpointDialog (const UString &a_resource_root_path);
+    SetBreakpointDialog (Gtk::Window &a_parent,
+                         const UString &a_resource_root_path);
     virtual ~SetBreakpointDialog ();
 
     UString file_name () const;
diff --git a/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc 
b/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
index 72aa973..3622331 100644
--- a/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
+++ b/src/persp/dbgperspective/nmv-set-jump-to-dialog.cc
@@ -400,8 +400,16 @@ public:
     }
 };// end class SetJumpToDialog::Priv
 
-SetJumpToDialog::SetJumpToDialog (const UString &a_root_path)
-    : Dialog (a_root_path, "setjumptodialog.ui", "setjumptodialog")
+/// Constructor of the SetJumpToDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+SetJumpToDialog::SetJumpToDialog (Gtk::Window &a_parent,
+                                  const UString &a_root_path)
+    : Dialog (a_root_path, "setjumptodialog.ui",
+              "setjumptodialog", a_parent)
 {
     m_priv.reset (new Priv (widget (), gtkbuilder ()));
 }
diff --git a/src/persp/dbgperspective/nmv-set-jump-to-dialog.h 
b/src/persp/dbgperspective/nmv-set-jump-to-dialog.h
index e458a77..55bd4f8 100644
--- a/src/persp/dbgperspective/nmv-set-jump-to-dialog.h
+++ b/src/persp/dbgperspective/nmv-set-jump-to-dialog.h
@@ -43,7 +43,8 @@ class SetJumpToDialog : public Dialog
 
  public:
 
-    SetJumpToDialog (const UString &a_resource_root_path);
+    SetJumpToDialog (Gtk::Window &a_parent,
+                     const UString &a_resource_root_path);
     virtual ~SetJumpToDialog ();
 
     const common::Loc* get_location () const;
diff --git a/src/persp/dbgperspective/nmv-watchpoint-dialog.cc 
b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
index e1ac371..90a6a5c 100644
--- a/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
+++ b/src/persp/dbgperspective/nmv-watchpoint-dialog.cc
@@ -197,12 +197,24 @@ struct WatchpointDialog::Priv {
 
 }; // end struct WatchpointDialog
 
-WatchpointDialog::WatchpointDialog (const UString &a_root_path,
+/// Constructor of the WatchpointDialog type.
+///
+/// \param a_parent the parent window of the dialog.
+///
+/// \param a_root_path the path to the root directory of the
+///
+/// \param a_debugger the IDebugger interface to use.
+///
+/// \param a_perspective the IPerspective interface to use.
+/// ressources of the dialog.
+WatchpointDialog::WatchpointDialog (Gtk::Window &a_parent,
+                                    const UString &a_root_path,
                                     IDebugger &a_debugger,
                                     IPerspective &a_perspective) :
     Dialog (a_root_path,
             "watchpointdialog.ui",
-            "watchpointdialog")
+            "watchpointdialog",
+            a_parent)
 {
     LOG_FUNCTION_SCOPE_NORMAL_DD;
     m_priv.reset (new WatchpointDialog::Priv (widget (),
diff --git a/src/persp/dbgperspective/nmv-watchpoint-dialog.h 
b/src/persp/dbgperspective/nmv-watchpoint-dialog.h
index e3039a5..0f43b38 100644
--- a/src/persp/dbgperspective/nmv-watchpoint-dialog.h
+++ b/src/persp/dbgperspective/nmv-watchpoint-dialog.h
@@ -59,7 +59,8 @@ public:
         READ_MODE = 1 << 1
     };
 
-    WatchpointDialog (const UString &a_resource_root_path,
+    WatchpointDialog (Gtk::Window &a_parent,
+                      const UString &a_resource_root_path,
                       IDebugger &a_debugger,
                       IPerspective &a_perspective);
     virtual ~WatchpointDialog ();
diff --git a/src/uicommon/nmv-dialog.cc b/src/uicommon/nmv-dialog.cc
index 83f38e1..b8c22d7 100644
--- a/src/uicommon/nmv-dialog.cc
+++ b/src/uicommon/nmv-dialog.cc
@@ -75,13 +75,26 @@ public:
     }
 };//end struct Dialog::Priv
 
+/// Constructor of the Dialog type.
+///
+/// \param a_ressource_root_path the path to the root directory where
+/// to find the resources of the Dialog.
+///
+/// \param a_gtkbuilder_filename the file name of the gtkbuilder
+/// resource file of the dialog, relative to a_resource_root_path.
+///
+/// \param a_widget_name the name of the widget.
+///
+/// \param a_parent the parent window of the dialog.
 Dialog::Dialog (const UString &a_resource_root_path,
                 const UString &a_gtkbuilder_filename,
-                const UString &a_widget_name)
+                const UString &a_widget_name,
+                Gtk::Window &a_parent)
 {
     m_priv.reset (new Priv (a_resource_root_path,
                             a_gtkbuilder_filename,
                             a_widget_name));
+    widget().set_transient_for (a_parent);
 }
 
 Gtk::Dialog&
diff --git a/src/uicommon/nmv-dialog.h b/src/uicommon/nmv-dialog.h
index 41aa25e..32f66d1 100644
--- a/src/uicommon/nmv-dialog.h
+++ b/src/uicommon/nmv-dialog.h
@@ -68,7 +68,8 @@ public:
 
     Dialog (const UString &a_resource_root_path,
             const UString &a_gtkbuilder_filename,
-            const UString &a_widget_name);
+            const UString &a_widget_name,
+            Gtk::Window &a_parent);
 
     virtual ~Dialog ();
 
diff --git a/src/uicommon/nmv-locate-file-dialog.cc b/src/uicommon/nmv-locate-file-dialog.cc
index 68e1f48..2fd56c9 100644
--- a/src/uicommon/nmv-locate-file-dialog.cc
+++ b/src/uicommon/nmv-locate-file-dialog.cc
@@ -44,7 +44,8 @@ public:
     Gtk::FileChooserButton *fcbutton_location;
     Gtk::Label *label_filename;
     Gtk::Button *okbutton;
-    Priv (const Glib::RefPtr<Gtk::Builder> &a_gtkbuilder, const UString& a_filename) :
+    Priv (const Glib::RefPtr<Gtk::Builder> &a_gtkbuilder,
+          const UString& a_filename) :
         fcbutton_location (0),
         label_filename(0),
         okbutton (0)
@@ -81,7 +82,7 @@ public:
 
     void on_file_selection_changed_signal ()
     {
-        NEMIVER_TRY
+        NEMIVER_TRY;
 
         THROW_IF_FAIL (fcbutton_location);
 
@@ -91,13 +92,26 @@ public:
         } else {
             okbutton->set_sensitive (false);
         }
-        NEMIVER_CATCH
+        NEMIVER_CATCH;
     }
 };//end class LocateFileDialog::Priv
 
+/// Constructor of the LocateFileDialog type.
+///
+///
+/// \param a_root_path the path to the root directory of the
+/// ressources of the dialog.
+///
+/// \param a_file the file to locate.
+///
+/// \param a_parent the parent window of the dialog.
 LocateFileDialog::LocateFileDialog (const UString &a_root_path,
-                                    const UString &a_file) :
-    Dialog (a_root_path, "locatefiledialog.ui", "locatefiledialog")
+                                    const UString &a_file,
+                                    Gtk::Window &a_parent) :
+    Dialog (a_root_path,
+            "locatefiledialog.ui",
+            "locatefiledialog",
+            a_parent)
 {
     m_priv.reset (new Priv (gtkbuilder (), a_file));
 }
diff --git a/src/uicommon/nmv-locate-file-dialog.h b/src/uicommon/nmv-locate-file-dialog.h
index 5def510..2d931f4 100644
--- a/src/uicommon/nmv-locate-file-dialog.h
+++ b/src/uicommon/nmv-locate-file-dialog.h
@@ -42,7 +42,8 @@ class LocateFileDialog : public Dialog {
     SafePtr<Priv> m_priv;
 public:
     LocateFileDialog (const UString &a_resource_root_path,
-                      const UString &a_file);
+                      const UString &a_file,
+                      Gtk::Window &a_parent);
     virtual ~LocateFileDialog ();
 
     UString file_location () const;
diff --git a/src/uicommon/nmv-source-editor.cc b/src/uicommon/nmv-source-editor.cc
index 45de74b..62b718a 100644
--- a/src/uicommon/nmv-source-editor.cc
+++ b/src/uicommon/nmv-source-editor.cc
@@ -173,6 +173,7 @@ on_line_mark_activated_signal (GtkSourceView *a_view,
 struct SourceEditor::Priv {
     Sequence sequence;
     UString root_dir;
+    Gtk::Window &parent_window;
     nemiver::SourceView *source_view;
     Gtk::Label *line_col_label;
     Gtk::HBox *status_box;
@@ -710,7 +711,8 @@ struct SourceEditor::Priv {
         source_buffer->place_cursor (source_buffer->begin ());
     }
 
-    Priv () :
+    Priv (Gtk::Window &a_parent_window) :
+        parent_window (a_parent_window),
         source_view (Gtk::manage (new SourceView)),
         line_col_label (Gtk::manage (new Gtk::Label)),
         status_box (Gtk::manage (new Gtk::HBox)),
@@ -720,10 +722,12 @@ struct SourceEditor::Priv {
         init ();
     }
 
-    explicit Priv (const UString &a_root_dir,
+    explicit Priv (Gtk::Window &a_parent_window,
+                   const UString &a_root_dir,
                    Glib::RefPtr<Buffer> &a_buf,
                    bool a_assembly) :
         root_dir (a_root_dir),
+        parent_window (a_parent_window),
         source_view (Gtk::manage (new SourceView (a_buf))),
         line_col_label (Gtk::manage (new Gtk::Label)),
         status_box (Gtk::manage (new Gtk::HBox)),
@@ -739,9 +743,11 @@ struct SourceEditor::Priv {
         init ();
     }
 
-    explicit Priv (const UString &a_root_dir,
+    explicit Priv (Gtk::Window &a_parent_window,
+                   const UString &a_root_dir,
                    Glib::RefPtr<Buffer> &a_buf) :
         root_dir (a_root_dir),
+        parent_window (a_parent_window),
         source_view (Gtk::manage (new SourceView (a_buf))),
         status_box (Gtk::manage (new Gtk::HBox)),
         non_asm_ctxt (-1, -1)
@@ -778,17 +784,26 @@ SourceEditor::init ()
     source_view ().set_show_line_marks (true);
 }
 
-SourceEditor::SourceEditor ()
-{
-    m_priv.reset (new Priv);
-    init ();
-}
-
-SourceEditor::SourceEditor (const UString &a_root_dir,
+/// Constructor of the SourceEditor type.
+///
+/// \param a_parent_window the parent window of the dialogs used by
+/// this editor.
+///
+/// \param a_root_dir the root directory from where to find the
+/// resources of the dialogs used by the editor.
+///
+/// \param a_buf the buffer containing the source to edit.
+///
+/// \param a_assembly whether to support asm.
+SourceEditor::SourceEditor (Gtk::Window &a_parent_window,
+                            const UString &a_root_dir,
                             Glib::RefPtr<Buffer> &a_buf,
                             bool a_assembly)
 {
-    m_priv.reset (new Priv (a_root_dir, a_buf, a_assembly));
+    m_priv.reset (new Priv (a_parent_window,
+                            a_root_dir,
+                            a_buf,
+                            a_assembly));
     init ();
 }
 
@@ -1416,7 +1431,8 @@ SourceEditor::create_source_buffer ()
 }
 
 bool
-SourceEditor::load_file (const UString &a_path,
+SourceEditor::load_file (Gtk::Window &a_parent,
+                         const UString &a_path,
                          const std::list<std::string> &a_supported_encodings,
                          bool a_enable_syntax_highlight,
                          Glib::RefPtr<Buffer> &a_source_buffer)
@@ -1429,7 +1445,8 @@ SourceEditor::load_file (const UString &a_path,
 
     if (!gio_file->query_exists ()) {
         LOG_ERROR ("Could not open file " + path);
-        ui_utils::display_error ("Could not open file: "
+        ui_utils::display_error (a_parent,
+                                 "Could not open file: "
                                  + Glib::filename_to_utf8 (path));
         return false;
     }
@@ -1474,7 +1491,7 @@ SourceEditor::load_file (const UString &a_path,
                       "is different from %s"),
                     path.c_str (),
                     cur_charset.c_str ());
-        ui_utils::display_error (msg);
+        ui_utils::display_error (a_parent, msg);
         return false;
     }
     a_source_buffer->set_text (utf8_content);
@@ -1503,11 +1520,37 @@ SourceEditor::setup_and_popup_menu (GdkEventButton *a_event,
     m_priv->source_view->setup_and_popup_menu (a_event, a_attach_to,
                                                a_menu);
 }
+
+/// Add asm instructions to the underlying buffer of a source editor.
+///
+/// \param a_parent_window the parent window of the dialogs used in
+/// the course of adding the asm instruction to the source editor.
+///
+/// \param a_asm the list of asm instructions to add to the source editor.
+///
+/// \param a_append whether to append the asm instructions (if true)
+/// or to prepend them to the buffer.
+///
+/// \param a_src_search_dirs if there are source files to find, where
+/// to look for them.  This can be useful for mixed (with source code)
+/// asm.
+///
+/// \param a_session_dirs if a file was searched and found, its
+/// directory is added to this list.
+///
+/// \param a_ignore_path, if a source file is searched, is not found,
+/// and is in this list, do not ask the user to help us locate it.
+///
+/// \param a_buf the underlying source buffer of this source editor.
+/// It's where the asm instructions are to be added.
+///
+/// \return true upon successful completion.
 bool
-SourceEditor::add_asm (const common::DisassembleInfo &/*a_info*/,
+SourceEditor::add_asm (Gtk::Window &a_parent_window,
+                       const common::DisassembleInfo &/*a_info*/,
                        const std::list<common::Asm> &a_asm,
                        bool a_append,
-                      const list<UString> &a_src_search_dirs,
+                       const list<UString> &a_src_search_dirs,
                        list<UString> &a_session_dirs,
                        std::map<UString, bool> &a_ignore_paths,
                        Glib::RefPtr<Buffer> &a_buf)
@@ -1525,8 +1568,11 @@ SourceEditor::add_asm (const common::DisassembleInfo &/*a_info*/,
 
     // Write the first asm instruction into a string stream.
     std::ostringstream first_os, endl_os;
-    ReadLine reader (a_src_search_dirs, a_session_dirs,
-                     a_ignore_paths, &ui_utils::find_file_and_read_line);
+    ReadLine reader (a_parent_window,
+                     a_src_search_dirs,
+                     a_session_dirs,
+                     a_ignore_paths,
+                     &ui_utils::find_file_and_read_line);
     bool first_written = write_asm_instr (*it, reader, first_os);
     endl_os << std::endl;
 
@@ -1564,11 +1610,42 @@ SourceEditor::add_asm (const common::DisassembleInfo &/*a_info*/,
     return true;
 }
 
+/// Load the asm instructions referred to by the disassembling
+/// information and stuff it into the underlying buffer of a
+/// SourceEditor.
+///
+/// \param a_parent_window the parent window of the dialogs used in
+/// the course of adding the asm instruction to the source editor.
+///
+/// \param a_info some information describing the assembly instruction
+/// stream to add to this source editor.
+///
+/// \param a_asm the asm instruction stream to add to this source
+/// editor.
+///
+/// \param a_append if true, the asm instructions are added to the
+/// buffer, otherwise they are prepended to it.
+///
+/// \param a_src_search_dirs if there are source files to find, where
+/// to look for them.  This can be useful for mixed (with source code)
+/// asm.
+///
+/// \param a_session_dirs if a file was searched and found, its
+/// directory is added to this list.
+///
+/// \param a_ignore_path, if a source file is searched, is not found,
+/// and is in this list, do not ask the user to help us locate it.
+///
+/// \param a_buf the underlying source buffer of this source editor.
+/// It's where the asm instructions are to be added.
+///
+/// \return true upon successful completion.
 bool
-SourceEditor::load_asm (const common::DisassembleInfo &a_info,
+SourceEditor::load_asm (Gtk::Window &a_parent_window,
+                        const common::DisassembleInfo &a_info,
                         const std::list<common::Asm> &a_asm,
                         bool a_append,
-                       const list<UString> &a_src_search_dirs,
+                        const list<UString> &a_src_search_dirs,
                         list<UString> &a_session_dirs,
                         std::map<UString, bool> &a_ignore_paths,
                         Glib::RefPtr<Buffer> &a_buf)
@@ -1584,8 +1661,11 @@ SourceEditor::load_asm (const common::DisassembleInfo &a_info,
     }
     THROW_IF_FAIL (a_buf);
 
-    add_asm (a_info, a_asm, a_append, a_src_search_dirs,
-             a_session_dirs, a_ignore_paths, a_buf);
+    add_asm (a_parent_window,
+             a_info, a_asm, a_append,
+             a_src_search_dirs,
+             a_session_dirs,
+             a_ignore_paths, a_buf);
 
     NEMIVER_CATCH_AND_RETURN (false)
     return true;
diff --git a/src/uicommon/nmv-source-editor.h b/src/uicommon/nmv-source-editor.h
index c0a6e7f..e625a33 100644
--- a/src/uicommon/nmv-source-editor.h
+++ b/src/uicommon/nmv-source-editor.h
@@ -76,7 +76,8 @@ public:
     };
 
 
-    explicit SourceEditor (const UString &a_root_dir,
+    explicit SourceEditor (Gtk::Window &a_parent_window,
+                          const UString &a_root_dir,
                            Glib::RefPtr<Buffer> &a_buf,
                            bool a_composite = false);
     virtual ~SourceEditor ();
@@ -127,7 +128,8 @@ public:
 
     static Glib::RefPtr<Buffer> create_source_buffer ();
 
-    static bool load_file (const UString &a_path,
+    static bool load_file (Gtk::Window &a_parent,
+                          const UString &a_path,
                           const std::list<std::string> &a_supported_encodings,
                           bool a_enable_syntaxt_highlight,
                           Glib::RefPtr<Buffer> &a_source_buffer);
@@ -180,7 +182,8 @@ public:
     bool scroll_to_address (const Address &a_address,
                            bool a_approximate);
 
-    static bool add_asm (const common::DisassembleInfo &/*a_info*/,
+    static bool add_asm (Gtk::Window &a_parent_window,
+                        const common::DisassembleInfo &/*a_info*/,
                         const std::list<common::Asm> &a_asm,
                         bool a_append,
                         const list<UString> &a_src_search_dirs,
@@ -188,7 +191,8 @@ public:
                         std::map<UString, bool> &a_ignore_paths,
                         Glib::RefPtr<Buffer> &a_buf);
 
-    static bool load_asm (const common::DisassembleInfo &/*a_info*/,
+    static bool load_asm (Gtk::Window &a_parent_window,
+                         const common::DisassembleInfo &/*a_info*/,
                          const std::list<common::Asm> &a_asm,
                          bool a_append,
                          const list<UString> &a_src_search_dirs,
diff --git a/src/uicommon/nmv-terminal.cc b/src/uicommon/nmv-terminal.cc
index d24f1ab..9985e6b 100644
--- a/src/uicommon/nmv-terminal.cc
+++ b/src/uicommon/nmv-terminal.cc
@@ -73,7 +73,7 @@ on_button_press_signal (GtkWidget*,
         return false;
     }
 
-    NEMIVER_TRY
+    NEMIVER_TRY;
 
     THROW_IF_FAIL (a_tuple);
     VteTerminal*& vte = std::tr1::get<0> (*a_tuple);
@@ -94,7 +94,7 @@ on_button_press_signal (GtkWidget*,
             (vte_terminal_get_has_selection (vte));
     menu->popup (a_event->button, a_event->time);
 
-    NEMIVER_CATCH
+    NEMIVER_CATCH;
     return true;
 }
 
diff --git a/src/uicommon/nmv-ui-utils.cc b/src/uicommon/nmv-ui-utils.cc
index cfdf54e..585d0f2 100644
--- a/src/uicommon/nmv-ui-utils.cc
+++ b/src/uicommon/nmv-ui-utils.cc
@@ -59,12 +59,14 @@ add_action_entries_to_action_group (const ActionEntry a_tab[],
 /// be shown that dialog again
 class DontShowAgainMsgDialog : public Gtk::MessageDialog {
 
-    DontShowAgainMsgDialog (const DontShowAgainMsgDialog&);
+    DontShowAgainMsgDialog (Gtk::Window &a_parent_window,
+                            const DontShowAgainMsgDialog&);
     DontShowAgainMsgDialog& operator= (const DontShowAgainMsgDialog&);
 
     Gtk::CheckButton *m_check_button;
 public:
-    explicit DontShowAgainMsgDialog (const Glib::ustring &a_message,
+    explicit DontShowAgainMsgDialog (Gtk::Window &a_parent_window,
+                                     const Glib::ustring &a_message,
                                      bool a_propose_dont_ask_again = false,
                                      bool a_use_markup = false,
                                      Gtk::MessageType a_type
@@ -72,7 +74,8 @@ public:
                                      Gtk::ButtonsType a_buttons
                                                          = Gtk::BUTTONS_OK,
                                      bool a_modal = false) :
-        Gtk::MessageDialog (a_message,
+        Gtk::MessageDialog (a_parent_window,
+                            a_message,
                             a_use_markup,
                             a_type,
                             a_buttons,
@@ -111,18 +114,23 @@ public:
 };//end class DontShowAgainMsgDialog
 
 int
-display_info (const UString &a_message)
+display_info (Gtk::Window &a_parent_window,
+              const UString &a_message)
 {
-    Gtk::MessageDialog dialog (a_message, false, Gtk::MESSAGE_INFO,
-                                               Gtk::BUTTONS_OK, true);
+    Gtk::MessageDialog dialog (a_parent_window,
+                               a_message, false,
+                               Gtk::MESSAGE_INFO,
+                               Gtk::BUTTONS_OK, true);
     dialog.set_default_response (Gtk::RESPONSE_OK);
     return dialog.run ();
 }
 
 int
-display_warning (const UString &a_message)
+display_warning (Gtk::Window &a_parent_window,
+                 const UString &a_message)
 {
-    Gtk::MessageDialog dialog (a_message, false,
+    Gtk::MessageDialog dialog (a_parent_window,
+                               a_message, false,
                                Gtk::MESSAGE_WARNING,
                                Gtk::BUTTONS_OK, true);
     dialog.set_default_response (Gtk::RESPONSE_OK);
@@ -130,9 +138,11 @@ display_warning (const UString &a_message)
 }
 
 int
-display_error (const UString &a_message)
+display_error (Gtk::Window &a_parent_window,
+               const UString &a_message)
 {
-    Gtk::MessageDialog dialog (a_message, false,
+    Gtk::MessageDialog dialog (a_parent_window,
+                               a_message, false,
                                Gtk::MESSAGE_ERROR,
                                Gtk::BUTTONS_OK, true);
     dialog.set_default_response (Gtk::RESPONSE_OK);
@@ -140,9 +150,21 @@ display_error (const UString &a_message)
 }
 
 int
-ask_yes_no_question (const UString &a_message)
+display_error_not_transient (const UString &a_message)
 {
     Gtk::MessageDialog dialog (a_message, false,
+                               Gtk::MESSAGE_ERROR,
+                               Gtk::BUTTONS_OK, true);
+    dialog.set_default_response (Gtk::RESPONSE_OK);
+    return dialog.run ();
+}
+
+int
+ask_yes_no_question (Gtk::Window &a_parent_window,
+                     const UString &a_message)
+{
+    Gtk::MessageDialog dialog (a_parent_window,
+                               a_message, false,
                                Gtk::MESSAGE_QUESTION,
                                Gtk::BUTTONS_YES_NO, true);
     dialog.set_default_response (Gtk::RESPONSE_OK);
@@ -150,11 +172,13 @@ ask_yes_no_question (const UString &a_message)
 }
 
 int
-ask_yes_no_question (const UString &a_message,
+ask_yes_no_question (Gtk::Window &a_parent_window,
+                     const UString &a_message,
                      bool a_propose_dont_ask_again,
                      bool &a_dont_ask_this_again)
 {
-    DontShowAgainMsgDialog dialog (a_message, a_propose_dont_ask_again,
+    DontShowAgainMsgDialog dialog (a_parent_window,
+                                   a_message, a_propose_dont_ask_again,
                                    false, Gtk::MESSAGE_QUESTION,
                                    Gtk::BUTTONS_YES_NO, true);
     dialog.set_default_response (Gtk::RESPONSE_OK);
@@ -164,9 +188,11 @@ ask_yes_no_question (const UString &a_message,
 }
 
 int
-ask_yes_no_cancel_question (const common::UString &a_message)
+ask_yes_no_cancel_question (Gtk::Window &a_parent_window,
+                            const common::UString &a_message)
 {
-    Gtk::MessageDialog dialog (a_message, false,
+    Gtk::MessageDialog dialog (a_parent_window,
+                               a_message, false,
                                Gtk::MESSAGE_QUESTION,
                                Gtk::BUTTONS_NONE,
                                true);
@@ -178,12 +204,27 @@ ask_yes_no_cancel_question (const common::UString &a_message)
     return dialog.run ();
 }
 
+/// Use a dialog to interactively ask the user to select a file.
+///
+/// \param a_parent the parent window used by the (transient) dialog.
+///
+/// \param a_file_name the name of the file to ask the user help us
+/// look for.
+///
+/// \param a_default_dir the default directory from where to the user
+/// is proposed to start the search from.
+///
+/// \param a_selected_file_path the resulting absolute file path as
+/// selected by the user.  This is set iff the function returns true.
+///
+/// \return true iff the user actually selected a file.
 bool
-ask_user_to_select_file (const UString &a_file_name,
+ask_user_to_select_file (Gtk::Window &a_parent,
+                         const UString &a_file_name,
                          const UString &a_default_dir,
                          UString &a_selected_file_path)
 {
-    LocateFileDialog dialog ("", a_file_name);
+    LocateFileDialog dialog ("", a_file_name, a_parent);
     // start looking in the default directory
     dialog.file_location (a_default_dir);
     int result = dialog.run ();
@@ -205,8 +246,33 @@ ask_user_to_select_file (const UString &a_file_name,
     return false;
 }
 
+/// Find a given file from a set of directories.
+///
+/// If the file is not found, then graphically ask the user to find it
+/// instread.
+///
+/// \param a_parent_window the parent window of the dialog used to ask
+/// the user where to find the file, should the need arise.
+///
+/// \param a_file_name the file name to find.
+///
+/// \param a_where_to_look the list of directories where to look the
+/// file from.
+///
+/// \param a_session_dirs if the file was found, add its parent
+/// directory to this list.
+///
+/// \param a_ignore_paths If a file not found by this function has its
+/// name in this map, then do not ask the user to look for it.  Also,
+/// if a_ignore_if_not_found is true and if the file wasn't found
+/// this time, the a_file_name is added to this map (a_ignore_paths).
+///
+/// \param a_absolute_path the absolute path of the file found.
+///
+/// \return true iff the file was found.
 bool
-find_file_or_ask_user (const UString& a_file_name,
+find_file_or_ask_user (Gtk::Window &a_parent_window,
+                       const UString& a_file_name,
                        const list<UString> &a_where_to_look,
                        list<UString> &a_session_dirs,
                        map<UString, bool> &a_ignore_paths,
@@ -220,7 +286,8 @@ find_file_or_ask_user (const UString& a_file_name,
             // requested to *not* ask the user to locate it, just
             // pretend we didn't find the file.
             return false;
-        if (ask_user_to_select_file (a_file_name,
+        if (ask_user_to_select_file (a_parent_window,
+                                     a_file_name,
                                      a_where_to_look.front (),
                                      a_absolute_path)) {
             UString parent_dir =
@@ -242,6 +309,8 @@ find_file_or_ask_user (const UString& a_file_name,
 /// e.g. when forging a mixed source/assembly source view, and we want
 /// to display a source line N from a file P.
 ///
+/// \param a_parent_window the parent window used by the Dialog widget
+/// that we use.
 /// \param a_file_path the file path to consider. Not necessarily
 /// absolute. If the file is not found, it will be searched for very hard
 /// in many places.
@@ -257,7 +326,8 @@ find_file_or_ask_user (const UString& a_file_name,
 /// and only if the function returned true.
 /// \return true upon successful completion, false otherwise.
 bool
-find_file_and_read_line (const UString &a_file_path,
+find_file_and_read_line (Gtk::Window &a_parent_window,
+                         const UString &a_file_path,
                          const list<UString> &a_where_to_look,
                          list<UString> &a_sess_dirs,
                          map<UString, bool> &a_ignore_paths,
@@ -268,7 +338,8 @@ find_file_and_read_line (const UString &a_file_path,
         return false;
 
     UString path;
-    if (!find_file_or_ask_user (a_file_path,
+    if (!find_file_or_ask_user (a_parent_window,
+                                a_file_path,
                                 a_where_to_look,
                                 a_sess_dirs,
                                 a_ignore_paths,
diff --git a/src/uicommon/nmv-ui-utils.h b/src/uicommon/nmv-ui-utils.h
index 5a00d1c..cda5840 100644
--- a/src/uicommon/nmv-ui-utils.h
+++ b/src/uicommon/nmv-ui-utils.h
@@ -38,13 +38,13 @@
 #define NEMIVER_CATCH \
 } catch (Glib::Exception &e) { \
     LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
-    nemiver::ui_utils::display_error (e.what ()); \
+    nemiver::ui_utils::display_error_not_transient (e.what ()); \
 } catch (std::exception &e) { \
     LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
-    nemiver::ui_utils::display_error (e.what ()); \
+    nemiver::ui_utils::display_error_not_transient (e.what ()); \
 } catch (...) { \
     LOG_ERROR ("caught unknown exception"); \
-    nemiver::ui_utils::display_error ("An unknown error occured"); \
+    nemiver::ui_utils::display_error_not_transient ("An unknown error occured"); \
 }
 #endif
 
@@ -52,15 +52,15 @@
 #define NEMIVER_CATCH_AND_RETURN(a_value) \
 } catch (Glib::Exception &e) { \
     LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
-    nemiver::ui_utils::display_error (e.what ()); \
+    nemiver::ui_utils::display_error_not_transient (e.what ()); \
     return a_value; \
 } catch (std::exception &e) { \
     LOG_ERROR (std::string ("caught exception: '") + e.what () + "'"); \
-    nemiver::ui_utils::display_error (e.what ()); \
+    nemiver::ui_utils::display_error_not_transient (e.what ()); \
     return a_value; \
 } catch (...) { \
     LOG_ERROR ("Caught unknown exception"); \
-    nemiver::ui_utils::display_error ("An unknown error occured"); \
+    nemiver::ui_utils::display_error_not_transient ("An unknown error occured"); \
     return a_value; \
 }
 #endif
@@ -130,25 +130,35 @@ NEMIVER_API void add_action_entries_to_action_group
                                  int a_num_entries,
                                  Glib::RefPtr<Gtk::ActionGroup> &a_group);
 
-NEMIVER_API int display_info (const common::UString &a_message);
+NEMIVER_API int display_info (Gtk::Window &a_parent_window,
+                              const common::UString &a_message);
 
-NEMIVER_API int display_warning (const common::UString &a_message);
+NEMIVER_API int display_warning (Gtk::Window &a_parent_window,
+                                 const common::UString &a_message);
 
-NEMIVER_API int display_error (const common::UString &a_message);
+NEMIVER_API int display_error (Gtk::Window &a_parent_window,
+                               const common::UString &a_message);
 
-NEMIVER_API int ask_yes_no_question (const common::UString &a_message);
+NEMIVER_API int display_error_not_transient (const UString &a_message);
 
-NEMIVER_API int ask_yes_no_question (const common::UString &a_message,
+NEMIVER_API int ask_yes_no_question (Gtk::Window &a_parent_window,
+                                     const common::UString &a_message);
+
+NEMIVER_API int ask_yes_no_question (Gtk::Window &a_parent_window,
+                                     const common::UString &a_message,
                                      bool a_propose_dont_ask_question,
                                      bool &a_dont_ask_this_again);
 
-NEMIVER_API int ask_yes_no_cancel_question (const common::UString &a_message);
+NEMIVER_API int ask_yes_no_cancel_question (Gtk::Window &a_parent_window,
+                                            const common::UString &a_message);
 
-NEMIVER_API bool ask_user_to_select_file (const UString &a_file_name,
+NEMIVER_API bool ask_user_to_select_file (Gtk::Window &a_parent,
+                                          const UString &a_file_name,
                                           const UString &a_default_dir,
                                           UString &a_selected_file_path);
 
-NEMIVER_API bool find_file_or_ask_user (const UString& a_file_path,
+NEMIVER_API bool find_file_or_ask_user (Gtk::Window &a_parent_window,
+                                        const UString& a_file_path,
                                         const list<UString> &a_where_to_look,
                                         list<UString> &a_session_dirs,
                                         map<UString, bool> &a_ignore_paths,
@@ -156,7 +166,8 @@ NEMIVER_API bool find_file_or_ask_user (const UString& a_file_path,
                                         UString& a_absolute_path);
 
 
-bool find_file_and_read_line (const UString &a_file_path,
+bool find_file_and_read_line (Gtk::Window &a_parent_window,
+                              const UString &a_file_path,
                               const list<UString> &a_where_to_look,
                               list<UString> &a_sess_dirs,
                               map<UString, bool> &a_ignore_paths,
-- 
                Dodji



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