views/dazzling: Make it *the* month view

And move the old one to the attic. I'll keep the files around for
a while.
This commit is contained in:
Georges Basile Stavracas Neto
2023-08-11 15:13:44 -03:00
parent 7f7f55826c
commit 7e26bd5649
13 changed files with 3047 additions and 3074 deletions
File diff suppressed because it is too large Load Diff
+33
View File
@@ -0,0 +1,33 @@
/* gcal-month-view.h
*
* Copyright (C) 2012 - Erick Pérez Castellanos
*
* 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 <http://www.gnu.org/licenses/>.
*/
#ifndef __GCAL_MONTH_VIEW_H__
#define __GCAL_MONTH_VIEW_H__
#include "gcal-manager.h"
#include "gcal-weather-service.h"
G_BEGIN_DECLS
#define GCAL_TYPE_MONTH_VIEW (gcal_month_view_get_type ())
G_DECLARE_FINAL_TYPE (GcalMonthView, gcal_month_view, GCAL, MONTH_VIEW, GtkWidget)
G_END_DECLS
#endif /* __GCAL_MONTH_VIEW_H__ */
@@ -1,22 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalDazzlingMonthView" parent="GtkWidget">
<property name="overflow">hidden</property>
<template class="GcalMonthView" parent="GtkWidget">
<child>
<object class="GtkEventControllerScroll">
<property name="flags">vertical|kinetic</property>
<signal name="scroll-begin" handler="on_scroll_controller_scroll_begin_cb" object="GcalDazzlingMonthView" swapped="no" />
<signal name="scroll" handler="on_scroll_controller_scroll_cb" object="GcalDazzlingMonthView" swapped="no" />
<signal name="scroll-end" handler="on_scroll_controller_scroll_end_cb" object="GcalDazzlingMonthView" swapped="no" />
<signal name="decelerate" handler="on_scroll_controller_decelerate_cb" object="GcalDazzlingMonthView" swapped="no" />
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="on_click_gesture_pressed_cb" object="GcalMonthView" swapped="no" />
<signal name="released" handler="on_click_gesture_released_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerMotion" id="motion_controller">
<property name="propagation-phase">none</property>
<signal name="motion" handler="on_motion_controller_motion_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="on_key_controller_key_pressed_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerScroll">
<property name="flags">vertical|discrete</property>
<signal name="scroll" handler="on_discrete_scroll_controller_scroll_cb" object="GcalDazzlingMonthView" swapped="no" />
<property name="flags">vertical</property>
<signal name="scroll" handler="on_scroll_controller_scrolled_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
@@ -49,10 +59,12 @@
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkLabel" id="label_0">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -63,7 +75,6 @@
<child>
<object class="GtkLabel" id="label_1">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -74,7 +85,6 @@
<child>
<object class="GtkLabel" id="label_2">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -85,7 +95,6 @@
<child>
<object class="GtkLabel" id="label_3">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -96,7 +105,6 @@
<child>
<object class="GtkLabel" id="label_4">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -107,7 +115,6 @@
<child>
<object class="GtkLabel" id="label_5">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -118,7 +125,6 @@
<child>
<object class="GtkLabel" id="label_6">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -132,5 +138,12 @@
</object>
</child>
<!-- Grid -->
<child type="grid">
<object class="GtkGrid" id="grid">
<property name="row-homogeneous">true</property>
<property name="column-homogeneous">true</property>
</object>
</child>
</template>
</interface>
-1
View File
@@ -42,7 +42,6 @@ typedef enum
{
GCAL_WINDOW_VIEW_WEEK,
GCAL_WINDOW_VIEW_MONTH,
GCAL_WINDOW_VIEW_DAZZLING_MONTH,
} GcalWindowView;
typedef enum
+2 -11
View File
@@ -25,7 +25,6 @@
#include "gcal-calendar-button.h"
#include "config.h"
#include "gcal-date-chooser.h"
#include "gcal-dazzling-month-view.h"
#include "gcal-debug.h"
#include "gcal-event-editor-dialog.h"
#include "gcal-event-widget.h"
@@ -105,7 +104,6 @@ struct _GcalWindow
AdwViewStack *views_stack;
GtkWidget *week_view;
GtkWidget *month_view;
GtkWidget *dazzling_month_view;
GtkWidget *agenda_view;
GtkWidget *date_chooser;
GtkWidget *action_bar;
@@ -206,7 +204,6 @@ update_today_action_enabled (GcalWindow *window)
break;
case GCAL_WINDOW_VIEW_MONTH:
case GCAL_WINDOW_VIEW_DAZZLING_MONTH:
enabled = g_date_time_get_year (window->active_date) != g_date_time_get_year (now) ||
g_date_time_get_month (window->active_date) != g_date_time_get_month (now);
break;
@@ -233,7 +230,6 @@ maybe_add_subscribers_to_timeline (GcalWindow *self)
timeline = gcal_manager_get_timeline (gcal_context_get_manager (self->context));
gcal_timeline_add_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->week_view));
gcal_timeline_add_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->dazzling_month_view));
gcal_timeline_add_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->month_view));
gcal_timeline_add_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->agenda_view));
gcal_timeline_add_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->date_chooser));
@@ -255,7 +251,7 @@ update_active_date (GcalWindow *window,
gcal_set_date_time (&window->active_date, new_date);
for (i = GCAL_WINDOW_VIEW_WEEK; i <= GCAL_WINDOW_VIEW_DAZZLING_MONTH; i++)
for (i = GCAL_WINDOW_VIEW_WEEK; i <= GCAL_WINDOW_VIEW_MONTH; i++)
gcal_view_set_date (GCAL_VIEW (window->views[i]), new_date);
gcal_view_set_date (GCAL_VIEW (window->agenda_view), new_date);
gcal_view_set_date (GCAL_VIEW (window->date_chooser), new_date);
@@ -375,7 +371,7 @@ on_view_action_activated (GSimpleAction *action,
else if (view == -2)
view = --(window->active_view);
window->active_view = CLAMP (view, GCAL_WINDOW_VIEW_WEEK, GCAL_WINDOW_VIEW_DAZZLING_MONTH);
window->active_view = CLAMP (view, GCAL_WINDOW_VIEW_WEEK, GCAL_WINDOW_VIEW_MONTH);
adw_view_stack_set_visible_child (window->views_stack, window->views[window->active_view]);
g_object_notify_by_pspec (G_OBJECT (user_data), properties[PROP_ACTIVE_VIEW]);
@@ -834,7 +830,6 @@ gcal_window_dispose (GObject *object)
timeline = gcal_manager_get_timeline (gcal_context_get_manager (self->context));
gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->week_view));
gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->dazzling_month_view));
gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->month_view));
gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->agenda_view));
gcal_timeline_remove_subscriber (timeline, GCAL_TIMELINE_SUBSCRIBER (self->date_chooser));
@@ -882,7 +877,6 @@ gcal_window_constructed (GObject *object)
g_object_bind_property (self, "context", self->calendar_management_dialog, "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);
g_object_bind_property (self, "context", self->dazzling_month_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
g_object_bind_property (self, "context", self->agenda_view, "context", G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
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);
@@ -1018,7 +1012,6 @@ gcal_window_class_init (GcalWindowClass *klass)
g_type_ensure (GCAL_TYPE_CALENDAR_MANAGEMENT_DIALOG);
g_type_ensure (GCAL_TYPE_CALENDAR_BUTTON);
g_type_ensure (GCAL_TYPE_DATE_CHOOSER);
g_type_ensure (GCAL_TYPE_DAZZLING_MONTH_VIEW);
g_type_ensure (GCAL_TYPE_EVENT_EDITOR_DIALOG);
g_type_ensure (GCAL_TYPE_MANAGER);
g_type_ensure (GCAL_TYPE_MONTH_VIEW);
@@ -1072,7 +1065,6 @@ gcal_window_class_init (GcalWindowClass *klass)
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, date_chooser);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, dazzling_month_view);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, event_editor);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, header_bar);
gtk_widget_class_bind_template_child (widget_class, GcalWindow, main_box);
@@ -1131,7 +1123,6 @@ gcal_window_init (GcalWindow *self)
self->views[GCAL_WINDOW_VIEW_WEEK] = self->week_view;
self->views[GCAL_WINDOW_VIEW_MONTH] = self->month_view;
self->views[GCAL_WINDOW_VIEW_DAZZLING_MONTH] = self->dazzling_month_view;
self->active_date = g_date_time_new_from_unix_local (0);
self->rtl = gtk_widget_get_direction (GTK_WIDGET (self)) == GTK_TEXT_DIR_RTL;
-16
View File
@@ -280,22 +280,6 @@
</property>
</object>
</child>
<child>
<object class="AdwViewStackPage">
<property name="name">dazzling-month</property>
<property name="title" translatable="yes">_Month</property>
<property name="use-underline">True</property>
<property name="icon_name">calendar-month-symbolic</property>
<property name="child">
<object class="GcalDazzlingMonthView" id="dazzling_month_view">
<property name="active-date" bind-source="GcalWindow" bind-property="active-date" bind-flags="bidirectional"/>
<signal name="create-event" handler="show_new_event_widget" object="GcalWindow" swapped="no"/>
<signal name="create-event-detailed" handler="create_event_detailed_cb" object="GcalWindow" swapped="no"/>
<signal name="event-activated" handler="event_activated" object="GcalWindow" swapped="no"/>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
File diff suppressed because it is too large Load Diff
-31
View File
@@ -1,31 +0,0 @@
/*
* gcal-dazzling-month-view.h
*
* Copyright 2023 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* 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 <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GCAL_TYPE_DAZZLING_MONTH_VIEW (gcal_dazzling_month_view_get_type())
G_DECLARE_FINAL_TYPE (GcalDazzlingMonthView, gcal_dazzling_month_view, GCAL, DAZZLING_MONTH_VIEW, GtkWidget)
G_END_DECLS
File diff suppressed because it is too large Load Diff
+11 -13
View File
@@ -1,10 +1,11 @@
/* gcal-month-view.h
/*
* gcal-month-view.h
*
* Copyright (C) 2012 - Erick Pérez Castellanos
* Copyright 2023 Georges Basile Stavracas Neto <georges.stavracas@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* 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
* 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,
@@ -13,21 +14,18 @@
* 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 <http://www.gnu.org/licenses/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef __GCAL_MONTH_VIEW_H__
#define __GCAL_MONTH_VIEW_H__
#pragma once
#include "gcal-manager.h"
#include "gcal-weather-service.h"
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define GCAL_TYPE_MONTH_VIEW (gcal_month_view_get_type ())
#define GCAL_TYPE_MONTH_VIEW (gcal_month_view_get_type())
G_DECLARE_FINAL_TYPE (GcalMonthView, gcal_month_view, GCAL, MONTH_VIEW, GtkWidget)
G_END_DECLS
#endif /* __GCAL_MONTH_VIEW_H__ */
+16 -29
View File
@@ -1,32 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GcalMonthView" parent="GtkWidget">
<property name="overflow">hidden</property>
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="on_click_gesture_pressed_cb" object="GcalMonthView" swapped="no" />
<signal name="released" handler="on_click_gesture_released_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerMotion" id="motion_controller">
<property name="propagation-phase">none</property>
<signal name="motion" handler="on_motion_controller_motion_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerKey">
<signal name="key-pressed" handler="on_key_controller_key_pressed_cb" object="GcalMonthView" swapped="no" />
<object class="GtkEventControllerScroll">
<property name="flags">vertical|kinetic</property>
<signal name="scroll-begin" handler="on_scroll_controller_scroll_begin_cb" object="GcalMonthView" swapped="no" />
<signal name="scroll" handler="on_scroll_controller_scroll_cb" object="GcalMonthView" swapped="no" />
<signal name="scroll-end" handler="on_scroll_controller_scroll_end_cb" object="GcalMonthView" swapped="no" />
<signal name="decelerate" handler="on_scroll_controller_decelerate_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
<child>
<object class="GtkEventControllerScroll">
<property name="flags">vertical</property>
<signal name="scroll" handler="on_scroll_controller_scrolled_cb" object="GcalMonthView" swapped="no" />
<property name="flags">vertical|discrete</property>
<signal name="scroll" handler="on_discrete_scroll_controller_scroll_cb" object="GcalMonthView" swapped="no" />
</object>
</child>
@@ -59,12 +49,10 @@
<child>
<object class="GtkBox">
<property name="spacing">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="margin-bottom">6</property>
<child>
<object class="GtkLabel" id="label_0">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -75,6 +63,7 @@
<child>
<object class="GtkLabel" id="label_1">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -85,6 +74,7 @@
<child>
<object class="GtkLabel" id="label_2">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -95,6 +85,7 @@
<child>
<object class="GtkLabel" id="label_3">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -105,6 +96,7 @@
<child>
<object class="GtkLabel" id="label_4">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -115,6 +107,7 @@
<child>
<object class="GtkLabel" id="label_5">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -125,6 +118,7 @@
<child>
<object class="GtkLabel" id="label_6">
<property name="margin-start">6</property>
<property name="hexpand">true</property>
<property name="xalign">0.0</property>
<style>
@@ -138,12 +132,5 @@
</object>
</child>
<!-- Grid -->
<child type="grid">
<object class="GtkGrid" id="grid">
<property name="row-homogeneous">true</property>
<property name="column-homogeneous">true</property>
</object>
</child>
</template>
</interface>
-1
View File
@@ -8,7 +8,6 @@ built_sources += gnome.compile_resources(
sources += files(
'gcal-agenda-view.c',
'gcal-dazzling-month-view.c',
'gcal-month-cell.c',
'gcal-month-popover.c',
'gcal-month-view.c',
-1
View File
@@ -2,7 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/calendar/ui/views">
<file compressed="true">gcal-agenda-view.ui</file>
<file compressed="true">gcal-dazzling-month-view.ui</file>
<file compressed="true">gcal-month-cell.ui</file>
<file compressed="true">gcal-month-popover.ui</file>
<file compressed="true">gcal-month-view.ui</file>