From d1dd9ae74ba56b04ad8f79d926b2282c6c7fa0fd Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Thu, 11 Sep 2014 18:44:09 +0000
Subject: Updated the code and activated back the toolbar items.

git-svn-id: svn://svn.gna.org/svn/chrysalide/trunk@402 abbe820e-26c8-41b2-8c08-b7b2b41f8b0a
---
 ChangeLog               |  18 ++++++
 src/gui/tb/Makefile.am  |   3 +-
 src/gui/tb/portions.c   | 159 +++++++++++++++++++++++++++++++++++++-----------
 src/gui/tb/portions.h   |  20 +++++-
 src/gui/tb/source.c     | 153 ++++++++++++++++++++++++++++++++++++----------
 src/gui/tb/source.h     |  22 ++++++-
 src/gui/tb/tbitem-int.h |  55 +++++++++++++++++
 src/gui/tb/tbitem.c     | 119 ++++++++++++++++++++++++++++++++++++
 src/gui/tb/tbitem.h     |  53 ++++++++++++++++
 src/gui/tb/toolbar.c    | 141 ------------------------------------------
 src/gui/tb/toolbar.h    |  56 -----------------
 11 files changed, 531 insertions(+), 268 deletions(-)
 create mode 100644 src/gui/tb/tbitem-int.h
 create mode 100644 src/gui/tb/tbitem.c
 create mode 100644 src/gui/tb/tbitem.h
 delete mode 100644 src/gui/tb/toolbar.c
 delete mode 100644 src/gui/tb/toolbar.h

diff --git a/ChangeLog b/ChangeLog
index 790dbc6..ac2fce9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+14-09-11  Cyrille Bagard <nocbos@gmail.com>
+
+	* src/gui/tb/Makefile.am:
+	* src/gui/tb/portions.c:
+	* src/gui/tb/portions.h:
+	* src/gui/tb/source.c:
+	* src/gui/tb/source.h:
+	* src/gui/tb/tbitem.c:
+	* src/gui/tb/tbitem.h:
+	Update the code and activate back the toolbar items.
+
+	* src/gui/tb/tbitem-int.h:
+	New entry: allow to subclass a toolbar item.
+
+	* src/gui/tb/toolbar.c:
+	* src/gui/tb/toolbar.h:
+	Renamed entries: see tbitems.[ch].
+
 14-09-10  Cyrille Bagard <nocbos@gmail.com>
 
 	* src/gtkext/gtkbufferview.c:
diff --git a/src/gui/tb/Makefile.am b/src/gui/tb/Makefile.am
index 52033c3..60aa031 100644
--- a/src/gui/tb/Makefile.am
+++ b/src/gui/tb/Makefile.am
@@ -4,7 +4,8 @@ noinst_LTLIBRARIES  = libguitb.la
 libguitb_la_SOURCES =					\
 	portions.h portions.c				\
 	source.h source.c					\
-	toolbar.h toolbar.c
+	tbitem-int.h						\
+	tbitem.h tbitem.c
 
 libguitb_la_LDFLAGS = 
 
diff --git a/src/gui/tb/portions.c b/src/gui/tb/portions.c
index bbc31b9..53d9dd4 100644
--- a/src/gui/tb/portions.c
+++ b/src/gui/tb/portions.c
@@ -28,72 +28,127 @@
 #include <i18n.h>
 
 
-#include "toolbar.h"
-#include "../editem-int.h"
+#include "tbitem-int.h"
 #include "../../format/format.h"
 #include "../../gtkext/gtkbinarystrip.h"
 
 
 
