diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2014-07-22 21:38:30 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2014-07-22 21:38:30 (GMT) |
commit | 250d2773aa372434b721a4e72bff5da7b4f3fb4e (patch) | |
tree | 3bbb6b75e1cc53c5aa189489e416e3dd92bb79c2 /src/gui/panels/strings.c | |
parent | db863244b804cbf4c06399f7c6f8241d91c9ee9b (diff) |
Used in the right way some features of GLib classes in the GUI code.
git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@382 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
Diffstat (limited to 'src/gui/panels/strings.c')
-rw-r--r-- | src/gui/panels/strings.c | 87 |
1 files changed, 81 insertions, 6 deletions
diff --git a/src/gui/panels/strings.c b/src/gui/panels/strings.c index aac5f6f..630b175 100644 --- a/src/gui/panels/strings.c +++ b/src/gui/panels/strings.c @@ -72,6 +72,18 @@ typedef enum _StringsColumn } StringsColumn; +/* Initialise la classe des panneaux d'affichage de chaînes. */ +static void g_strings_panel_class_init(GStringsPanelClass *); + +/* Initialise une instance de panneau d'affichage des chaînes. */ +static void g_strings_panel_init(GStringsPanel *); + +/* Supprime toutes les références externes. */ +static void g_strings_panel_dispose(GStringsPanel *); + +/* Procède à la libération totale de la mémoire. */ +static void g_strings_panel_finalize(GStringsPanel *); + /* Réagit à un changement d'affichage principal de contenu. */ static void change_strings_panel_current_binary(GStringsPanel *, GLoadedBinary *); @@ -93,7 +105,7 @@ static void mcb_strings_copy(GtkMenuItem *, GtkTreeView *); /* ---------------------------------------------------------------------------------- */ -/* Indique le type définit pour un panneau d'aperçu de graphiques. */ +/* Indique le type définit pour un panneau d'affichage des chaînes. */ G_DEFINE_TYPE(GStringsPanel, g_strings_panel, G_TYPE_PANEL_ITEM); @@ -101,7 +113,7 @@ G_DEFINE_TYPE(GStringsPanel, g_strings_panel, G_TYPE_PANEL_ITEM); * * * Paramètres : klass = classe à initialiser. * * * -* Description : Initialise la classe des panneaux d'aperçu de graphiques. * +* Description : Initialise la classe des panneaux d'affichage de chaînes. * * * * Retour : - * * * @@ -111,6 +123,17 @@ G_DEFINE_TYPE(GStringsPanel, g_strings_panel, G_TYPE_PANEL_ITEM); static void g_strings_panel_class_init(GStringsPanelClass *klass) { + GObjectClass *object; /* Autre version de la classe */ + GEditorItemClass *editem; /* Encore une autre vision... */ + + object = G_OBJECT_CLASS(klass); + + object->dispose = (GObjectFinalizeFunc/* ! */)g_strings_panel_dispose; + object->finalize = (GObjectFinalizeFunc)g_strings_panel_finalize; + + editem = G_EDITOR_ITEM_CLASS(klass); + + editem->update_binary = (update_item_binary_fc)change_strings_panel_current_binary; } @@ -119,7 +142,7 @@ static void g_strings_panel_class_init(GStringsPanelClass *klass) * * * Paramètres : panel = instance à initialiser. * * * -* Description : Initialise une instance de panneau d'aperçu de graphiques. * +* Description : Initialise une instance de panneau d'affichage des chaînes. * * * * Retour : - * * * @@ -198,9 +221,50 @@ static void g_strings_panel_init(GStringsPanel *panel) /****************************************************************************** * * +* Paramètres : panel = instance d'objet GLib à traiter. * +* * +* Description : Supprime toutes les références externes. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_strings_panel_dispose(GStringsPanel *panel) +{ + if (panel->binary != NULL) + g_object_unref(G_OBJECT(panel->binary)); + + G_OBJECT_CLASS(g_strings_panel_parent_class)->dispose(G_OBJECT(panel)); + +} + + +/****************************************************************************** +* * +* Paramètres : panel = instance d'objet GLib à traiter. * +* * +* Description : Procède à la libération totale de la mémoire. * +* * +* Retour : - * +* * +* Remarques : - * +* * +******************************************************************************/ + +static void g_strings_panel_finalize(GStringsPanel *panel) +{ + G_OBJECT_CLASS(g_strings_panel_parent_class)->finalize(G_OBJECT(panel)); + +} + + +/****************************************************************************** +* * * Paramètres : ref = espace de référencement global. * * * -* Description : Crée un panneau d'affichage des symboles. * +* Description : Crée un panneau d'affichage des chaînes. * * * * Retour : Adresse de la structure mise en place. * * * @@ -226,7 +290,7 @@ GEditorItem *g_strings_panel_new(GObject *ref) * * * Paramètres : ref = espace de référencement global. * * * -* Description : Construit et intègre un panneau d'affichage des symboles. * +* Description : Construit et intègre un panneau d'affichage des chaînes. * * * * Retour : Adresse du panneau mis en place. * * * @@ -241,7 +305,6 @@ GPanelItem *create_strings_panel(GObject *ref) result = g_strings_panel_new(ref); /* Enregistre correctement le tout */ - result->update_binary = (update_item_binary_fc)change_strings_panel_current_binary; register_editor_item(result); return G_PANEL_ITEM(result); @@ -274,6 +337,18 @@ static void change_strings_panel_current_binary(GStringsPanel *panel, GLoadedBin char *text; /* Version imprimable du texte */ GtkTreeIter iter; /* Point d'insertion */ + /* Basculement du binaire utilisé */ + + if (panel->binary != NULL) + g_object_unref(G_OBJECT(panel->binary)); + + panel->binary = binary; + + if (panel->binary != NULL) + g_object_ref(G_OBJECT(panel->binary)); + + /* Actualisation de l'affichage */ + store = g_object_get_data(G_OBJECT(panel), "store"); format = g_loaded_binary_get_format(binary); |