summaryrefslogtreecommitdiff
path: root/src/gui/panels/bintree.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/panels/bintree.c')
-rw-r--r--src/gui/panels/bintree.c63
1 files changed, 31 insertions, 32 deletions
diff --git a/src/gui/panels/bintree.c b/src/gui/panels/bintree.c
index 89e2ae1..c2caef7 100644
--- a/src/gui/panels/bintree.c
+++ b/src/gui/panels/bintree.c
@@ -53,8 +53,6 @@ struct _GBintreePanel
{
GPanelItem parent; /* A laisser en premier */
- GtkBuilder *builder; /* Constructeur utilisé */
-
GLoadedBinary *binary; /* Binaire représenté */
regex_t *filter; /* Filtre appliqué ou NULL */
@@ -168,6 +166,7 @@ static void g_bintree_panel_init(GBintreePanel *panel)
{
GEditorItem *base; /* Version basique d'instance */
GPanelItem *pitem; /* Version parente du panneau */
+ GtkBuilder *builder; /* Constructeur utilisé */
GtkTreeView *treeview; /* Affichage de la liste */
GtkCellRenderer *renderer; /* Moteur de rendu de colonne */
GtkTreeViewColumn *column; /* Colonne de la liste */
@@ -194,15 +193,11 @@ static void g_bintree_panel_init(GBintreePanel *panel)
/* Représentation graphique */
- panel->builder = gtk_builder_new_from_resource("/org/chrysalide/gui/panels/bintree.ui");
-
- base->widget = GTK_WIDGET(gtk_builder_get_object(panel->builder, "box"));
- g_object_ref(G_OBJECT(base->widget));
- gtk_widget_unparent(base->widget);
+ builder = g_panel_item_build(pitem, "bintree");
/* Liste des portions binaires */
- treeview = GTK_TREE_VIEW(gtk_builder_get_object(panel->builder, "treeview"));
+ treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview"));
column = gtk_tree_view_column_new();
gtk_tree_view_append_column(treeview, column);
@@ -241,7 +236,7 @@ static void g_bintree_panel_init(GBintreePanel *panel)
/* Connexion des signaux */
- gtk_builder_add_callback_symbols(panel->builder,
+ gtk_builder_add_callback_symbols(builder,
"gtk_tree_view_collapse_all", G_CALLBACK(gtk_tree_view_collapse_all),
"gtk_tree_view_expand_all", G_CALLBACK(gtk_tree_view_expand_all),
"on_depth_spin_value_changed", G_CALLBACK(on_depth_spin_value_changed),
@@ -249,7 +244,7 @@ static void g_bintree_panel_init(GBintreePanel *panel)
"on_bintree_selection_changed", G_CALLBACK(on_bintree_selection_changed),
NULL);
- gtk_builder_connect_signals(panel->builder, panel);
+ gtk_builder_connect_signals(builder, panel);
}
@@ -268,8 +263,6 @@ static void g_bintree_panel_init(GBintreePanel *panel)
static void g_bintree_panel_dispose(GBintreePanel *panel)
{
- g_object_unref(G_OBJECT(panel->builder));
-
if (panel->binary != NULL)
g_object_unref(G_OBJECT(panel->binary));
@@ -343,22 +336,23 @@ GPanelItem *g_bintree_panel_new(void)
static bool populate_tree_with_portion(GBinPortion *portion, GBinPortion *parent, BinaryPortionVisit visit, GBintreePanel *panel)
{
- const char *desc; /* Description d'origine */
- bool fmatched; /* Correspondance rencontrée ? */
- regmatch_t match; /* Position d'un filtre */
- char *node_caption; /* Etiquette de nouveau noeud */
- const mrange_t *range; /* Espace de portion à traiter */
- VMPA_BUFFER(offset); /* Décalage physique */
- char *node_start; /* Position pour nouveau noeud */
- vmpa2t end; /* Zone de construction temp. */
- char *node_end; /* Bordure pour nouveau noeud */
- PortionAccessRights rights; /* Droits d'accès à analyser */
- char hrights[4]; /* Version humainement lisible */
- char *node_rights; /* Droits pour nouveau noeud */
- cairo_surface_t *icon; /* Miniature de décoration */
- GtkTreeStore *store; /* Modèle de gestion */
- GtkTreeIter iter; /* Point d'insertion */
- GtkTreeIter *save; /* Sauvegarde d'une position */
+ const char *desc; /* Description d'origine */
+ bool fmatched; /* Correspondance rencontrée ? */
+ regmatch_t match; /* Position d'un filtre */
+ char *node_caption; /* Etiquette de nouveau noeud */
+ const mrange_t *range; /* Espace de portion à traiter */
+ VMPA_BUFFER(offset); /* Décalage physique */
+ char *node_start; /* Position pour nouveau noeud */
+ vmpa2t end; /* Zone de construction temp. */
+ char *node_end; /* Bordure pour nouveau noeud */
+ PortionAccessRights rights; /* Droits d'accès à analyser */
+ char hrights[4]; /* Version humainement lisible */
+ char *node_rights; /* Droits pour nouveau noeud */
+ cairo_surface_t *icon; /* Miniature de décoration */
+ GtkBuilder *builder; /* Constructeur utilisé */
+ GtkTreeStore *store; /* Modèle de gestion */
+ GtkTreeIter iter; /* Point d'insertion */
+ GtkTreeIter *save; /* Sauvegarde d'une position */
if (parent == NULL)
return true;
@@ -408,7 +402,9 @@ static bool populate_tree_with_portion(GBinPortion *portion, GBinPortion *parent
icon = NULL;
- store = GTK_TREE_STORE(gtk_builder_get_object(panel->builder, "store"));
+ builder = G_PANEL_ITEM(panel)->builder;
+
+ store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store"));
gtk_tree_store_append(store, &iter, panel->top);
@@ -474,6 +470,7 @@ static bool populate_tree_with_portion(GBinPortion *portion, GBinPortion *parent
static void update_panel_with_binary_portions(GBintreePanel *panel, GLoadedBinary *binary)
{
+ GtkBuilder *builder; /* Constructeur utilisé */
GtkTreeStore *store; /* Modèle de gestion */
GExeFormat *format; /* Format du binaire */
GBinPortion *portions; /* Couche première de portions */
@@ -489,7 +486,9 @@ static void update_panel_with_binary_portions(GBintreePanel *panel, GLoadedBinar
panel->binary = binary;
- store = GTK_TREE_STORE(gtk_builder_get_object(panel->builder, "store"));
+ builder = G_PANEL_ITEM(panel)->builder;
+
+ store = GTK_TREE_STORE(gtk_builder_get_object(builder, "store"));
gtk_tree_store_clear(store);
@@ -538,13 +537,13 @@ static void update_panel_with_binary_portions(GBintreePanel *panel, GLoadedBinar
gtk_tree_model_foreach(GTK_TREE_MODEL(store), (GtkTreeModelForeachFunc)compute_max_depth, &max_depth);
- depth_spin = GTK_SPIN_BUTTON(gtk_builder_get_object(panel->builder, "depth_spin"));
+ depth_spin = GTK_SPIN_BUTTON(gtk_builder_get_object(builder, "depth_spin"));
gtk_spin_button_set_range(depth_spin, 0, max_depth);
/* Restauration au mieux de l'affichage */
- treeview = GTK_TREE_VIEW(gtk_builder_get_object(panel->builder, "treeview"));
+ treeview = GTK_TREE_VIEW(gtk_builder_get_object(builder, "treeview"));
switch (panel->last)
{