From 30a6f5facd7bdb45aaeb77a51ea77f2a7f3504ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Mon, 3 Nov 2014 23:57:44 +0200 Subject: clock: properly handle visibility of edit button Fixes https://github.com/mate-desktop/mate-panel/issues/570 taken from: https://git.gnome.org/browse/gnome-panel/commit/?id=cc99dca --- applets/clock/calendar-window.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c index 4f82f67a..3c3b0566 100644 --- a/applets/clock/calendar-window.c +++ b/applets/clock/calendar-window.c @@ -185,9 +185,7 @@ create_hig_frame (CalendarWindow *calwin, GtkWidget *vbox; GtkWidget *label; GtkWidget *hbox; - GtkWidget *button; char *bold_title; - char *text; GtkWidget *expander; vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); @@ -215,7 +213,16 @@ create_hig_frame (CalendarWindow *calwin, g_signal_connect (hbox, "add", G_CALLBACK (add_child), expander); if (button_label) { + GtkWidget *button_box; + GtkWidget *button; + gchar *text; + + button_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); + gtk_widget_show (button_box); + button = gtk_button_new (); + gtk_container_add (GTK_CONTAINER (button_box), button); + text = g_markup_printf_escaped ("%s", button_label); label = gtk_label_new (text); g_free (text); @@ -224,9 +231,13 @@ create_hig_frame (CalendarWindow *calwin, gtk_widget_show_all (button); - gtk_box_pack_end (GTK_BOX (hbox), button, FALSE, FALSE, 0); + gtk_box_pack_end (GTK_BOX (hbox), button_box, FALSE, FALSE, 0); g_signal_connect_swapped (button, "clicked", callback, calwin); + + g_object_bind_property (expander, "expanded", + button_box, "visible", + G_BINDING_DEFAULT|G_BINDING_SYNC_CREATE); } g_settings_bind (calwin->priv->settings, key, expander, "expanded", -- cgit v1.2.1