From f12dc45c8b5139c0415a240c23bbc980f252a866 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Wed, 20 Jun 2018 23:41:20 +0200
Subject: Set all dialog windows transient for the main window.

---
 src/gui/dialogs/about.c     | 6 ++++--
 src/gui/dialogs/bookmark.c  | 3 ++-
 src/gui/dialogs/export.c    | 2 +-
 src/gui/dialogs/goto.c      | 3 ++-
 src/gui/dialogs/gotox.c     | 4 +++-
 src/gui/dialogs/plugins.c   | 6 ++++--
 src/gui/dialogs/shellcode.c | 2 +-
 src/gui/dialogs/storage.c   | 2 +-
 8 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/gui/dialogs/about.c b/src/gui/dialogs/about.c
index 0acba30..e244093 100644
--- a/src/gui/dialogs/about.c
+++ b/src/gui/dialogs/about.c
@@ -72,13 +72,15 @@ GtkWidget *create_about_dialog(GtkWindow *parent)
     GtkWidget *label;                       /* Etiquette inférieure        */
 
     result = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW(result), _("About"));
     gtk_widget_set_size_request(result, 350, 430);
     gtk_container_set_border_width(GTK_CONTAINER(result), 0);
-    gtk_window_set_title(GTK_WINDOW(result), _("About"));
-    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
     gtk_window_set_default_size(GTK_WINDOW(result), 350, 430);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
     g_signal_connect(result, "key_press_event", G_CALLBACK(close_about_window_on_escape), NULL);
 
     fixed = gtk_fixed_new();
diff --git a/src/gui/dialogs/bookmark.c b/src/gui/dialogs/bookmark.c
index c14ec15..b10a601 100644
--- a/src/gui/dialogs/bookmark.c
+++ b/src/gui/dialogs/bookmark.c
@@ -159,9 +159,10 @@ GtkWidget *create_bookmark_dialog(GtkWindow *parent, const vmpa2t *addr)
     result = gtk_dialog_new();
     gtk_window_set_title(GTK_WINDOW(result), _("Add a bookmark"));
     gtk_window_set_position(GTK_WINDOW(result), GTK_WIN_POS_CENTER);
-    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
     dlgvbox = gtk_dialog_get_content_area(GTK_DIALOG(result));
     gtk_widget_show(dlgvbox);
 
diff --git a/src/gui/dialogs/export.c b/src/gui/dialogs/export.c
index c410882..5a66d02 100644
--- a/src/gui/dialogs/export.c
+++ b/src/gui/dialogs/export.c
@@ -116,9 +116,9 @@ void run_export_assistant(GLoadedBinary *binary, GtkWindow *parent)
     GObject *ref;                           /* Espace de référencement     */
 
     assistant = gtk_assistant_new();
+    gtk_window_set_title(GTK_WINDOW(assistant), _("Export assistant"));
     gtk_widget_set_size_request(assistant, 500, 350);
     gtk_window_set_position(GTK_WINDOW(assistant), GTK_WIN_POS_CENTER);
-    gtk_window_set_title(GTK_WINDOW(assistant), _("Export assistant"));
 
     gtk_window_set_modal(GTK_WINDOW(assistant), TRUE);
     gtk_window_set_transient_for(GTK_WINDOW(assistant), parent);
diff --git a/src/gui/dialogs/goto.c b/src/gui/dialogs/goto.c
index 6f659d5..1fe2bbd 100644
--- a/src/gui/dialogs/goto.c
+++ b/src/gui/dialogs/goto.c
@@ -154,9 +154,10 @@ GtkWidget *create_goto_dialog(GtkWindow *parent)
     result = gtk_dialog_new();
     gtk_window_set_title(GTK_WINDOW(result), _("Go to address"));
     gtk_window_set_position(GTK_WINDOW(result), GTK_WIN_POS_CENTER);
-    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
     dlgvbox = gtk_dialog_get_content_area(GTK_DIALOG(result));
     gtk_widget_show(dlgvbox);
 
diff --git a/src/gui/dialogs/gotox.c b/src/gui/dialogs/gotox.c
index d9a9979..f28654d 100644
--- a/src/gui/dialogs/gotox.c
+++ b/src/gui/dialogs/gotox.c
@@ -113,9 +113,11 @@ static GtkWidget *create_gotox_dialog(GtkWindow *parent, GtkTreeStore **store)
     result = gtk_dialog_new();
     gtk_window_set_default_size(GTK_WINDOW(result), 600, 350);
     gtk_window_set_position(GTK_WINDOW(result), GTK_WIN_POS_CENTER);
-    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
     dlgvbox = gtk_dialog_get_content_area(GTK_DIALOG(result));
     gtk_widget_show(dlgvbox);
 
diff --git a/src/gui/dialogs/plugins.c b/src/gui/dialogs/plugins.c
index 4bcf274..008d88e 100644
--- a/src/gui/dialogs/plugins.c
+++ b/src/gui/dialogs/plugins.c
@@ -100,13 +100,15 @@ GtkWidget *create_plugins_selection_dialog(GLoadedBinary *binary, GtkWindow *par
     GtkWidget *label2;
 
     result = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_window_set_title(GTK_WINDOW(result), _("Plugins selection"));
     gtk_widget_set_size_request(result, 600, 400);
     gtk_container_set_border_width(GTK_CONTAINER(result), 8);
-    gtk_window_set_title(GTK_WINDOW(result), _("Plugins selection"));
-    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
     gtk_window_set_default_size(GTK_WINDOW(result), 600, 400);
     gtk_window_set_type_hint(GTK_WINDOW(result), GDK_WINDOW_TYPE_HINT_DIALOG);
 
+    gtk_window_set_modal(GTK_WINDOW(result), TRUE);
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+
     ref= G_OBJECT(result);
     g_object_set_data(ref, "binary", binary);
 
diff --git a/src/gui/dialogs/shellcode.c b/src/gui/dialogs/shellcode.c
index 94ae269..f4b0892 100644
--- a/src/gui/dialogs/shellcode.c
+++ b/src/gui/dialogs/shellcode.c
@@ -126,9 +126,9 @@ void run_shellcode_assistant(GStudyProject *project, GtkWindow *parent)
     GObject *ref;                           /* Espace de référencement     */
 
     assistant = gtk_assistant_new();
+    gtk_window_set_title(GTK_WINDOW(assistant), _("Shellcode assistant"));
     gtk_widget_set_size_request(assistant, 450, 300);
     gtk_window_set_position(GTK_WINDOW(assistant), GTK_WIN_POS_CENTER);
-    gtk_window_set_title(GTK_WINDOW(assistant), _("Shellcode assistant"));
 
     gtk_window_set_modal(GTK_WINDOW(assistant), TRUE);
     gtk_window_set_transient_for(GTK_WINDOW(assistant), parent);
diff --git a/src/gui/dialogs/storage.c b/src/gui/dialogs/storage.c
index d51c4e6..46ef675 100644
--- a/src/gui/dialogs/storage.c
+++ b/src/gui/dialogs/storage.c
@@ -64,7 +64,7 @@ GtkWidget *create_storage_dialog(GLoadedBinary *binary, GtkWindow *parent, GtkBu
 
     result = GTK_WIDGET(gtk_builder_get_object(builder, "window"));
 
-    //gtk_window_set_transient_for(GTK_WINDOW(result), parent);
+    gtk_window_set_transient_for(GTK_WINDOW(result), parent);
 
     /* Mise à jour de l'interface */
 
-- 
cgit v0.11.2-87-g4458