diff --git a/po/POTFILES.in b/po/POTFILES.in index 5c958bd1..fa196aa8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -42,7 +42,6 @@ src/gui/gcal-quick-add-popover.c src/gui/gcal-quick-add-popover.ui src/gui/gcal-search-button.ui src/gui/gcal-sync-indicator.ui -src/gui/gcal-toolbar-end.ui src/gui/gcal-weather-settings.ui src/gui/gcal-window.c src/gui/gcal-window.ui diff --git a/src/gui/gcal-toolbar-end.c b/src/gui/gcal-toolbar-end.c deleted file mode 100644 index 2ebbf23d..00000000 --- a/src/gui/gcal-toolbar-end.c +++ /dev/null @@ -1,142 +0,0 @@ -/* gcal-toolbar-end.c - * - * Copyright 2022 Christopher Davis - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -#include "gcal-context.h" -#include "gcal-search-button.h" -#include "gcal-toolbar-end.h" - -struct _GcalToolbarEnd -{ - AdwBin parent_instance; - - GcalSearchButton *search_button; - - GcalContext *context; -}; - -G_DEFINE_FINAL_TYPE (GcalToolbarEnd, gcal_toolbar_end, ADW_TYPE_BIN) - -enum -{ - PROP_0, - PROP_CONTEXT, - N_PROPS -}; - -static GParamSpec *properties [N_PROPS]; - - -/* - * GObject overrides - */ - -static void -gcal_toolbar_end_finalize (GObject *object) -{ - GcalToolbarEnd *self = (GcalToolbarEnd *)object; - - g_clear_object (&self->context); - - G_OBJECT_CLASS (gcal_toolbar_end_parent_class)->finalize (object); -} - -static void -gcal_toolbar_end_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) -{ - GcalToolbarEnd *self = GCAL_TOOLBAR_END (object); - - switch (prop_id) - { - case PROP_CONTEXT: - g_value_set_object (value, self->context); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -gcal_toolbar_end_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) -{ - GcalToolbarEnd *self = GCAL_TOOLBAR_END (object); - - switch (prop_id) - { - case PROP_CONTEXT: - g_assert (self->context == NULL); - self->context = g_value_dup_object (value); - g_object_bind_property (self, "context", self->search_button, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - break; - - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); - } -} - -static void -gcal_toolbar_end_class_init (GcalToolbarEndClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); - - object_class->finalize = gcal_toolbar_end_finalize; - object_class->get_property = gcal_toolbar_end_get_property; - object_class->set_property = gcal_toolbar_end_set_property; - - /** - * GcalToolbarEnd::context: - * - * The #GcalContext of the application. - */ - properties[PROP_CONTEXT] = g_param_spec_object ("context", - "Context of the application", - "The context of the application", - GCAL_TYPE_CONTEXT, - G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS); - - 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-toolbar-end.ui"); - - gtk_widget_class_bind_template_child (widget_class, GcalToolbarEnd, search_button); -} - -static void -gcal_toolbar_end_init (GcalToolbarEnd *self) -{ - g_type_ensure (GCAL_TYPE_SEARCH_BUTTON); - - gtk_widget_init_template (GTK_WIDGET (self)); -} - -GtkWidget * -gcal_toolbar_end_get_search_button (GcalToolbarEnd *self) -{ - g_return_val_if_fail (GCAL_IS_TOOLBAR_END (self), NULL); - - return GTK_WIDGET (self->search_button); -} diff --git a/src/gui/gcal-toolbar-end.h b/src/gui/gcal-toolbar-end.h deleted file mode 100644 index bb24043f..00000000 --- a/src/gui/gcal-toolbar-end.h +++ /dev/null @@ -1,33 +0,0 @@ -/* gcal-toolbar-end.h - * - * Copyright 2022 Christopher Davis - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - * SPDX-License-Identifier: GPL-3.0-or-later - */ - - -#pragma once - -#include - -G_BEGIN_DECLS - -#define GCAL_TYPE_TOOLBAR_END (gcal_toolbar_end_get_type()) -G_DECLARE_FINAL_TYPE (GcalToolbarEnd, gcal_toolbar_end, GCAL, TOOLBAR_END, AdwBin) - -GtkWidget * gcal_toolbar_end_get_search_button (GcalToolbarEnd *self); - -G_END_DECLS diff --git a/src/gui/gcal-toolbar-end.ui b/src/gui/gcal-toolbar-end.ui deleted file mode 100644 index d2fa3a0a..00000000 --- a/src/gui/gcal-toolbar-end.ui +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c index 7793a47b..1e46ad61 100644 --- a/src/gui/gcal-window.c +++ b/src/gui/gcal-window.c @@ -22,6 +22,7 @@ #include "gcal-agenda-view.h" #include "gcal-calendar-list.h" #include "gcal-calendar-management-dialog.h" +#include "gcal-calendar-navigation-button.h" #include "config.h" #include "gcal-date-chooser.h" #include "gcal-debug.h" @@ -36,7 +37,6 @@ #include "gcal-sync-indicator.h" #include "gcal-timeline.h" #include "gcal-timeline-subscriber.h" -#include "gcal-toolbar-end.h" #include "gcal-view.h" #include "gcal-weather-settings.h" #include "gcal-week-view.h" @@ -110,14 +110,12 @@ struct _GcalWindow GtkWidget *agenda_view; GtkWidget *date_chooser; GcalSyncIndicator *sync_indicator; - GcalToolbarEnd *toolbar_end; - GcalToolbarEnd *sidebar_toolbar_end; + GtkWidget *search_button; AdwNavigationSplitView *split_view; /* header_bar widgets */ GtkWidget *calendars_list; GtkWidget *menu_button; - GtkWidget *views_switcher; GcalEventEditorDialog *event_editor; GtkWidget *import_dialog; @@ -1050,7 +1048,6 @@ gcal_window_finalize (GObject *object) } g_clear_object (&window->context); - g_clear_object (&window->views_switcher); gcal_clear_date_time (&window->active_date); @@ -1125,8 +1122,7 @@ gcal_window_constructed (GObject *object) g_object_bind_property (self, "context", self->event_editor, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->quick_add_popover, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); g_object_bind_property (self, "context", self->sync_indicator, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - g_object_bind_property (self, "context", self->toolbar_end, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); - g_object_bind_property (self, "context", self->sidebar_toolbar_end, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); + g_object_bind_property (self, "context", self->search_button, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); /* CSS */ load_css_providers (self); @@ -1252,13 +1248,14 @@ gcal_window_class_init (GcalWindowClass *klass) g_type_ensure (GCAL_TYPE_AGENDA_VIEW); g_type_ensure (GCAL_TYPE_CALENDAR_LIST); + g_type_ensure (GCAL_TYPE_CALENDAR_NAVIGATION_BUTTON); g_type_ensure (GCAL_TYPE_DATE_CHOOSER); g_type_ensure (GCAL_TYPE_EVENT_EDITOR_DIALOG); g_type_ensure (GCAL_TYPE_MANAGER); g_type_ensure (GCAL_TYPE_MONTH_VIEW); g_type_ensure (GCAL_TYPE_QUICK_ADD_POPOVER); g_type_ensure (GCAL_TYPE_SYNC_INDICATOR); - g_type_ensure (GCAL_TYPE_TOOLBAR_END); + g_type_ensure (GCAL_TYPE_SEARCH_BUTTON); g_type_ensure (GCAL_TYPE_WEATHER_SETTINGS); g_type_ensure (GCAL_TYPE_WEEK_VIEW); g_type_ensure (GCAL_TYPE_DROP_OVERLAY); @@ -1313,12 +1310,10 @@ gcal_window_class_init (GcalWindowClass *klass) gtk_widget_class_bind_template_child (widget_class, GcalWindow, month_view); gtk_widget_class_bind_template_child (widget_class, GcalWindow, quick_add_popover); gtk_widget_class_bind_template_child (widget_class, GcalWindow, overlay); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, sidebar_toolbar_end); gtk_widget_class_bind_template_child (widget_class, GcalWindow, split_view); gtk_widget_class_bind_template_child (widget_class, GcalWindow, sync_indicator); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, toolbar_end); + gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_button); gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_stack); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_switcher); gtk_widget_class_bind_template_child (widget_class, GcalWindow, weather_settings); gtk_widget_class_bind_template_child (widget_class, GcalWindow, week_view); gtk_widget_class_bind_template_child (widget_class, GcalWindow, drop_overlay); @@ -1420,18 +1415,9 @@ void gcal_window_set_search_query (GcalWindow *self, const gchar *query) { - GtkWidget *search_button; - GcalToolbarEnd *toolbar_end; - g_return_if_fail (GCAL_IS_WINDOW (self)); - if (adw_navigation_split_view_get_collapsed (self->split_view)) - toolbar_end = self->sidebar_toolbar_end; - else - toolbar_end = self->toolbar_end; - - search_button = gcal_toolbar_end_get_search_button (toolbar_end); - gcal_search_button_search (GCAL_SEARCH_BUTTON (search_button), query); + gcal_search_button_search (GCAL_SEARCH_BUTTON (self->search_button), query); } /** diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui index e987c477..b76ea4c4 100644 --- a/src/gui/gcal-window.ui +++ b/src/gui/gcal-window.ui @@ -160,19 +160,7 @@ - - - - - - - open-menu-symbolic - win_menu - Main Menu - True - - - + @@ -201,8 +189,6 @@ - False - @@ -224,27 +210,26 @@ - - win.today - - - _Today - True - calendar-today-symbolic - True - Go to Today - - - + - - views_stack - wide + + + - + + open-menu-symbolic + win_menu + Main Menu + True + + + + + Search + @@ -325,8 +310,29 @@ + + + + + views_stack + wide + + + + - + + list-add-symbolic + win.new-event + Add Event + + + + + x-office-calendar-symbolic + Manage Calendars + win.show-calendars + @@ -342,13 +348,26 @@ + + + max-width: 1000sp + True + view_switcher_narrow + + + max-width: 700sp True - False - True + False + False + False + + + + False False False @@ -356,6 +375,15 @@ + + + + views_stack + icons + + @@ -371,10 +399,6 @@ _Synchronize Calendars app.sync - - _Manage Calendars - win.show-calendars -
diff --git a/src/gui/gui.gresource.xml b/src/gui/gui.gresource.xml index 249e3594..50e5a092 100644 --- a/src/gui/gui.gresource.xml +++ b/src/gui/gui.gresource.xml @@ -9,7 +9,6 @@ gcal-quick-add-popover.ui gcal-search-button.ui gcal-sync-indicator.ui - gcal-toolbar-end.ui gcal-weather-settings.ui gcal-window.ui diff --git a/src/gui/meson.build b/src/gui/meson.build index 80b88e98..5e799494 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -27,7 +27,6 @@ sources += files( 'gcal-quick-add-popover.c', 'gcal-search-button.c', 'gcal-sync-indicator.c', - 'gcal-toolbar-end.c', 'gcal-weather-settings.c', 'gcal-window.c', )