summaryrefslogtreecommitdiff
path: root/src/gui/panels/updating.h
blob: 8c44795a154bc169c9a3b127d2f759d448439bc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124

/* Chrysalide - Outil d'analyse de fichiers binaires
 * updating.h - prototypes pour la mise à jour des panneaux de l'interface
 *
 * Copyright (C) 2018 Cyrille Bagard
 *
 *  This file is part of Chrysalide.
 *
 *  Chrysalide is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Chrysalide is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Chrysalide.  If not, see <http://www.gnu.org/licenses/>.
 */


#ifndef _GUI_PANELS_UPDATING_H
#define _GUI_PANELS_UPDATING_H


#include <glib-object.h>
#include <stdbool.h>
#include <gtk/gtk.h>


#include "../../gtkext/gtkstatusstack.h"



/* ---------------------- MECANISMES DE MISE A JOUR DE PANNEAU ---------------------- */


#define G_TYPE_UPDATABLE_PANEL             (g_updatable_panel_get_type())
#define G_UPDATABLE_PANEL(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_UPDATABLE_PANEL, GUpdatablePanel))
#define G_UPDATABLE_PANEL_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_UPDATABLE_PANEL, GUpdatablePanelIface))
#define G_IS_UPDATABLE_PANEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_UPDATABLE_PANEL))
#define G_IS_UPDATABLE_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_UPDATABLE_PANEL))
#define G_UPDATABLE_PANEL_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_UPDATABLE_PANEL, GUpdatablePanelIface))


/* Mécanisme de mise à jour d'un panneau (coquille vide) */
typedef struct _GUpdatablePanel GUpdatablePanel;

/* Mécanisme de mise à jour d'un panneau (interface) */
typedef struct _GUpdatablePanelIface GUpdatablePanelIface;


/* Détermine le type d'une interface pour la mise à jour de panneau. */
GType g_updatable_panel_get_type(void) G_GNUC_CONST;

/* Prépare une opération de mise à jour de panneau. */
const char *g_updatable_panel_setup(const GUpdatablePanel *, unsigned int, size_t *, void **);

/* Obtient le groupe de travail dédié à une mise à jour. */
wgroup_id_t g_updatable_panel_get_group(const GUpdatablePanel *);

/* Bascule l'affichage d'un panneau avant mise à jour. */
void g_updatable_panel_introduce(const GUpdatablePanel *, unsigned int, void *);

/* Réalise une opération de mise à jour de panneau. */
void g_updatable_panel_process(const GUpdatablePanel *, unsigned int, GtkStatusStack *, activity_id_t, void *);

/* Bascule l'affichage d'un panneau après mise à jour. */
void g_updatable_panel_conclude(GUpdatablePanel *, unsigned int, void *);

/* Supprime les données dynamiques utilisées à la mise à jour. */
void g_updatable_panel_clean_data(GUpdatablePanel *, unsigned int, void *);



/* ---------------------------- AIDE POUR LA MISE A JOUR ---------------------------- */


#define G_TYPE_PANEL_UPDATE            g_panel_update_get_type()
#define G_PANEL_UPDATE(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_PANEL_UPDATE, GPanelUpdate))
#define G_IS_PANEL_UPDATE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_PANEL_UPDATE))
#define G_PANEL_UPDATE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PANEL_UPDATE, GPanelUpdateClass))
#define G_IS_PANEL_UPDATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PANEL_UPDATE))
#define G_PANEL_UPDATE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PANEL_UPDATE, GPanelUpdateClass))


/* Procédure de mise à jour de panneau graphique (instance) */
typedef struct _GPanelUpdate GPanelUpdate;

/* Procédure de mise à jour de panneau graphique (classe) */
typedef struct _GPanelUpdateClass GPanelUpdateClass;


/* Indique le type défini pour les tâches de mise à jour de panneau. */
GType g_panel_update_get_type(void);

/* Crée une tâche de mise à jour non bloquante. */
GPanelUpdate *g_panel_update_new(GUpdatablePanel *, unsigned int);



/* -------------------------- ENCAPSULATION DE HAUT NIVEAU -------------------------- */


/* Identifiants arbitraires pour distinguer les phases */
typedef enum _PanelUpdateID
{
    PUI_0,                                  /* Phase #0                    */
    PUI_1,                                  /* Phase #1                    */
    PUI_2,                                  /* Phase #2                    */
    PUI_3,                                  /* Phase #3                    */
    PUI_4                                   /* Phase #4                    */

} PanelUpdateID;


/* Prépare et lance l'actualisation d'un panneau. */
void run_panel_update(GUpdatablePanel *, unsigned int);



#endif  /* _GUI_PANELS_UPDATING_H */