summaryrefslogtreecommitdiff
path: root/src/gui/panels/panel.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/panels/panel.c')
-rw-r--r--src/gui/panels/panel.c108
1 files changed, 99 insertions, 9 deletions
diff --git a/src/gui/panels/panel.c b/src/gui/panels/panel.c
index 8a46025..7f18fea 100644
--- a/src/gui/panels/panel.c
+++ b/src/gui/panels/panel.c
@@ -40,6 +40,7 @@
#include "symbols.h"
#include "welcome.h"
#include "../../gtkext/easygtk.h"
+#include "../../gtkext/gtkdockable-int.h"
#include "../../gtkext/gtkdockstation.h"
@@ -67,6 +68,18 @@ static void g_panel_item_class_init(GPanelItemClass *);
/* Initialise une instance d'élément réactif pour l'éditeur. */
static void g_panel_item_init(GPanelItem *);
+/* Procède à l'initialisation de l'interface de rassemblement. */
+static void g_panel_item_dockable_interface_init(GtkDockableInterface *);
+
+/* Fournit le nom court du composant encapsulable. */
+static const char *gtk_panel_item_get_name(const GPanelItem *);
+
+/* Fournit le nom long du composant encapsulable. */
+static const char *gtk_panel_item_get_desc(const GPanelItem *);
+
+/* Fournit le composant graphique intégrable dans un ensemble. */
+static GtkWidget *gtk_panel_item_get_widget(GPanelItem *);
+
/* ---------------------- MECANISMES DE PLACEMENT DES PANNEAUX ---------------------- */
@@ -129,7 +142,8 @@ static void on_docking_to_main_panel(GtkDockStation *, GtkWidget *, gpointer);
/* Indique le type défini pour un élément destiné à un panneau. */
-G_DEFINE_TYPE(GPanelItem, g_panel_item, G_TYPE_EDITOR_ITEM);
+G_DEFINE_TYPE_WITH_CODE(GPanelItem, g_panel_item, G_TYPE_EDITOR_ITEM,
+ G_IMPLEMENT_INTERFACE(GTK_TYPE_DOCKABLE, g_panel_item_dockable_interface_init))
/******************************************************************************
@@ -171,6 +185,31 @@ static void g_panel_item_init(GPanelItem *item)
/******************************************************************************
* *
+* Paramètres : iface = interface GTK à initialiser. *
+* *
+* Description : Procède à l'initialisation de l'interface de rassemblement. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void g_panel_item_dockable_interface_init(GtkDockableInterface *iface)
+{
+ iface->can_search = false;
+ iface->can_be_closed = true;
+
+ iface->get_name = (get_dockable_name_fc)gtk_panel_item_get_name;
+ iface->get_desc = (get_dockable_desc_fc)gtk_panel_item_get_desc;
+ iface->get_widget = (get_dockable_widget_fc)gtk_panel_item_get_widget;
+ iface->update_filtered = (update_filtered_data_fc)NULL;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : item = composant à présenter à l'affichage. *
* ref = espace de référencement global. *
* name = nom associé à l'élément. *
@@ -240,6 +279,63 @@ GEditorItem *g_panel_item_new(GObject *ref, const char *name, const char *lname,
/******************************************************************************
* *
+* Paramètres : item = instance GTK dont l'interface est à consulter. *
+* *
+* Description : Fournit le nom court du composant encapsulable. *
+* *
+* Retour : Désignation humaine pour titre d'onglet ou de fenêtre. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *gtk_panel_item_get_name(const GPanelItem *item)
+{
+ return G_EDITOR_ITEM(item)->name;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance GTK dont l'interface est à consulter. *
+* *
+* Description : Fournit le nom long du composant encapsulable. *
+* *
+* Retour : Désignation humaine pour titre d'onglet ou de fenêtre. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static const char *gtk_panel_item_get_desc(const GPanelItem *item)
+{
+ return item->lname;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : item = instance GTK dont l'interface est à consulter. *
+* *
+* Description : Fournit le composant graphique intégrable dans un ensemble. *
+* *
+* Retour : Composant graphique prêt à emploi. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static GtkWidget *gtk_panel_item_get_widget(GPanelItem *item)
+{
+ return G_EDITOR_ITEM(item)->widget;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : name = désignation courte servant de clef. *
* *
* Description : Recherche un panneau à partir de son nom court. *
@@ -423,7 +519,6 @@ static panel_node *create_simple_panel_node_for_item(GPanelItem *item, const cha
{
panel_node *result; /* Structure à retourner */
GtkWidget *station; /* Premier support concentré */
- GEditorItem *editem; /* Autre vision des choses */
result = (panel_node *)calloc(1, sizeof(panel_node));
@@ -438,9 +533,7 @@ static panel_node *create_simple_panel_node_for_item(GPanelItem *item, const cha
result->station = station;
- editem = G_EDITOR_ITEM(item);
- gtk_dock_panel_add_widget(GTK_DOCK_STATION(station),
- editem->widget, editem->name, item->lname);
+ gtk_dock_station_add_dockable(GTK_DOCK_STATION(station), GTK_DOCKABLE(item));
return result;
@@ -695,10 +788,7 @@ static void insert_item_as_panel_node(GPanelItem *item, panel_node *node, const
{
/* Le parcours s'arrête ici ! */
if (strcmp(node->path, path) == 0)
- gtk_dock_panel_add_widget(GTK_DOCK_STATION(node->station),
- G_EDITOR_ITEM(item)->widget,
- G_EDITOR_ITEM(item)->name,
- item->lname);
+ gtk_dock_station_add_dockable(GTK_DOCK_STATION(node->station), GTK_DOCKABLE(item));
/* On ne peut aller plus loin, on doit diviser... */
else