-/* Construit l'élément GTK pour une barre d'outils. */
-static GtkWidget *build_portions_tb_widget(GObject *);
+/* Elément réactif présentant des portions de binaire (instance) */
+struct _GPortionsTbItem
+{
+    GToolbarItem parent;                    /* A laisser en premier        */
 
-/* Fait suivre un changement d'adresse dans la barre. */
-static void track_address_on_binary_strip(GtkBinaryStrip *, vmpa_t, GObject *);
+};
+
+
+/* Elément réactif présentant des portions de binaire (classe) */
+struct _GPortionsTbItemClass
+{
+    GToolbarItemClass parent;               /* A laisser en premier        */
+
+};
+
+
+
+/* Initialise la classe des éléments réactifs de l'éditeur. */
+static void g_portions_tbitem_class_init(GPortionsTbItemClass *);
+
+/* Initialise une instance d'élément réactif pour l'éditeur. */
+static void g_portions_tbitem_init(GPortionsTbItem *);
+
+/* Supprime toutes les références externes. */
+static void g_portions_tbitem_dispose(GPortionsTbItem *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_portions_tbitem_finalize(GPortionsTbItem *);
 
 /* Réagit à un changement du binaire courant. */
 static void update_portions_item_binary(GEditorItem *, GLoadedBinary *);
 
+/* Fait suivre un changement d'adresse dans la barre. */
+static void track_address_on_binary_strip(GtkBinaryStrip *, vmpa_t, GObject *);
+
+
+
+/* Indique le type défini pour un affichage de portions destiné à une barre d'outils. */
+G_DEFINE_TYPE(GPortionsTbItem, g_portions_tbitem, G_TYPE_TOOLBAR_ITEM);
 
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : ref = espace de référencement global.                        *
+*  Paramètres  : klass = classe à initialiser.                                *
 *                                                                             *
-*  Description : Construit l'élément GTK pour une barre d'outils.             *
+*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
 *                                                                             *
-*  Retour      : Adresse du composant mis en place.                           *
+*  Retour      : -                                                            *
 *                                                                             *
 *  Remarques   : -                                                            *
 *                                                                             *
 ******************************************************************************/
 
-static GtkWidget *build_portions_tb_widget(GObject *ref)
+static void g_portions_tbitem_class_init(GPortionsTbItemClass *klass)
 {
-    GtkWidget *result;                      /* Composant à retourner       */
+    GObjectClass *object;                   /* Autre version de la classe  */
+    GEditorItemClass *item;                 /* Encore une autre vision     */
+
+    object = G_OBJECT_CLASS(klass);
+    item = G_EDITOR_ITEM_CLASS(klass);
+
+    object->dispose = (GObjectFinalizeFunc/* ! */)g_portions_tbitem_dispose;
+    object->finalize = (GObjectFinalizeFunc)g_portions_tbitem_finalize;
+
+    item->update_binary = update_portions_item_binary;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance à initialiser.                               *
+*                                                                             *
+*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_portions_tbitem_init(GPortionsTbItem *item)
+{
+    GtkWidget *widget;                      /* Composant principal         */
     GtkWidget *handlebox;                   /* Support relocalisable       */
     GtkWidget *strip;                       /* Bande pour binaire          */
 
-    result = GTK_WIDGET(gtk_tool_item_new());
-    gtk_tool_item_set_expand(GTK_TOOL_ITEM(result), TRUE);
-    gtk_widget_show(result);
+    widget = GTK_WIDGET(gtk_tool_item_new());
+    gtk_tool_item_set_expand(GTK_TOOL_ITEM(widget), TRUE);
+    gtk_widget_show(widget);
+
+    G_EDITOR_ITEM(item)->widget = widget;
 
     handlebox = gtk_handle_box_new();
     gtk_widget_show(handlebox);
-    gtk_container_add(GTK_CONTAINER(result), handlebox);
+    gtk_container_add(GTK_CONTAINER(widget), handlebox);
 
     strip = gtk_binary_strip_new();
     gtk_widget_show(strip);
     gtk_container_add(GTK_CONTAINER(handlebox), strip);
 
-    g_object_set_data(G_OBJECT(result), "strip", strip);
+    g_object_set_data(G_OBJECT(widget), "strip", strip);
 
     g_signal_connect(strip, "select-address",
                      G_CALLBACK(track_address_on_binary_strip),
-                     ref);
-
-    return result;
+                     item);
 
 }
 
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : strip = composant d'affichage parcouru.                      *
-*                addr  = nouvelle adresse du curseur courant.                 *
-*                ref   = espace de référencement global.                      *
+*  Paramètres  : item = instance d'objet GLib à traiter.                      *
 *                                                                             *
-*  Description : Fait suivre un changement d'adresse dans la barre.           *
+*  Description : Supprime toutes les références externes.                     *
 *                                                                             *
 *  Retour      : -                                                            *
 *                                                                             *
@@ -101,12 +156,29 @@ static GtkWidget *build_portions_tb_widget(GObject *ref)
 *                                                                             *
 ******************************************************************************/
 
-static void track_address_on_binary_strip(GtkBinaryStrip *strip, vmpa_t addr, GObject *ref)
+static void g_portions_tbitem_dispose(GPortionsTbItem *item)
 {
+    G_OBJECT_CLASS(g_portions_tbitem_parent_class)->dispose(G_OBJECT(item));
 
-    printf("===> CHANGE TO 0x%08llx\n", addr);
+}
 
 
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance d'objet GLib à traiter.                      *
+*                                                                             *
+*  Description : Procède à la libération totale de la mémoire.                *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_portions_tbitem_finalize(GPortionsTbItem *item)
+{
+    G_OBJECT_CLASS(g_portions_tbitem_parent_class)->finalize(G_OBJECT(item));
+
 }
 
 
@@ -114,7 +186,7 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, vmpa_t addr, GO
 *                                                                             *
 *  Paramètres  : ref = espace de référencement global.                        *
 *                                                                             *
-*  Description : Crée une sélection de fichier réactive pour barre d'outils.  *
+*  Description : Crée un élément réactif présentant des portions de binaire.  *
 *                                                                             *
 *  Retour      : Adresse de la structure d'encadrement mise en place.         *
 *                                                                             *
@@ -124,17 +196,11 @@ static void track_address_on_binary_strip(GtkBinaryStrip *strip, vmpa_t addr, GO
 
 GEditorItem *create_portions_tb_item(GObject *ref)
 {
-    GEditorItem *result;                    /* Structure à retourner       */
-    GtkWidget *widget;                      /* Composant affiché à l'écran */
-
-    widget = build_portions_tb_widget(ref);
-
-    result = g_toolbar_item_new(ref, "portions", widget, _("Portions"));
+    GPortionsTbItem *result;                /* Structure à retourner       */
 
-    /* FIXME */
-    //G_EDITOR_ITEM_GET_CLASS(result)->update_binary = update_portions_item_binary;
+    result = g_object_new(G_TYPE_PORTIONS_TBITEM, NULL);
 
-    return result;
+    return g_toolbar_item_setup(G_TOOLBAR_ITEM(result), ref, "portions", _("Portions"));
 
 }
 
@@ -161,3 +227,26 @@ static void update_portions_item_binary(GEditorItem *item, GLoadedBinary *binary
     gtk_binary_strip_attach(strip, binary);
 
 }
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : strip = composant d'affichage parcouru.                      *
+*                addr  = nouvelle adresse du curseur courant.                 *
+*                ref   = espace de référencement global.                      *
+*                                                                             *
+*  Description : Fait suivre un changement d'adresse dans la barre.           *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void track_address_on_binary_strip(GtkBinaryStrip *strip, vmpa_t addr, GObject *ref)
+{
+
+    printf("===> CHANGE TO 0x%08llx\n", 123);
+
+
+}
diff --git a/src/gui/tb/portions.h b/src/gui/tb/portions.h
index 6f3c3b6..18e1f7d 100644
--- a/src/gui/tb/portions.h
+++ b/src/gui/tb/portions.h
@@ -26,10 +26,28 @@
 #define _GUI_TB_PORTIONS_H
 
 
-#include "../editem.h"
+#include "tbitem.h"
 
 
 
+#define G_TYPE_PORTIONS_TBITEM               g_portions_tbitem_get_type()
+#define G_PORTIONS_TBITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_portions_tbitem_get_type(), GToolbarItem))
+#define G_IS_PORTIONS_TBITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_portions_tbitem_get_type()))
+#define G_PORTIONS_TBITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_PORTIONS_TBITEM, GToolbarItemClass))
+#define G_IS_PORTIONS_TBITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_PORTIONS_TBITEM))
+#define G_PORTIONS_TBITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_PORTIONS_TBITEM, GToolbarItemClass))
+
+
+/* Elément réactif présentant des portions de binaire (instance) */
+typedef struct _GPortionsTbItem GPortionsTbItem;
+
+/* Elément réactif présentant des portions de binaire (classe) */
+typedef struct _GPortionsTbItemClass GPortionsTbItemClass;
+
+
+/* Indique le type défini pour un affichage de portions destiné à une barre d'outils. */
+GType g_portions_tbitem_get_type(void);
+
 /* Crée une sélection de fichier réactive pour barre d'outils. */
 GEditorItem *create_portions_tb_item(GObject *ref);
 
diff --git a/src/gui/tb/source.c b/src/gui/tb/source.c
index bac6b0f..9f041a1 100644
--- a/src/gui/tb/source.c
+++ b/src/gui/tb/source.c
@@ -28,8 +28,7 @@
 #include <i18n.h>
 
 
-#include "toolbar.h"
-#include "../editem-int.h"
+#include "tbitem-int.h"
 #include "../../format/format.h"
 #include "../../gtkext/easygtk.h"
 #include "../../gtkext/gtkbufferview.h"
@@ -37,8 +36,34 @@
 
 
 
-/* Construit l'élément GTK pour une barre d'outils. */
-static GtkWidget *build_source_tb_widget(GObject *);
+/* Elément réactif listant les fichiers décompilés (instance) */
+struct _GSourceTbItem
+{
+    GToolbarItem parent;                    /* A laisser en premier        */
+
+};
+
+
+/* Elément réactif listant les fichiers décompilés (classe) */
+struct _GSourceTbItemClass
+{
+    GToolbarItemClass parent;               /* A laisser en premier        */
+
+};
+
+
+
+/* Initialise la classe des éléments réactifs de l'éditeur. */
+static void g_source_tbitem_class_init(GSourceTbItemClass *);
+
+/* Initialise une instance d'élément réactif pour l'éditeur. */
+static void g_source_tbitem_init(GSourceTbItem *);
+
+/* Supprime toutes les références externes. */
+static void g_source_tbitem_dispose(GSourceTbItem *);
+
+/* Procède à la libération totale de la mémoire. */
+static void g_source_tbitem_finalize(GSourceTbItem *);
 
 /* Réagit à un changement du binaire courant. */
 static void update_source_item_binary(GEditorItem *, GLoadedBinary *);
@@ -47,49 +72,120 @@ static void update_source_item_binary(GEditorItem *, GLoadedBinary *);
 static void update_source_item_view(GEditorItem *, GtkViewPanel *);
 
 /* Réagit à un changement de sélection de la source courante. */
-static void change_selected_source(GtkComboBox *, GObject *);
+static void change_selected_source(GtkComboBox *, GSourceTbItem *);
+
 
 
+/* Indique le type défini pour une liste de fichiers destinée à une barre d'outils. */
+G_DEFINE_TYPE(GSourceTbItem, g_source_tbitem, G_TYPE_TOOLBAR_ITEM);
+
 
 /******************************************************************************
 *                                                                             *
-*  Paramètres  : ref = espace de référencement global.                        *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_source_tbitem_class_init(GSourceTbItemClass *klass)
+{
+    GObjectClass *object;                   /* Autre version de la classe  */
+    GEditorItemClass *item;                 /* Encore une autre vision     */
+
+    object = G_OBJECT_CLASS(klass);
+    item = G_EDITOR_ITEM_CLASS(klass);
+
+    object->dispose = (GObjectFinalizeFunc/* ! */)g_source_tbitem_dispose;
+    object->finalize = (GObjectFinalizeFunc)g_source_tbitem_finalize;
+
+    item->update_binary = update_source_item_binary;
+    item->update_view = update_source_item_view;
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance à initialiser.                               *
 *                                                                             *
-*  Description : Construit l'élément GTK pour une barre d'outils.             *
+*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
 *                                                                             *
-*  Retour      : Adresse du composant mis en place.                           *
+*  Retour      : -                                                            *
 *                                                                             *
 *  Remarques   : -                                                            *
 *                                                                             *
 ******************************************************************************/
 
-static GtkWidget *build_source_tb_widget(GObject *ref)
+static void g_source_tbitem_init(GSourceTbItem *item)
 {
-    GtkWidget *result;                      /* Composant à retourner       */
+    GtkWidget *widget;                      /* Composant principal         */
     GtkWidget *handlebox;                   /* Support relocalisable       */
     GtkWidget *hbox;                        /* Support interne             */
     GtkWidget *label;                       /* Etiquette d'introduction    */
     GtkWidget *comboboxentry;               /* Liste de fichiers           */
 
-    result = GTK_WIDGET(gtk_tool_item_new());
-    gtk_widget_show(result);
+    widget = GTK_WIDGET(gtk_tool_item_new());
+    gtk_widget_show(widget);
+
+    G_EDITOR_ITEM(item)->widget = widget;
 
     handlebox = gtk_handle_box_new();
     gtk_widget_show(handlebox);
-    gtk_container_add(GTK_CONTAINER(result), handlebox);
+    gtk_container_add(GTK_CONTAINER(widget), handlebox);
 
     hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 8);
     gtk_widget_show(hbox);
     gtk_container_add(GTK_CONTAINER(handlebox), hbox);
 
-    label = qck_create_label(G_OBJECT(result), "label", _(" Source: "));
+    label = qck_create_label(G_OBJECT(widget), "label", _(" Source: "));
     gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
-    comboboxentry = qck_create_combobox2(G_OBJECT(result), "combo",
-                                        G_CALLBACK(change_selected_source), ref);
+    comboboxentry = qck_create_combobox2(G_OBJECT(widget), "combo",
+                                        G_CALLBACK(change_selected_source), item);
     gtk_box_pack_start(GTK_BOX(hbox), comboboxentry, TRUE, TRUE, 0);
 
-    return result;
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance d'objet GLib à traiter.                      *
+*                                                                             *
+*  Description : Supprime toutes les références externes.                     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_source_tbitem_dispose(GSourceTbItem *item)
+{
+    G_OBJECT_CLASS(g_source_tbitem_parent_class)->dispose(G_OBJECT(item));
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance d'objet GLib à traiter.                      *
+*                                                                             *
+*  Description : Procède à la libération totale de la mémoire.                *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_source_tbitem_finalize(GSourceTbItem *item)
+{
+    G_OBJECT_CLASS(g_source_tbitem_parent_class)->finalize(G_OBJECT(item));
 
 }
 
@@ -98,7 +194,7 @@ static GtkWidget *build_source_tb_widget(GObject *ref)
 *                                                                             *
 *  Paramètres  : ref = espace de référencement global.                        *
 *                                                                             *
-*  Description : Crée une sélection de fichier réactive pour barre d'outils.  *
+*  Description : Crée un élément réactif présentant des source de binaire.  *
 *                                                                             *
 *  Retour      : Adresse de la structure d'encadrement mise en place.         *
 *                                                                             *
@@ -108,18 +204,11 @@ static GtkWidget *build_source_tb_widget(GObject *ref)
 
 GEditorItem *create_source_tb_item(GObject *ref)
 {
-    GEditorItem *result;                    /* Structure à retourner       */
-    GtkWidget *widget;                      /* Composant affiché à l'écran */
-
-    widget = build_source_tb_widget(ref);
-
-    result = g_toolbar_item_new(ref, "source", widget, _("Source files"));
+    GSourceTbItem *result;                /* Structure à retourner       */
 
-    /* FIXME */
-    //G_EDITOR_ITEM_GET_CLASS(result)->update_binary = update_source_item_binary;
-    //G_EDITOR_ITEM_GET_CLASS(result)->update_view = update_source_item_view;
+    result = g_object_new(G_TYPE_SOURCE_TBITEM, NULL);
 
-    return result;
+    return g_toolbar_item_setup(G_TOOLBAR_ITEM(result), ref, "source", _("Source files"));
 
 }
 
@@ -152,7 +241,7 @@ static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
 
     /* Réinitialisation */
 
-    g_signal_handlers_block_by_func(combo, G_CALLBACK(change_selected_source), item->ref);
+    g_signal_handlers_block_by_func(combo, G_CALLBACK(change_selected_source), item);
 
     /* FIXME : 3.0 */
     //gtk_combo_box_text_remove_all(combo);
@@ -172,7 +261,7 @@ static void update_source_item_binary(GEditorItem *item, GLoadedBinary *binary)
 
     /* Réactivation */
 
-    g_signal_handlers_unblock_by_func(combo, G_CALLBACK(change_selected_source), item->ref);
+    g_signal_handlers_unblock_by_func(combo, G_CALLBACK(change_selected_source), item);
 
     //gtk_combo_box_set_active(combo, defsrc);
 
@@ -202,7 +291,7 @@ static void update_source_item_view(GEditorItem *item, GtkViewPanel *view)
 /******************************************************************************
 *                                                                             *
 *  Paramètres  : widget = composant GTK en cause.                             *
-*                ref    = espace de référencement global.                     *
+*                item   = élément réactif associé.                            *
 *                                                                             *
 *  Description : Réagit à un changement de sélection de la source courante.   *
 *                                                                             *
@@ -212,7 +301,7 @@ static void update_source_item_view(GEditorItem *item, GtkViewPanel *view)
 *                                                                             *
 ******************************************************************************/
 
-static void change_selected_source(GtkComboBox *widget, GObject *ref)
+static void change_selected_source(GtkComboBox *widget, GSourceTbItem *item)
 {
 #if 0
     gint index;                             /* Nouvelle source ciblée      */
diff --git a/src/gui/tb/source.h b/src/gui/tb/source.h
index 2d9c54e..ca2205f 100644
--- a/src/gui/tb/source.h
+++ b/src/gui/tb/source.h
@@ -2,7 +2,7 @@
 /* Chrysalide - Outil d'analyse de fichiers binaires
  * source.h - prototypes pour la sélection du fichier ciblé lors d'une décompilation
  *
- * Copyright (C) 2010 Cyrille Bagard
+ * Copyright (C) 2010-2014 Cyrille Bagard
  *
  *  This file is part of Chrysalide.
  *
@@ -26,10 +26,28 @@
 #define _GUI_TB_SOURCE_H
 
 
-#include "../editem.h"
+#include "tbitem.h"
 
 
 
+#define G_TYPE_SOURCE_TBITEM               g_source_tbitem_get_type()
+#define G_SOURCE_TBITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_source_tbitem_get_type(), GToolbarItem))
+#define G_IS_SOURCE_TBITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_source_tbitem_get_type()))
+#define G_SOURCE_TBITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_SOURCE_TBITEM, GToolbarItemClass))
+#define G_IS_SOURCE_TBITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_SOURCE_TBITEM))
+#define G_SOURCE_TBITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_SOURCE_TBITEM, GToolbarItemClass))
+
+
+/* Elément réactif listant les fichiers décompilés (instance) */
+typedef struct _GSourceTbItem GSourceTbItem;
+
+/* Elément réactif listant les fichiers décompilés (classe) */
+typedef struct _GSourceTbItemClass GSourceTbItemClass;
+
+
+/* Indique le type défini pour une liste de fichiers destinée à une barre d'outils. */
+GType g_source_tbitem_get_type(void);
+
 /* Crée une sélection de fichier réactive pour barre d'outils. */
 GEditorItem *create_source_tb_item(GObject *ref);
 
diff --git a/src/gui/tb/tbitem-int.h b/src/gui/tb/tbitem-int.h
new file mode 100644
index 0000000..8caa596
--- /dev/null
+++ b/src/gui/tb/tbitem-int.h
@@ -0,0 +1,55 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * tbitem.h - prototypes pour la gestion des éléments réactifs spécifiques à la barre d'outils
+ *
+ * Copyright (C) 2014 Cyrille Bagard
+ *
+ *  This file is part of Chrysalide.
+ *
+ *  OpenIDA 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.
+ *
+ *  OpenIDA 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_TBITEM_INT_H
+#define _GUI_TBITEM_INT_H
+
+
+#include "../editem-int.h"
+
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (instance) */
+struct _GToolbarItem
+{
+    GEditorItem parent;                     /* A laisser en premier        */
+
+};
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (classe) */
+struct _GToolbarItemClass
+{
+    GEditorItemClass parent;                /* A laisser en premier        */
+
+};
+
+
+
+/* Termine la préparation d'un élément de barre d'outils. */
+GEditorItem *g_toolbar_item_setup(GToolbarItem *, GObject *, const char *, const char *);
+
+
+
+#endif  /* _GUI_TBITEM_INT_H */
diff --git a/src/gui/tb/tbitem.c b/src/gui/tb/tbitem.c
new file mode 100644
index 0000000..c3ffcdf
--- /dev/null
+++ b/src/gui/tb/tbitem.c
@@ -0,0 +1,119 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * tbitem.c - gestion des éléments réactifs spécifiques à la barre d'outils
+ *
+ * Copyright (C) 2010-2012 Cyrille Bagard
+ *
+ *  This file is part of Chrysalide.
+ *
+ *  OpenIDA 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.
+ *
+ *  OpenIDA 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#include "tbitem.h"
+
+
+#include <gtk/gtkcontainer.h>
+
+
+#include "tbitem-int.h"
+
+
+
+/* Initialise la classe des éléments réactifs de l'éditeur. */
+static void g_toolbar_item_class_init(GToolbarItemClass *);
+
+/* Initialise une instance d'élément réactif pour l'éditeur. */
+static void g_toolbar_item_init(GToolbarItem *);
+
+
+
+/* Indique le type défini pour un élément destiné à une barre d'outils. */
+G_DEFINE_TYPE(GToolbarItem, g_toolbar_item, G_TYPE_EDITOR_ITEM);
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : klass = classe à initialiser.                                *
+*                                                                             *
+*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_toolbar_item_class_init(GToolbarItemClass *klass)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : item = instance à initialiser.                               *
+*                                                                             *
+*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
+*                                                                             *
+*  Retour      : -                                                            *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+static void g_toolbar_item_init(GToolbarItem *item)
+{
+
+}
+
+
+/******************************************************************************
+*                                                                             *
+*  Paramètres  : tbitem = élément de barre d'outils à finaliser.              *
+*                ref    = espace de référencement global.                     *
+*                name   = nom associé à l'élément.                            *
+*                label  = étiquette destinée au menu.                         *
+*                                                                             *
+*  Description : Termine la préparation d'un élément de barre d'outils.       *
+*                                                                             *
+*  Retour      : Adresse de la structure mise en place.                       *
+*                                                                             *
+*  Remarques   : -                                                            *
+*                                                                             *
+******************************************************************************/
+
+GEditorItem *g_toolbar_item_setup(GToolbarItem *tbitem, GObject *ref, const char *name, const char *label)
+{
+    GEditorItem *result;                    /* Structure à retourner       */
+    GtkContainer *toolbar;                  /* Barre d'outils visée        */
+
+    result = G_EDITOR_ITEM(tbitem);
+
+    /* Initialisation générique */
+
+    g_object_ref(ref);
+    result->ref = ref;
+
+    result->name = name;
+
+    /* Intégration dans la barre */
+
+    toolbar = GTK_CONTAINER(g_object_get_data(ref, "toolbar"));
+    gtk_container_add(toolbar, result->widget);
+
+    return result;
+
+}
diff --git a/src/gui/tb/tbitem.h b/src/gui/tb/tbitem.h
new file mode 100644
index 0000000..4f0d3a7
--- /dev/null
+++ b/src/gui/tb/tbitem.h
@@ -0,0 +1,53 @@
+
+/* Chrysalide - Outil d'analyse de fichiers binaires
+ * tbitem.h - prototypes pour la gestion des éléments réactifs spécifiques à la barre d'outils
+ *
+ * Copyright (C) 2010 Cyrille Bagard
+ *
+ *  This file is part of Chrysalide.
+ *
+ *  OpenIDA 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.
+ *
+ *  OpenIDA 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 this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+#ifndef _GUI_TBITEM_H
+#define _GUI_TBITEM_H
+
+
+#include "../editem.h"
+
+
+
+#define G_TYPE_TOOLBAR_ITEM               g_toolbar_item_get_type()
+#define G_TOOLBAR_ITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_toolbar_item_get_type(), GToolbarItem))
+#define G_IS_TOOLBAR_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_toolbar_item_get_type()))
+#define G_TOOLBAR_ITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
+#define G_IS_TOOLBAR_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_TOOLBAR_ITEM))
+#define G_TOOLBAR_ITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
+
+
+/* Elément réactif pour barre d'outils de l'éditeur (instance) */
+typedef struct _GToolbarItem GToolbarItem;
+
+/* Elément réactif pour barre d'outils de l'éditeur (classe) */
+typedef struct _GToolbarItemClass GToolbarItemClass;
+
+
+/* Indique le type défini pour un élément destiné à une barre d'outils. */
+GType g_toolbar_item_get_type(void);
+
+
+
+#endif  /* _GUI_TBITEM_H */
diff --git a/src/gui/tb/toolbar.c b/src/gui/tb/toolbar.c
deleted file mode 100644
index 62eb436..0000000
--- a/src/gui/tb/toolbar.c
+++ /dev/null
@@ -1,141 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * toolbar.c - gestion des éléments réactifs spécifiques à la barre d'outils
- *
- * Copyright (C) 2010-2012 Cyrille Bagard
- *
- *  This file is part of Chrysalide.
- *
- *  OpenIDA 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.
- *
- *  OpenIDA 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 this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#include "toolbar.h"
-
-
-#include <gtk/gtkcontainer.h>
-
-
-#include "../editem-int.h"
-
-
-
-/* Elément réactif pour barre d'outils de l'éditeur (instance) */
-struct _GToolbarItem
-{
-    GEditorItem parent;                     /* A laisser en premier        */
-
-};
-
-
-/* Elément réactif pour barre d'outils de l'éditeur (classe) */
-struct _GToolbarItemClass
-{
-    GEditorItemClass parent;                /* A laisser en premier        */
-
-};
-
-
-/* Initialise la classe des éléments réactifs de l'éditeur. */
-static void g_toolbar_item_class_init(GToolbarItemClass *);
-
-/* Initialise une instance d'élément réactif pour l'éditeur. */
-static void g_toolbar_item_init(GToolbarItem *);
-
-
-
-/* Indique le type défini pour un élément destiné à une barre d'outils. */
-G_DEFINE_TYPE(GToolbarItem, g_toolbar_item, G_TYPE_EDITOR_ITEM);
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : klass = classe à initialiser.                                *
-*                                                                             *
-*  Description : Initialise la classe des éléments réactifs de l'éditeur.     *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_toolbar_item_class_init(GToolbarItemClass *klass)
-{
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : item = instance à initialiser.                               *
-*                                                                             *
-*  Description : Initialise une instance d'élément réactif pour l'éditeur.    *
-*                                                                             *
-*  Retour      : -                                                            *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-static void g_toolbar_item_init(GToolbarItem *item)
-{
-
-}
-
-
-/******************************************************************************
-*                                                                             *
-*  Paramètres  : ref    = espace de référencement global.                     *
-*                name   = nom associé à l'élément.                            *
-*                widget = composant à présenter à l'affichage.                *
-*                label  = étiquette destinée au menu.                         *
-*                                                                             *
-*  Description : Crée un élément de barre d'outils réactif.                   *
-*                                                                             *
-*  Retour      : Adresse de la structure mise en place.                       *
-*                                                                             *
-*  Remarques   : -                                                            *
-*                                                                             *
-******************************************************************************/
-
-GEditorItem *g_toolbar_item_new(GObject *ref, const char *name, GtkWidget *widget, const char *label)
-{
-    GToolbarItem *result;                   /* Structure à retourner       */
-    GEditorItem *item;                      /* Autre version de l'élément  */
-    GtkContainer *toolbar;                  /* Barre d'outils visée        */
-
-    result = g_object_new(G_TYPE_TOOLBAR_ITEM, NULL);
-
-    /* Initialisation générique */
-
-    item = G_EDITOR_ITEM(result);
-
-    g_object_ref(ref);
-    item->ref = ref;
-
-    item->name = name;
-
-    g_object_ref(widget);
-    item->widget = widget;
-
-    /* Intégration dans la barre */
-
-    toolbar = GTK_CONTAINER(g_object_get_data(ref, "toolbar"));
-    gtk_container_add(toolbar, widget);
-
-    return G_EDITOR_ITEM(result);
-
-}
diff --git a/src/gui/tb/toolbar.h b/src/gui/tb/toolbar.h
deleted file mode 100644
index cf4d5af..0000000
--- a/src/gui/tb/toolbar.h
+++ /dev/null
@@ -1,56 +0,0 @@
-
-/* Chrysalide - Outil d'analyse de fichiers binaires
- * toolbar.h - prototypes pour la gestion des éléments réactifs spécifiques à la barre d'outils
- *
- * Copyright (C) 2010 Cyrille Bagard
- *
- *  This file is part of Chrysalide.
- *
- *  OpenIDA 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.
- *
- *  OpenIDA 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 this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-#ifndef _GUI_TOOLBAR_H
-#define _GUI_TOOLBAR_H
-
-
-#include "../editem.h"
-
-
-
-#define G_TYPE_TOOLBAR_ITEM               g_toolbar_item_get_type()
-#define G_TOOLBAR_ITEM(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), g_toolbar_item_get_type(), GToolbarItem))
-#define G_IS_TOOLBAR_ITEM(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj), g_toolbar_item_get_type()))
-#define G_TOOLBAR_ITEM_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
-#define G_IS_TOOLBAR_ITEM_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_TOOLBAR_ITEM))
-#define G_TOOLBAR_ITEM_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), G_TYPE_TOOLBAR_ITEM, GToolbarItemClass))
-
-
-/* Elément réactif pour barre d'outils de l'éditeur (instance) */
-typedef struct _GToolbarItem GToolbarItem;
-
-/* Elément réactif pour barre d'outils de l'éditeur (classe) */
-typedef struct _GToolbarItemClass GToolbarItemClass;
-
-
-/* Indique le type défini pour un élément destiné à une barre d'outils. */
-GType g_toolbar_item_get_type(void);
-
-/* Crée un élément de barre d'outils réactif. */
-GEditorItem *g_toolbar_item_new(GObject *, const char *, GtkWidget *, const char *);
-
-
-
-#endif  /* _GUI_TOOLBAR_H */
-- 
cgit v0.11.2-87-g4458