diff src/bar.c @ 2570:aaca094d2f32

Bug fix: GPS map expander When the expander for the GPS map was closed, the map continued to be displayed. The reason is unknown. This commit uses the expander signal to explicitly show or hide the child of the expander.
author Colin Clark <colin.clark@cclark.uk>
date Sat, 05 Aug 2017 17:36:05 +0100
parents eb2ce489ceea
children df15eef16238
line wrap: on
line diff
--- a/src/bar.c	Sat Aug 05 10:57:44 2017 +0100
+++ b/src/bar.c	Sat Aug 05 17:36:05 2017 +0100
@@ -364,6 +364,24 @@
 	return FALSE;
 }
 
+static void bar_expander_cb(GObject *object, GParamSpec *param_spec, gpointer data)
+{
+	GtkExpander *expander;
+	GtkWidget *child;
+
+	expander = GTK_EXPANDER(object);
+	child = gtk_bin_get_child(GTK_BIN(expander));
+
+	if (gtk_expander_get_expanded(expander))
+		{
+		gtk_widget_show_all(child);
+		}
+	else
+		{
+		gtk_widget_hide(child);
+		}
+}
+
 static gboolean bar_menu_add_cb(GtkWidget *widget, GdkEventButton *bevent, gpointer data)
 {
 	bar_menu_add_popup(widget);
@@ -563,6 +581,7 @@
 	gtk_box_pack_start(GTK_BOX(bd->vbox), expander, FALSE, TRUE, 0);
 
 	g_signal_connect(expander, "button_release_event", G_CALLBACK(bar_menu_cb), bd);
+	g_signal_connect(expander, "notify::expanded", G_CALLBACK(bar_expander_cb), pd);
 
 	gtk_container_add(GTK_CONTAINER(expander), pane);