summaryrefslogtreecommitdiff
path: root/src/glibext/gbinportion.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-04-09 07:52:59 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-04-09 07:59:29 (GMT)
commitacc7b5f33e93bae3bf43e8f029976b7f74260b52 (patch)
treec0ea91ef69efb8300e97dacb65b3eeebd95f112a /src/glibext/gbinportion.c
parentebe248fe406de9565c8c7787187a1d439e68cd84 (diff)
Provided a tree panel to inspect binary content.
Diffstat (limited to 'src/glibext/gbinportion.c')
-rw-r--r--src/glibext/gbinportion.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/glibext/gbinportion.c b/src/glibext/gbinportion.c
index caaec43..b94b0f6 100644
--- a/src/glibext/gbinportion.c
+++ b/src/glibext/gbinportion.c
@@ -51,6 +51,8 @@ struct _GBinPortion
char *code; /* Code de la couleur de fond */
+ cairo_surface_t *icon; /* Image de représentation */
+
char *desc; /* Désignation humaine */
char **text; /* Lignes brutes à représenter */
size_t lcount; /* Quantité de ces lignes */
@@ -239,6 +241,9 @@ static void g_binary_portion_finalize(GBinPortion *portion)
free(portion->code);
+ if (portion->icon != NULL)
+ cairo_surface_destroy(portion->icon);
+
if (portion->desc != NULL)
free(portion->desc);
@@ -314,6 +319,56 @@ int g_binary_portion_compare(const GBinPortion **a, const GBinPortion **b)
/******************************************************************************
* *
* Paramètres : portion = description de partie à mettre à jour. *
+* icon = image miniature de représentation à associer. *
+* *
+* Description : Attribue à la portion une éventuelle image de représentation.*
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+void g_binary_portion_set_icon(GBinPortion *portion, cairo_surface_t *icon)
+{
+ if (icon != NULL)
+ portion->icon = cairo_surface_reference(icon);
+
+ else
+ portion->icon = NULL;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : portion = description de partie à consulter. *
+* *
+* Description : Fournit une éventuelle image de représentation de portion. *
+* *
+* Retour : Image miniature de représentation associée. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+cairo_surface_t *g_binary_portion_get_icon(const GBinPortion *portion)
+{
+ cairo_surface_t *result;
+
+ result = portion->icon;
+
+ if (result != NULL)
+ cairo_surface_reference(result);
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : portion = description de partie à mettre à jour. *
* desc = nom à donner à la partie. *
* *
* Description : Attribue une description humaine à une partie de code. *