summaryrefslogtreecommitdiff
path: root/src/gui/editor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/editor.c')
-rw-r--r--src/gui/editor.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gui/editor.c b/src/gui/editor.c
index b4e13b0..e5a16d1 100644
--- a/src/gui/editor.c
+++ b/src/gui/editor.c
@@ -92,6 +92,9 @@ static gboolean on_key_event(GtkWidget *, GdkEventKey *, GObject *);
/* ------------------------ INTEGRATION DE LA BARRE D'OUTILS ------------------------ */
+/* Suit les évolutions d'affichage dans la barre d'outils. */
+static void on_toolbar_item_visibility_change(GtkWidget *, GtkToolbar *);
+
/* Construit la barre d'outils de l'éditeur. */
static GtkWidget *build_editor_toolbar(GObject *);
@@ -565,6 +568,40 @@ static gboolean on_key_event(GtkWidget *widget, GdkEventKey *event, GObject *ref
/******************************************************************************
* *
+* Paramètres : widget = composant graphique dont l'affichage a basculé. *
+* toolbar = barre d'outils à mettre à jour. *
+* *
+* Description : Suit les évolutions d'affichage dans la barre d'outils. *
+* *
+* Retour : - *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static void on_toolbar_item_visibility_change(GtkWidget *widget, GtkToolbar *toolbar)
+{
+ bool show; /* Impose un affichage */
+
+ show = false;
+
+ void visit_all_tb_items(GtkWidget *w, gpointer unused)
+ {
+ show |= gtk_widget_get_visible(w);
+ }
+
+ gtk_container_foreach(GTK_CONTAINER(toolbar), visit_all_tb_items, NULL);
+
+ if (show)
+ gtk_widget_show(GTK_WIDGET(toolbar));
+ else
+ gtk_widget_hide(GTK_WIDGET(toolbar));
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : ref = espace de référencement global. *
* *
* Description : Construit la barre d'outils de l'éditeur. *
@@ -587,6 +624,14 @@ static GtkWidget *build_editor_toolbar(GObject *ref)
item = create_portions_tb_item(ref);
register_editor_item(item);
+ void track_tb_items_visibility(GtkWidget *widget, gpointer unused)
+ {
+ g_signal_connect(widget, "hide", G_CALLBACK(on_toolbar_item_visibility_change), result);
+ g_signal_connect(widget, "show", G_CALLBACK(on_toolbar_item_visibility_change), result);
+ }
+
+ gtk_container_foreach(GTK_CONTAINER(result), track_tb_items_visibility, NULL);
+
return result;
}