calendars-page: Use switch to toggle visibility

parent c0924453
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment