diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dialogs/gotox.c | 36 | 
1 files changed, 36 insertions, 0 deletions
| 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;  } | 
