feat(gui): display selected node path
This commit is contained in:
parent
68a624f398
commit
4ce822ee70
3 changed files with 225 additions and 0 deletions
196
docs/tickets/closed/TICKET-018.md
Normal file
196
docs/tickets/closed/TICKET-018.md
Normal file
|
|
@ -0,0 +1,196 @@
|
|||
# Ticket #018
|
||||
|
||||
## Titre
|
||||
|
||||
Afficher le chemin complet du nœud sélectionné dans le Workspace.
|
||||
|
||||
---
|
||||
|
||||
## Objectif
|
||||
|
||||
Afficher le chemin complet du fichier ou du dossier actuellement sélectionné.
|
||||
|
||||
Le `Workspace` doit utiliser exclusivement le getter :
|
||||
|
||||
```c
|
||||
investigation_node_get_path()
|
||||
```
|
||||
|
||||
Aucune reconstruction du chemin ne doit être réalisée dans la couche graphique.
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
```text
|
||||
InvestigationNode
|
||||
│
|
||||
▼
|
||||
Application
|
||||
│
|
||||
▼
|
||||
MainWindow
|
||||
│
|
||||
▼
|
||||
Workspace
|
||||
```
|
||||
|
||||
Le Core reste propriétaire des informations.
|
||||
|
||||
Le `Workspace` les affiche uniquement.
|
||||
|
||||
---
|
||||
|
||||
## Responsabilités
|
||||
|
||||
### InvestigationNode
|
||||
|
||||
Aucune modification.
|
||||
|
||||
### Application
|
||||
|
||||
Aucune modification.
|
||||
|
||||
### MainWindow
|
||||
|
||||
Aucune modification.
|
||||
|
||||
### Workspace
|
||||
|
||||
Le module doit :
|
||||
|
||||
- afficher le chemin complet du nœud sélectionné ;
|
||||
- masquer cette information lorsqu'aucun nœud n'est sélectionné.
|
||||
|
||||
---
|
||||
|
||||
## Fichiers concernés
|
||||
|
||||
```text
|
||||
src/widgets/workspace.c
|
||||
```
|
||||
|
||||
Aucune modification du Core.
|
||||
|
||||
---
|
||||
|
||||
## Interface publique
|
||||
|
||||
Aucune modification.
|
||||
|
||||
L'API du `Workspace` reste inchangée.
|
||||
|
||||
---
|
||||
|
||||
## Affichage attendu
|
||||
|
||||
### Dossier
|
||||
|
||||
```text
|
||||
00_BaseDeDonnees
|
||||
|
||||
Chemin :
|
||||
/home/fy59/Documents/Enquetes/Test/00_BaseDeDonnees
|
||||
|
||||
Type :
|
||||
Dossier
|
||||
|
||||
Parent :
|
||||
Template
|
||||
|
||||
Enfants :
|
||||
2
|
||||
```
|
||||
|
||||
### Fichier
|
||||
|
||||
```text
|
||||
Enquete.sqlite
|
||||
|
||||
Chemin :
|
||||
/home/fy59/Documents/Enquetes/Test/00_BaseDeDonnees/Enquete.sqlite
|
||||
|
||||
Type :
|
||||
Fichier
|
||||
|
||||
Parent :
|
||||
00_BaseDeDonnees
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Comportement attendu
|
||||
|
||||
Le chemin affiché doit toujours être identique à :
|
||||
|
||||
```c
|
||||
investigation_node_get_path(node)
|
||||
```
|
||||
|
||||
Le `Workspace` ne doit jamais construire lui-même :
|
||||
|
||||
```text
|
||||
parent + "/" + nom
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Hors périmètre
|
||||
|
||||
Ce ticket ne doit pas :
|
||||
|
||||
- ouvrir le fichier ;
|
||||
- vérifier que le chemin existe encore ;
|
||||
- afficher la taille ;
|
||||
- afficher les permissions ;
|
||||
- afficher la date de modification ;
|
||||
- ouvrir le gestionnaire de fichiers.
|
||||
|
||||
---
|
||||
|
||||
## Contraintes techniques
|
||||
|
||||
- GTK4 uniquement ;
|
||||
- aucun état global ;
|
||||
- aucune allocation mémoire supplémentaire pour le chemin ;
|
||||
- utiliser directement le pointeur retourné par
|
||||
`investigation_node_get_path()`;
|
||||
- documentation Doxygen ;
|
||||
- compilation sans warning.
|
||||
|
||||
---
|
||||
|
||||
## Critères d'acceptation
|
||||
|
||||
- [ ] Le projet compile sans warning.
|
||||
- [ ] `make test` reste valide.
|
||||
- [ ] Le chemin du dossier est affiché.
|
||||
- [ ] Le chemin du fichier est affiché.
|
||||
- [ ] La page d'accueil reste inchangée.
|
||||
- [ ] Aucun chemin n'est reconstruit dans la GUI.
|
||||
- [ ] Aucun `Gtk-CRITICAL`.
|
||||
|
||||
---
|
||||
|
||||
## Tests
|
||||
|
||||
1. Lancer l'application.
|
||||
2. Sélectionner un dossier.
|
||||
3. Vérifier le chemin affiché.
|
||||
4. Sélectionner un fichier.
|
||||
5. Vérifier le chemin affiché.
|
||||
6. Comparer avec :
|
||||
|
||||
```c
|
||||
investigation_node_get_path(node)
|
||||
```
|
||||
|
||||
7. Vérifier que `make test` reste valide.
|
||||
|
||||
---
|
||||
|
||||
## Commit attendu
|
||||
|
||||
```text
|
||||
feat(gui): display selected node path
|
||||
```
|
||||
Binary file not shown.
|
|
@ -26,6 +26,7 @@ struct Workspace
|
|||
|
||||
GtkWidget *node_page;
|
||||
GtkWidget *node_name_label;
|
||||
GtkWidget *node_path_label;
|
||||
GtkWidget *node_type_label;
|
||||
GtkWidget *node_parent_label;
|
||||
GtkWidget *node_children_label;
|
||||
|
|
@ -181,6 +182,7 @@ Workspace *workspace_new(void)
|
|||
);
|
||||
|
||||
workspace->node_name_label = gtk_label_new(NULL);
|
||||
workspace->node_path_label = gtk_label_new(NULL);
|
||||
workspace->node_type_label = gtk_label_new(NULL);
|
||||
workspace->node_parent_label = gtk_label_new(NULL);
|
||||
workspace->node_children_label = gtk_label_new(NULL);
|
||||
|
|
@ -190,6 +192,26 @@ Workspace *workspace_new(void)
|
|||
workspace->node_name_label
|
||||
);
|
||||
|
||||
gtk_box_append(
|
||||
GTK_BOX(workspace->node_page),
|
||||
workspace->node_path_label
|
||||
);
|
||||
|
||||
gtk_label_set_wrap(
|
||||
GTK_LABEL(workspace->node_path_label),
|
||||
TRUE
|
||||
);
|
||||
|
||||
gtk_label_set_selectable(
|
||||
GTK_LABEL(workspace->node_path_label),
|
||||
TRUE
|
||||
);
|
||||
|
||||
gtk_widget_set_halign(
|
||||
workspace->node_path_label,
|
||||
GTK_ALIGN_CENTER
|
||||
);
|
||||
|
||||
gtk_box_append(
|
||||
GTK_BOX(workspace->node_page),
|
||||
workspace->node_type_label
|
||||
|
|
@ -236,6 +258,7 @@ void workspace_set_selected_node(
|
|||
const char *node_name = NULL;
|
||||
const InvestigationNode *parent_node = NULL;
|
||||
const char *parent_name = NULL;
|
||||
const char *node_path = NULL;
|
||||
InvestigationNodeType node_type;
|
||||
size_t children_count = 0;
|
||||
|
||||
|
|
@ -255,6 +278,7 @@ void workspace_set_selected_node(
|
|||
}
|
||||
|
||||
node_name = investigation_node_get_name(node);
|
||||
node_path = investigation_node_get_path(node);
|
||||
node_type = investigation_node_get_type(node);
|
||||
parent_node = investigation_node_get_parent(node);
|
||||
|
||||
|
|
@ -263,6 +287,11 @@ void workspace_set_selected_node(
|
|||
node_name != NULL ? node_name : "(sans nom)"
|
||||
);
|
||||
|
||||
gtk_label_set_text(
|
||||
GTK_LABEL(workspace->node_path_label),
|
||||
node_path != NULL ? node_path : "(chemin indisponible)"
|
||||
);
|
||||
|
||||
if (node_type == INVESTIGATION_NODE_DIRECTORY)
|
||||
{
|
||||
type_text = "Type : dossier";
|
||||
|
|
|
|||
Loading…
Reference in a new issue