diff --git a/src/gui/gcal-toolbar-end.c b/src/gui/gcal-toolbar-end.c new file mode 100644 index 00000000..99fe39a2 --- /dev/null +++ b/src/gui/gcal-toolbar-end.c @@ -0,0 +1,47 @@ +/* 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-toolbar-end.h" + +#include "gcal-search-button.h" + +struct _GcalToolbarEnd +{ + AdwBin parent_instance; +}; + +G_DEFINE_FINAL_TYPE (GcalToolbarEnd, gcal_toolbar_end, ADW_TYPE_BIN) + +static void +gcal_toolbar_end_class_init (GcalToolbarEndClass *klass) +{ + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + gtk_widget_class_set_template_from_resource (widget_class, + "/org/gnome/calendar/ui/gui/gcal-toolbar-end.ui"); +} + +static void +gcal_toolbar_end_init (GcalToolbarEnd *self) +{ + g_type_ensure (GCAL_TYPE_SEARCH_BUTTON); + + gtk_widget_init_template (GTK_WIDGET (self)); +} diff --git a/src/gui/gcal-toolbar-end.h b/src/gui/gcal-toolbar-end.h new file mode 100644 index 00000000..766556f2 --- /dev/null +++ b/src/gui/gcal-toolbar-end.h @@ -0,0 +1,32 @@ +/* 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) + +G_END_DECLS diff --git a/src/gui/gcal-toolbar-end.ui b/src/gui/gcal-toolbar-end.ui new file mode 100644 index 00000000..a94caf1d --- /dev/null +++ b/src/gui/gcal-toolbar-end.ui @@ -0,0 +1,27 @@ + + + + diff --git a/src/gui/gcal-window.c b/src/gui/gcal-window.c index 82e72750..28b06f30 100644 --- a/src/gui/gcal-window.c +++ b/src/gui/gcal-window.c @@ -35,6 +35,7 @@ #include "gcal-search-button.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" @@ -109,15 +110,12 @@ struct _GcalWindow /* header_bar widets */ GtkWidget *calendars_button; GtkWidget *menu_button; - GtkWidget *new_event_button; GtkWidget *today_button; GtkWidget *views_switcher; GcalEventEditorDialog *event_editor; GtkWindow *import_dialog; - GcalSearchButton *search_button; - /* new event popover widgets */ GtkWidget *quick_add_popover; @@ -661,22 +659,14 @@ on_folded_notify_cb (AdwLeaflet *leaflet, if (adw_leaflet_get_folded (leaflet)) { gtk_header_bar_remove (GTK_HEADER_BAR (self->header_bar), self->today_button); - gtk_header_bar_remove (GTK_HEADER_BAR (self->header_bar), self->new_event_button); - gtk_header_bar_remove (GTK_HEADER_BAR (self->header_bar), GTK_WIDGET (self->search_button)); gtk_action_bar_pack_start (GTK_ACTION_BAR (self->action_bar), self->today_button); - gtk_action_bar_pack_end (GTK_ACTION_BAR (self->action_bar), self->new_event_button); - gtk_action_bar_pack_end (GTK_ACTION_BAR (self->action_bar), GTK_WIDGET (self->search_button)); } else { gtk_action_bar_remove (GTK_ACTION_BAR (self->action_bar), self->today_button); - gtk_action_bar_remove (GTK_ACTION_BAR (self->action_bar), self->new_event_button); - gtk_action_bar_remove (GTK_ACTION_BAR (self->action_bar), GTK_WIDGET (self->search_button)); gtk_header_bar_pack_start (GTK_HEADER_BAR (self->header_bar), self->today_button); - gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header_bar), self->new_event_button); - gtk_header_bar_pack_end (GTK_HEADER_BAR (self->header_bar), GTK_WIDGET (self->search_button)); } } @@ -870,7 +860,6 @@ gcal_window_constructed (GObject *object) g_object_bind_property (self, "context", self->date_chooser, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); 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->search_button, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE); /* CSS */ load_css_providers (self); @@ -1003,7 +992,7 @@ gcal_window_class_init (GcalWindowClass *klass) 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_SEARCH_BUTTON); + g_type_ensure (GCAL_TYPE_TOOLBAR_END); g_type_ensure (GCAL_TYPE_WEATHER_SETTINGS); g_type_ensure (GCAL_TYPE_WEEK_VIEW); @@ -1058,9 +1047,7 @@ 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, action_bar); gtk_widget_class_bind_template_child (widget_class, GcalWindow, quick_add_popover); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, search_button); gtk_widget_class_bind_template_child (widget_class, GcalWindow, calendar_management_dialog); - gtk_widget_class_bind_template_child (widget_class, GcalWindow, new_event_button); gtk_widget_class_bind_template_child (widget_class, GcalWindow, today_button); gtk_widget_class_bind_template_child (widget_class, GcalWindow, overlay); gtk_widget_class_bind_template_child (widget_class, GcalWindow, views_stack); diff --git a/src/gui/gcal-window.ui b/src/gui/gcal-window.ui index 14b21c62..7130460b 100644 --- a/src/gui/gcal-window.ui +++ b/src/gui/gcal-window.ui @@ -147,6 +147,9 @@ + + + @@ -183,16 +186,7 @@ - - list-add-symbolic - win.new-event - Add a new event - - - - - Search for events - + diff --git a/src/gui/gui.gresource.xml b/src/gui/gui.gresource.xml index 594a4097..c9b96b98 100644 --- a/src/gui/gui.gresource.xml +++ b/src/gui/gui.gresource.xml @@ -8,6 +8,7 @@ gcal-quick-add-popover.ui gcal-search-button.ui gcal-search-hit-row.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 3b783d19..f5d3cad6 100644 --- a/src/gui/meson.build +++ b/src/gui/meson.build @@ -24,6 +24,7 @@ sources += files( 'gcal-quick-add-popover.c', 'gcal-search-button.c', 'gcal-search-hit-row.c', + 'gcal-toolbar-end.c', 'gcal-weather-settings.c', 'gcal-window.c', )