[gnome-panel] clock: properly handle visibility of edit button



commit cc99dca11f8c0c86590bfecd017a953208d6f837
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Mon Nov 3 23:57:44 2014 +0200

    clock: properly handle visibility of edit button

 applets/clock/calendar-window.c |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/applets/clock/calendar-window.c b/applets/clock/calendar-window.c
index e2dd233..7031920 100644
--- a/applets/clock/calendar-window.c
+++ b/applets/clock/calendar-window.c
@@ -1501,9 +1501,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);
@@ -1530,7 +1528,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 ("<small>%s</small>", button_label);
                 label = gtk_label_new (text);
                 g_free (text);
@@ -1539,18 +1546,26 @@ 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);
 
-               if (bind_to_locked_down)
-                       g_object_bind_property (calwin, "locked-down",
-                                               button, "visible",
-                                               
G_BINDING_DEFAULT|G_BINDING_INVERT_BOOLEAN|G_BINDING_SYNC_CREATE);
+                g_object_bind_property (expander, "expanded",
+                                        button_box, "visible",
+                                        G_BINDING_DEFAULT|G_BINDING_SYNC_CREATE);
+
+                if (bind_to_locked_down) {
+                        g_object_bind_property (calwin, "locked-down",
+                                                button, "visible",
+                                                G_BINDING_DEFAULT |
+                                                G_BINDING_INVERT_BOOLEAN |
+                                                G_BINDING_SYNC_CREATE);
+                }
         }
 
-       g_settings_bind (calwin->priv->settings, key, expander, "expanded",
-                        G_SETTINGS_BIND_DEFAULT);
+        g_settings_bind (calwin->priv->settings, key,
+                         expander, "expanded",
+                         G_SETTINGS_BIND_DEFAULT);
 
         return vbox;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]