calendar-row: Add read-only icon for read-only calendars

Co-authored-by: Gotam Gorabh <gautamy672@gmail.com>
This commit is contained in:
Hari Rana
2023-12-14 02:46:56 +00:00
committed by Jean-François Fortin Tam
co-authored by Gotam Gorabh
parent c0e258b6e4
commit 303c5fd0fe
2 changed files with 16 additions and 0 deletions
@@ -13,6 +13,16 @@
</object>
</child>
<!-- Lock icon for read-only calendars -->
<child type="suffix">
<object class="GtkImage" id="read_only_icon">
<property name="tooltip-text" translatable="yes">Read-only Calendar</property>
<property name="icon-name">changes-prevent-symbolic</property>
<property name="pixel-size">20</property>
<property name="valign">center</property>
</object>
</child>
<child type="suffix">
<object class="GtkSwitch" id="switch">
<property name="valign">center</property>
@@ -22,6 +22,7 @@
#include <glib/gi18n.h>
#include "gcal-calendar.h"
#include "gcal-context.h"
#include "gcal-calendar-management-page.h"
#include "gcal-calendars-page.h"
@@ -70,6 +71,7 @@ make_calendar_row (GcalCalendarsPage *self,
g_autoptr (GdkPaintable) color_paintable = NULL;
g_autofree gchar *parent_name = NULL;
g_autoptr (GtkBuilder) builder = NULL;
GtkWidget *read_only_icon;
const GdkRGBA *color;
GcalManager *manager;
GtkWidget *icon;
@@ -88,6 +90,10 @@ make_calendar_row (GcalCalendarsPage *self,
*/
row = g_object_ref (GTK_WIDGET (gtk_builder_get_object (builder, "row")));
/* read-only icon */
read_only_icon = GTK_WIDGET (gtk_builder_get_object (builder, "read_only_icon"));
gtk_widget_set_visible (read_only_icon, gcal_calendar_is_read_only (calendar));
/* source color icon */
color = gcal_calendar_get_color (calendar);
color_paintable = get_circle_paintable_from_color (color, 24);