From a781eff1a2ac805eeeb93a9ed254edd3decb1024 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 10 Mar 2015 06:29:43 +0000
Subject: Offered more interactivity from the navigation dialog box.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@486 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog           |  5 +++++
 src/dialogs/gotox.c | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index afcedc4..2fa7fc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 15-03-10  Cyrille Bagard <nocbos@gmail.com>
 
+	* src/dialogs/gotox.c:
+	Offer more interactivity from the navigation dialog box.
+
+15-03-10  Cyrille Bagard <nocbos@gmail.com>
+
 	* src/gui/menus/edition.c:
 	Fix a bug when tracking cross references from a line with an empty size.
 
diff --git a/src/dialogs/gotox.c b/src/dialogs/gotox.c
index 01d18f8..fdf5e2a 100644
--- a/src/dialogs/gotox.c
+++ b/src/dialogs/gotox.c
@@ -52,6 +52,9 @@ typedef enum _GotoXColumn
 } GotoXColumn;
 
 
+/* Réagit à une validation d'une ligne affichée. */
+static void on_gotox_row_activated(GtkTreeView *, GtkTreePath *, GtkTreeViewColumn *, GtkDialog *);
+
 /* Construit la fenêtre de sélection d'adresses. */
 static GtkWidget *create_gotox_dialog(GtkWindow *, GtkTreeStore **);
 
@@ -62,6 +65,28 @@ static void add_new_location_to_list(GtkTreeStore *, GLoadedBinary *, const vmpa
 
 /******************************************************************************
 *                                                                             *
+*  Paramètres  : treeview = composant graphique manipulé par l'utilisateur.   *
+*                path     = chemin d'accès à la ligne activée.                *
+*                column   = colonne impactée par l'action.                    *
+*                dialog   = boîte de dialogue affichant la liste éditée.      *
+*                                                                             *
+*  Description : Réagit à une validation d'une ligne affichée.                *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void on_gotox_row_activated(GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, GtkDialog *dialog)
+{
+    gtk_dialog_response(dialog, GTK_RESPONSE_OK);
+
+}
+
+
+/******************************************************************************
+*                                                                             *
 *  Paramètres  : parent = fenêtre parente à surpasser.                        *
 *                store  = modèle de gestion pour les éléments de liste. [OUT] *
 *                                                                             *
@@ -115,6 +140,8 @@ static GtkWidget *create_gotox_dialog(GtkWindow *parent, GtkTreeStore **store)
     gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(treeview), TRUE);
     gtk_tree_view_set_enable_tree_lines(GTK_TREE_VIEW(treeview), TRUE);
 
+    g_signal_connect(treeview, "row-activated", G_CALLBACK(on_gotox_row_activated), result);
+
     g_object_set_data(G_OBJECT(result), "treeview", treeview);
 
     gtk_widget_show(treeview);
@@ -187,6 +214,7 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary
     GBinFormat *format;                     /* Format associé au binaire   */
     GBinSymbol **symbols;                   /* Symboles à représenter      */
     size_t sym_count;                       /* Qté de symboles présents    */
+    bool has_entry_points;                  /* Présences d'insertions ?    */
     size_t i;                               /* Boucle de parcours          */
     vmpa2t addr;                            /* Localisation de symbole     */
 
@@ -202,6 +230,8 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary
 
     symbols = g_binary_format_get_symbols(format, &sym_count);
 
+    has_entry_points = false;
+
     for (i = 0; i < sym_count; i++)
     {
         if (g_binary_symbol_get_target_type(symbols[i]) != STP_ENTRY_POINT)
@@ -211,10 +241,14 @@ GtkWidget *create_gotox_dialog_for_entry_points(GtkWindow *parent, GLoadedBinary
 
         add_new_location_to_list(store, binary, &addr, symbols[i]);
 
+        has_entry_points = true;
+
     }
 
     g_object_unref(G_OBJECT(store));
 
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(result), GTK_RESPONSE_OK, has_entry_points);
+
     return result;
 
 }
@@ -270,6 +304,8 @@ GtkWidget *create_gotox_dialog_for_cross_references(GtkWindow *parent, GLoadedBi
 
     g_object_unref(G_OBJECT(store));
 
+    gtk_dialog_set_response_sensitive(GTK_DIALOG(result), GTK_RESPONSE_OK, count > 0);
+
     return result;
 
 }
-- 
cgit v0.11.2-87-g4458