[gnome-calendar] edit-dialog: put the time selectors in a revealer



commit a5634dc5fb1e91f4c35935c269e7eced52e5b5b7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jul 6 18:02:01 2016 -0300

    edit-dialog: put the time selectors in a revealer

 data/ui/edit-dialog.ui |   98 ++++++++++++++++++++++++++++++------------------
 src/gcal-edit-dialog.c |   10 +++++
 2 files changed, 71 insertions(+), 37 deletions(-)
---
diff --git a/data/ui/edit-dialog.ui b/data/ui/edit-dialog.ui
index d5efdf3..f09ae93 100644
--- a/data/ui/edit-dialog.ui
+++ b/data/ui/edit-dialog.ui
@@ -120,7 +120,7 @@
             <child>
               <object class="GtkLabel" id="summary_label">
                 <property name="visible">True</property>
-                <property name="halign">end</property>
+                <property name="xalign">1.0</property>
                 <property name="label" translatable="yes">Title</property>
                 <property name="ellipsize">end</property>
                 <signal name="size-allocate" handler="fix_reminders_label_height_cb" 
object="reminders_label" swapped="no" after="yes" />
@@ -136,7 +136,7 @@
             <child>
               <object class="GtkLabel" id="dates_label">
                 <property name="visible">True</property>
-                <property name="halign">end</property>
+                <property name="xalign">1.0</property>
                 <property name="label" translatable="yes">Date</property>
                 <style>
                   <class name="dim-label"/>
@@ -148,23 +148,9 @@
               </packing>
             </child>
             <child>
-              <object class="GtkLabel" id="times_label">
-                <property name="visible">True</property>
-                <property name="halign">end</property>
-                <property name="label" translatable="yes">Time</property>
-                <style>
-                  <class name="dim-label"/>
-                </style>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">2</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkLabel" id="reminders_label">
                 <property name="visible">True</property>
-                <property name="halign">end</property>
+                <property name="xalign">1.0</property>
                 <property name="valign">start</property>
                 <property name="label" translatable="yes">Reminders</property>
                 <property name="ellipsize">end</property>
@@ -180,7 +166,7 @@
             <child>
               <object class="GtkLabel" id="notes_label">
                 <property name="visible">True</property>
-                <property name="halign">end</property>
+                <property name="xalign">1.0</property>
                 <property name="valign">start</property>
                 <property name="label" translatable="yes">Notes</property>
                 <style>
@@ -195,7 +181,7 @@
             <child>
               <object class="GtkLabel" id="location_label">
                 <property name="visible">True</property>
-                <property name="halign">end</property>
+                <property name="xalign">1.0</property>
                 <property name="label" translatable="yes">Location</property>
                 <style>
                   <class name="dim-label"/>
@@ -257,37 +243,75 @@
               </packing>
             </child>
             <child>
-              <object class="GtkBox">
+              <object class="GtkRevealer">
                 <property name="visible">True</property>
-                <property name="spacing">6</property>
+                <property name="reveal_child" bind-source="all_day_check" bind-property="active" 
bind-flags="default|invert-boolean|sync-create" />
+                <signal name="notify::child-revealed" handler="update_revealer_visibility_cb" swapped="no" />
+                <signal name="notify::reveal-child" handler="update_revealer_visibility_cb" swapped="no" />
                 <child>
-                  <object class="GcalTimeSelector" id="start_time_selector">
+                  <object class="GtkLabel" id="times_label">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
-                  </object>
-                </child>
-                <child>
-                  <object class="GtkLabel">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label">-</property>
+                    <property name="xalign">1.0</property>
+                    <property name="label" translatable="yes">Time</property>
+                    <style>
+                      <class name="dim-label"/>
+                    </style>
                   </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                  </packing>
                 </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRevealer">
+                <property name="visible">True</property>
+                <property name="reveal_child" bind-source="all_day_check" bind-property="active" 
bind-flags="default|invert-boolean|sync-create" />
+                <signal name="notify::child-revealed" handler="update_revealer_visibility_cb" swapped="no" />
+                <signal name="notify::reveal-child" handler="update_revealer_visibility_cb" swapped="no" />
                 <child>
-                  <object class="GcalTimeSelector" id="end_time_selector">
+                  <object class="GtkBox">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="hexpand">True</property>
-                    <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GcalTimeSelector" id="start_time_selector">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">-</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GcalTimeSelector" id="end_time_selector">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="sensitive" bind-source="GcalEditDialog" bind-property="writable" 
bind-flags="default" />
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                 </child>
               </object>
               <packing>
                 <property name="left_attach">1</property>
                 <property name="top_attach">2</property>
-                <property name="width">4</property>
               </packing>
             </child>
             <child>
diff --git a/src/gcal-edit-dialog.c b/src/gcal-edit-dialog.c
index 61ced98..3e7569f 100644
--- a/src/gcal-edit-dialog.c
+++ b/src/gcal-edit-dialog.c
@@ -286,6 +286,15 @@ fix_reminders_label_height_cb (GtkWidget    *summary_label,
 }
 
 static void
+update_revealer_visibility_cb (GtkRevealer *revealer)
+{
+  if (gtk_revealer_get_reveal_child (revealer))
+    gtk_widget_set_visible (GTK_WIDGET (revealer), TRUE);
+  else if (!gtk_revealer_get_child_revealed (revealer))
+    gtk_widget_set_visible (GTK_WIDGET (revealer), FALSE);
+}
+
+static void
 gcal_edit_dialog_get_property (GObject    *object,
                                guint       prop_id,
                                GValue     *value,
@@ -432,6 +441,7 @@ gcal_edit_dialog_class_init (GcalEditDialogClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, gcal_edit_dialog_all_day_changed);
   gtk_widget_class_bind_template_callback (widget_class, update_summary);
   gtk_widget_class_bind_template_callback (widget_class, update_location);
+  gtk_widget_class_bind_template_callback (widget_class, update_revealer_visibility_cb);
 }
 
 static void


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