edit-dialog: put the time selectors in a revealer

This commit is contained in:
Georges Basile Stavracas Neto
2016-07-06 18:54:59 -03:00
parent 5dd456c81d
commit a5634dc5fb
2 changed files with 71 additions and 37 deletions
+61 -37
View File
@@ -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"/>
@@ -147,24 +147,10 @@
<property name="top_attach">1</property>
</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" />
<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="GtkLabel">
<object class="GtkBox">
<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" />
<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>
+10
View File
@@ -285,6 +285,15 @@ fix_reminders_label_height_cb (GtkWidget *summary_label,
gtk_widget_set_size_request (reminders_label, -1, allocation->height);
}
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,
@@ -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