calendars-page: Use switch to toggle visibility

This commit is contained in:
Georges Basile Stavracas Neto
2019-06-24 21:32:59 -03:00
parent c092445363
commit efa29b19d5
2 changed files with 21 additions and 0 deletions
+16
View File
@@ -53,6 +53,22 @@
<property name="top_attach">0</property>
</packing>
</child>
<!-- Visibility switch -->
<child>
<object class="GtkSwitch" id="switch">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="halign">end</property>
<property name="valign">center</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
<property name="height">2</property>
</packing>
</child>
</object>
</child>
</object>
@@ -79,6 +79,7 @@ make_calendar_row (GcalCalendarsPage *self,
GtkWidget *top_label;
GtkWidget *icon;
GtkWidget *row;
GtkWidget *sw;
manager = gcal_context_get_manager (self->context);
get_source_parent_name_color (manager, gcal_calendar_get_source (calendar), &parent_name, NULL);
@@ -113,6 +114,10 @@ make_calendar_row (GcalCalendarsPage *self,
icon,
0);
/* visibility switch */
sw = GTK_WIDGET (gtk_builder_get_object (builder, "switch"));
g_object_bind_property (calendar, "visible", sw, "active", G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
/* parent source name label */
bottom_label = GTK_WIDGET (gtk_builder_get_object (builder, "subtitle"));
gtk_label_set_label (GTK_LABEL (bottom_label), parent_name);