diff --git a/src/gui/gcal-calendar-button.ui b/src/gui/gcal-calendar-button.ui deleted file mode 100644 index f02379ca..00000000 --- a/src/gui/gcal-calendar-button.ui +++ /dev/null @@ -1,83 +0,0 @@ - - - - - -
- - list - -
-
- - _Synchronize Calendars - app.sync - - - _Manage Calendars… - win.show-calendars - -
-
- - - bottom - menu - - - - vertical - - - never - 450 - 800 - True - True - - - 800 - 800 - - - True - none - - - - - - - - - - - - -
diff --git a/src/gui/gcal-calendar-button.c b/src/gui/gcal-calendar-list.c similarity index 76% rename from src/gui/gcal-calendar-button.c rename to src/gui/gcal-calendar-list.c index d623c105..d33eeb11 100644 --- a/src/gui/gcal-calendar-button.c +++ b/src/gui/gcal-calendar-list.c @@ -1,4 +1,4 @@ -/* gcal-calendar-button.c +/* gcal-calendar-list.c * * Copyright 2019 Georges Basile Stavracas Neto * @@ -18,14 +18,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -#define G_LOG_DOMAIN "GcalCalendarButton" +#define G_LOG_DOMAIN "GcalCalendarList" +#include "gcal-calendar-list.h" #include "gcal-calendar.h" -#include "gcal-calendar-button.h" #include "gcal-context.h" #include "gcal-utils.h" -struct _GcalCalendarButton +struct _GcalCalendarList { AdwBin parent; @@ -34,7 +34,7 @@ struct _GcalCalendarButton GcalContext *context; }; -G_DEFINE_TYPE (GcalCalendarButton, gcal_calendar_button, ADW_TYPE_BIN) +G_DEFINE_TYPE (GcalCalendarList, gcal_calendar_list, ADW_TYPE_BIN) enum { @@ -71,9 +71,7 @@ create_row_func (gpointer data, calendar = GCAL_CALENDAR (data); - row = g_object_new (GTK_TYPE_LIST_BOX_ROW, - "css-name", "modelbutton", - NULL); + row = g_object_new (GTK_TYPE_LIST_BOX_ROW, NULL); /* main box */ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); @@ -123,9 +121,9 @@ create_row_func (gpointer data, */ static void -on_listbox_row_activated_cb (GtkListBox *listbox, - GtkListBoxRow *row, - GcalCalendarButton *self) +on_listbox_row_activated_cb (GtkListBox *listbox, + GtkListBoxRow *row, + GcalCalendarList *self) { GtkCheckButton *check = g_object_get_data (G_OBJECT (row), "check"); @@ -138,22 +136,22 @@ on_listbox_row_activated_cb (GtkListBox *listbox, */ static void -gcal_calendar_button_finalize (GObject *object) +gcal_calendar_list_finalize (GObject *object) { - GcalCalendarButton *self = (GcalCalendarButton *)object; + GcalCalendarList *self = (GcalCalendarList *) object; g_clear_object (&self->context); - G_OBJECT_CLASS (gcal_calendar_button_parent_class)->finalize (object); + G_OBJECT_CLASS (gcal_calendar_list_parent_class)->finalize (object); } static void -gcal_calendar_button_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +gcal_calendar_list_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GcalCalendarButton *self = GCAL_CALENDAR_BUTTON (object); + GcalCalendarList *self = GCAL_CALENDAR_LIST (object); switch (prop_id) { @@ -167,12 +165,12 @@ gcal_calendar_button_get_property (GObject *object, } static void -gcal_calendar_button_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +gcal_calendar_list_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GcalCalendarButton *self = GCAL_CALENDAR_BUTTON (object); + GcalCalendarList *self = GCAL_CALENDAR_LIST (object); switch (prop_id) { @@ -198,17 +196,17 @@ gcal_calendar_button_set_property (GObject *object, } static void -gcal_calendar_button_class_init (GcalCalendarButtonClass *klass) +gcal_calendar_list_class_init (GcalCalendarListClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - object_class->finalize = gcal_calendar_button_finalize; - object_class->get_property = gcal_calendar_button_get_property; - object_class->set_property = gcal_calendar_button_set_property; + object_class->finalize = gcal_calendar_list_finalize; + object_class->get_property = gcal_calendar_list_get_property; + object_class->set_property = gcal_calendar_list_set_property; /** - * GcalCalendarButton::context: + * GcalCalendarList::context: * * The #GcalContext of the application. */ @@ -220,15 +218,15 @@ gcal_calendar_button_class_init (GcalCalendarButtonClass *klass) g_object_class_install_properties (object_class, N_PROPS, properties); - gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-calendar-button.ui"); + gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/calendar/ui/gui/gcal-calendar-list.ui"); - gtk_widget_class_bind_template_child (widget_class, GcalCalendarButton, calendar_listbox); + gtk_widget_class_bind_template_child (widget_class, GcalCalendarList, calendar_listbox); gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated_cb); } static void -gcal_calendar_button_init (GcalCalendarButton *self) +gcal_calendar_list_init (GcalCalendarList *self) { gtk_widget_init_template (GTK_WIDGET (self)); } diff --git a/src/gui/gcal-calendar-button.h b/src/gui/gcal-calendar-list.h similarity index 81% rename from src/gui/gcal-calendar-button.h rename to src/gui/gcal-calendar-list.h index e5750e9a..99a72763 100644 --- a/src/gui/gcal-calendar-button.h +++ b/src/gui/gcal-calendar-list.h @@ -1,4 +1,4 @@ -/* gcal-calendar-button.h +/* gcal-calendar-list.h * * Copyright 2019 Georges Basile Stavracas Neto * @@ -24,7 +24,7 @@ G_BEGIN_DECLS -#define GCAL_TYPE_CALENDAR_BUTTON (gcal_calendar_button_get_type()) -G_DECLARE_FINAL_TYPE (GcalCalendarButton, gcal_calendar_button, GCAL, CALENDAR_BUTTON, AdwBin) +#define GCAL_TYPE_CALENDAR_LIST (gcal_calendar_list_get_type ()) +G_DECLARE_FINAL_TYPE (GcalCalendarList, gcal_calendar_list, GCAL, CALENDAR_LIST, AdwBin) G_END_DECLS diff --git a/src/gui/gcal-calendar-list.ui b/src/gui/gcal-calendar-list.ui new file mode 100644 index 00000000..83ff123d --- /dev/null +++ b/src/gui/gcal-calendar-list.ui @@ -0,0 +1,31 @@ + + + + diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c index 1954f175..7793a47b 100644 --- a/src/gui/gcal-window.c +++ b/src/gui/gcal-window.c @@ -20,8 +20,8 @@ #define G_LOG_DOMAIN "GcalWindow" #include "gcal-agenda-view.h" +#include "gcal-calendar-list.h" #include "gcal-calendar-management-dialog.h" -#include "gcal-calendar-button.h" #include "config.h" #include "gcal-date-chooser.h" #include "gcal-debug.h" @@ -115,7 +115,7 @@ struct _GcalWindow AdwNavigationSplitView *split_view; /* header_bar widgets */ - GtkWidget *calendars_button; + GtkWidget *calendars_list; GtkWidget *menu_button; GtkWidget *views_switcher; @@ -1116,7 +1116,7 @@ gcal_window_constructed (GObject *object) * FIXME: this is a hack around the issue that happens when trying to bind * these properties using the GtkBuilder .ui file. */ - g_object_bind_property (self, "context", self->calendars_button, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); + g_object_bind_property (self, "context", self->calendars_list, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->weather_settings, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->week_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->month_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); @@ -1251,7 +1251,7 @@ gcal_window_class_init (GcalWindowClass *klass) GtkWidgetClass *widget_class; g_type_ensure (GCAL_TYPE_AGENDA_VIEW); - g_type_ensure (GCAL_TYPE_CALENDAR_BUTTON); + g_type_ensure (GCAL_TYPE_CALENDAR_LIST); g_type_ensure (GCAL_TYPE_DATE_CHOOSER); g_type_ensure (GCAL_TYPE_EVENT_EDITOR_DIALOG); g_type_ensure (GCAL_TYPE_MANAGER); @@ -1305,7 +1305,7 @@ gcal_window_class_init (GcalWindowClass *klass) /* widgets */ gtk_widget_class_bind_template_child (widget_class, GcalWindow, agenda_view); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, calendars_button); + gtk_widget_class_bind_template_child (widget_class, GcalWindow, calendars_list); gtk_widget_class_bind_template_child (widget_class, GcalWindow, date_chooser); gtk_widget_class_bind_template_child (widget_class, GcalWindow, event_editor); gtk_widget_class_bind_template_child (widget_class, GcalWindow, header_bar); diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui index 7efd9db3..e987c477 100644 --- a/src/gui/gcal-window.ui +++ b/src/gui/gcal-window.ui @@ -117,6 +117,12 @@ action(app.sync) + + + F8 + action(win.show-calendars) + + @@ -158,9 +164,6 @@ - - - open-menu-symbolic @@ -363,6 +366,16 @@ +
+ + _Synchronize Calendars + app.sync + + + _Manage Calendars + win.show-calendars + +
_Date & Time Settings… diff --git a/src/gui/gui.gresource.xml b/src/gui/gui.gresource.xml index 1abfeff8..60a4c1df 100644 --- a/src/gui/gui.gresource.xml +++ b/src/gui/gui.gresource.xml @@ -1,7 +1,7 @@ - gcal-calendar-button.ui + gcal-calendar-list.ui gcal-event-popover.ui gcal-event-widget.ui gcal-meeting-row.ui diff --git a/src/gui/meson.build b/src/gui/meson.build index 930500cb..413a5258 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -16,7 +16,7 @@ built_sources += gnome.compile_resources( sources += files( 'gcal-application.c', - 'gcal-calendar-button.c', + 'gcal-calendar-list.c', 'gcal-drop-overlay.c', 'gcal-event-popover.c', 'gcal-event-widget.c', diff --git a/src/theme/style.css b/src/theme/style.css index 7de44781..f6f6eeed 100644 --- a/src/theme/style.css +++ b/src/theme/style.css @@ -386,6 +386,21 @@ syncindicator { padding: 6px; } +/* + * Calendar list-style + */ + +/* per https://gitlab.gnome.org/GNOME/libadwaita/-/blob/1ff329681652fa99ecac89092d7639063a5972cc/src/stylesheet/widgets/_menus.scss */ +.calendar-list check { + min-width: 14px; + min-height: 14px; + -gtk-icon-size: 14px; + padding: 2px; + background: none; + box-shadow: none; + color: inherit; +} + /* * Styles for the drop overlay. * From Amberol https://gitlab.gnome.org/World/amberol/-/blob/0dd6250ffd294b14532c428dcb76ae42086a5923/src/gtk/style.css