week-view: remove week, month, and year header
This provides only little benefit over the new navigation button's label. Thus, it is not there in the here newly implemented UI mock-ups. Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it> Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/542>
This commit is contained in:
committed by
Marge Bot
parent
1de447f7f3
commit
d400048bc6
@@ -41,11 +41,8 @@ struct _GcalWeekView
|
|||||||
GtkWidget *content;
|
GtkWidget *content;
|
||||||
GtkWidget *header;
|
GtkWidget *header;
|
||||||
GcalWeekHourBar *hours_bar;
|
GcalWeekHourBar *hours_bar;
|
||||||
GtkLabel *month_label;
|
|
||||||
GtkWidget *scrolled_window;
|
GtkWidget *scrolled_window;
|
||||||
GtkLabel *week_label;
|
|
||||||
GtkWidget *week_grid;
|
GtkWidget *week_grid;
|
||||||
GtkLabel *year_label;
|
|
||||||
|
|
||||||
/* property */
|
/* property */
|
||||||
GDateTime *date;
|
GDateTime *date;
|
||||||
@@ -94,52 +91,6 @@ G_DEFINE_TYPE_WITH_CODE (GcalWeekView, gcal_week_view, GTK_TYPE_BOX,
|
|||||||
#define MAX_ZOOM_LEVEL 3.0
|
#define MAX_ZOOM_LEVEL 3.0
|
||||||
|
|
||||||
/* Auxiliary methods */
|
/* Auxiliary methods */
|
||||||
static void
|
|
||||||
update_title_labels (GcalWeekView *self)
|
|
||||||
{
|
|
||||||
g_autoptr (GDateTime) week_start = NULL;
|
|
||||||
g_autoptr (GDateTime) week_end = NULL;
|
|
||||||
g_autoptr (GDateTime) week_mid = NULL;
|
|
||||||
g_autofree gchar *month_label = NULL;
|
|
||||||
g_autofree gchar *year_label = NULL;
|
|
||||||
g_autofree gchar *week_label = NULL;
|
|
||||||
|
|
||||||
g_assert (GCAL_IS_WEEK_VIEW (self));
|
|
||||||
g_assert (self->date != NULL);
|
|
||||||
|
|
||||||
week_start = gcal_date_time_get_start_of_week (self->date);
|
|
||||||
week_end = g_date_time_add_days (week_start, 6);
|
|
||||||
week_mid = g_date_time_add_days (week_start, 3);
|
|
||||||
|
|
||||||
if (g_date_time_get_month (week_start) == g_date_time_get_month (week_end))
|
|
||||||
{
|
|
||||||
month_label = g_strdup_printf ("%s", gcal_get_month_name (g_date_time_get_month (week_start) - 1));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
month_label = g_strdup_printf("%s–%s ",
|
|
||||||
gcal_get_month_name (g_date_time_get_month (week_start) -1),
|
|
||||||
gcal_get_month_name (g_date_time_get_month (week_end) - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g_date_time_get_year (week_start) == g_date_time_get_year (week_end))
|
|
||||||
{
|
|
||||||
year_label = g_strdup_printf ("%d", g_date_time_get_year (week_start));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
year_label = g_strdup_printf ("%d–%d",
|
|
||||||
g_date_time_get_year (week_start),
|
|
||||||
g_date_time_get_year (week_end));
|
|
||||||
}
|
|
||||||
|
|
||||||
week_label = g_strdup_printf (_("Week %d"), g_date_time_get_week_of_year (week_mid));
|
|
||||||
|
|
||||||
gtk_label_set_label (self->month_label, month_label);
|
|
||||||
gtk_label_set_label (self->week_label, week_label);
|
|
||||||
gtk_label_set_label (self->year_label, year_label);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_grid_scroll_position (GcalWeekView *self)
|
update_grid_scroll_position (GcalWeekView *self)
|
||||||
{
|
{
|
||||||
@@ -456,7 +407,6 @@ gcal_week_view_set_date (GcalView *view,
|
|||||||
gcal_week_grid_set_date (GCAL_WEEK_GRID (self->week_grid), date);
|
gcal_week_grid_set_date (GCAL_WEEK_GRID (self->week_grid), date);
|
||||||
gcal_week_header_set_date (GCAL_WEEK_HEADER (self->header), date);
|
gcal_week_header_set_date (GCAL_WEEK_HEADER (self->header), date);
|
||||||
|
|
||||||
update_title_labels (self);
|
|
||||||
schedule_position_scroll (self);
|
schedule_position_scroll (self);
|
||||||
|
|
||||||
gcal_timeline_subscriber_range_changed (GCAL_TIMELINE_SUBSCRIBER (view));
|
gcal_timeline_subscriber_range_changed (GCAL_TIMELINE_SUBSCRIBER (view));
|
||||||
@@ -693,11 +643,8 @@ gcal_week_view_class_init (GcalWeekViewClass *klass)
|
|||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, content);
|
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, content);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, header);
|
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, header);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, hours_bar);
|
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, hours_bar);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, month_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, scrolled_window);
|
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, scrolled_window);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, week_label);
|
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, week_grid);
|
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, week_grid);
|
||||||
gtk_widget_class_bind_template_child (widget_class, GcalWeekView, year_label);
|
|
||||||
|
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_event_activated);
|
gtk_widget_class_bind_template_callback (widget_class, on_event_activated);
|
||||||
gtk_widget_class_bind_template_callback (widget_class, on_motion_controller_enter_cb);
|
gtk_widget_class_bind_template_callback (widget_class, on_motion_controller_enter_cb);
|
||||||
|
|||||||
@@ -8,38 +8,25 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GtkBox">
|
||||||
<property name="orientation">vertical</property>
|
<property name="orientation">horizontal</property>
|
||||||
|
|
||||||
|
<!-- Expand / Collapse button -->
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="header_labels_box">
|
<object class="GtkBox" id="expand_button_box">
|
||||||
<property name="orientation">horizontal</property>
|
<property name="hexpand">False</property>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="month_label">
|
<object class="GtkToggleButton">
|
||||||
<property name="label">Month</property>
|
<property name="visible" bind-source="header" bind-property="can-expand" bind-flags="sync-create" />
|
||||||
<property name="yalign">0</property>
|
<property name="active" bind-source="header" bind-property="expanded" bind-flags="sync-create|bidirectional" />
|
||||||
<property name="ellipsize">end</property>
|
|
||||||
<style>
|
|
||||||
<class name="primary-label" />
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="week_label">
|
|
||||||
<property name="hexpand">True</property>
|
<property name="hexpand">True</property>
|
||||||
<property name="xalign">0</property>
|
<property name="halign">center</property>
|
||||||
<property name="yalign">0</property>
|
<property name="valign">end</property>
|
||||||
<property name="label">Week</property>
|
<property name="margin-bottom">6</property>
|
||||||
|
<property name="icon-name">go-down-symbolic</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="secondary-label" />
|
<class name="flat" />
|
||||||
</style>
|
<class name="circular" />
|
||||||
</object>
|
<class name="week-header-expander" />
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="year_label">
|
|
||||||
<property name="label">Year</property>
|
|
||||||
<property name="yalign">0</property>
|
|
||||||
<style>
|
|
||||||
<class name="secondary-label" />
|
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
@@ -47,39 +34,9 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox">
|
<object class="GcalWeekHeader" id="header">
|
||||||
<property name="orientation">horizontal</property>
|
<property name="hexpand">True</property>
|
||||||
|
<signal name="event-activated" handler="on_event_activated" object="GcalWeekView" swapped="yes" />
|
||||||
<!-- Expand / Collapse button -->
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="expand_button_box">
|
|
||||||
<property name="hexpand">False</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkToggleButton">
|
|
||||||
<property name="visible" bind-source="header" bind-property="can-expand" bind-flags="sync-create" />
|
|
||||||
<property name="active" bind-source="header" bind-property="expanded" bind-flags="sync-create|bidirectional" />
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="halign">center</property>
|
|
||||||
<property name="valign">end</property>
|
|
||||||
<property name="margin-bottom">6</property>
|
|
||||||
<property name="icon_name">go-down-symbolic</property>
|
|
||||||
<style>
|
|
||||||
<class name="flat" />
|
|
||||||
<class name="circular" />
|
|
||||||
<class name="week-header-expander" />
|
|
||||||
</style>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
|
||||||
<object class="GcalWeekHeader" id="header">
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<signal name="event-activated" handler="on_event_activated" object="GcalWeekView" swapped="yes" />
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user