diff --git a/data/style/Header.css b/data/style/Header.css
index 38adcaab3..8fc71980a 100644
--- a/data/style/Header.css
+++ b/data/style/Header.css
@@ -15,15 +15,6 @@
* along with this program. If not, see .
*/
-.header {
- background-image:
- linear-gradient(
- to bottom,
- @bg_color,
- shade(@bg_color, 1.2)
- );
-}
-
.daylabel {
padding: 3px;
border-left: solid 1px @menu_separator;
diff --git a/src/AgendaView.vala b/src/AgendaView.vala
index fe2f2a286..a2ac3eb37 100644
--- a/src/AgendaView.vala
+++ b/src/AgendaView.vala
@@ -19,9 +19,11 @@
* Corentin Noël
*/
-public class Maya.View.AgendaView : Gtk.ScrolledWindow {
+public class Maya.View.AgendaView : Gtk.Box {
public signal void event_removed (ECal.Component event);
+ public Hdy.HeaderBar header_bar { get; construct; }
+
private Gtk.Label day_label;
private Gtk.Label weekday_label;
private Gtk.ListBox selected_date_events_list;
@@ -29,6 +31,23 @@ public class Maya.View.AgendaView : Gtk.ScrolledWindow {
private DateTime selected_date;
construct {
+ var contractor = new Maya.View.Widgets.ContractorButtonWithMenu (_("Export or Share the default Calendar"));
+
+ var source_popover = new Calendar.Widgets.SourcePopover ();
+
+ var menu_button = new Gtk.MenuButton () {
+ image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR),
+ popover = source_popover,
+ tooltip_text = _("Manage Calendars")
+ };
+
+ header_bar = new Hdy.HeaderBar () {
+ show_close_button = true
+ };
+ header_bar.pack_start (contractor);
+ header_bar.pack_end (menu_button);
+ header_bar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
+
weekday_label = new Gtk.Label ("");
weekday_label.xalign = 0;
weekday_label.get_style_context ().add_class (Granite.STYLE_CLASS_H2_LABEL);
@@ -98,13 +117,20 @@ public class Maya.View.AgendaView : Gtk.ScrolledWindow {
var grid = new Gtk.Grid ();
grid.orientation = Gtk.Orientation.VERTICAL;
- grid.get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW);
grid.add (selected_data_grid);
grid.add (selected_date_events_list);
grid.add (upcoming_events_list);
- hscrollbar_policy = Gtk.PolicyType.NEVER;
- add (grid);
+ var scrolled_window = new Gtk.ScrolledWindow (null, null) {
+ hscrollbar_policy = NEVER,
+ child = grid,
+ vexpand = true
+ };
+
+ orientation = VERTICAL;
+ add (header_bar);
+ add (scrolled_window);
+ get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW);
// Listen to changes for events
var calmodel = Calendar.EventStore.get_default ();
diff --git a/src/Grid/CalendarView.vala b/src/Grid/CalendarView.vala
index 150b0239a..2f51632e1 100644
--- a/src/Grid/CalendarView.vala
+++ b/src/Grid/CalendarView.vala
@@ -22,13 +22,14 @@
/**
* Represents the entire calendar, including the headers, the week labels and the grid.
*/
-public class Maya.View.CalendarView : Gtk.Grid {
+public class Maya.View.CalendarView : Gtk.Box {
/*
* Event emitted when the day is double clicked or the ENTER key is pressed.
*/
public signal void on_event_add (DateTime date);
public signal void selection_changed (DateTime new_date);
+ public Hdy.HeaderBar header_bar { get; construct; }
public DateTime? selected_date { get; private set; }
private WeekLabels weeks { get; private set; }
@@ -54,11 +55,24 @@ public class Maya.View.CalendarView : Gtk.Grid {
construct {
selected_date = Maya.Application.get_selected_datetime ();
+ var error_label = new Gtk.Label (null);
+ error_label.show ();
+
+ var error_bar = new Gtk.InfoBar () {
+ message_type = Gtk.MessageType.ERROR,
+ revealed = false,
+ show_close_button = true
+ };
+ error_bar.get_content_area ().add (error_label);
+
+ var info_bar = new Calendar.Widgets.ConnectivityInfoBar ();
+
+ header_bar = new Calendar.Widgets.HeaderBar ();
+
stack = new Gtk.Stack ();
stack.expand = true;
sync_with_model (); // Populate stack with a grid
- stack.show_all ();
var model = Calendar.EventStore.get_default ();
model.parameters_changed.connect (on_model_parameters_changed);
@@ -84,7 +98,23 @@ public class Maya.View.CalendarView : Gtk.Grid {
events |= Gdk.EventMask.KEY_PRESS_MASK;
events |= Gdk.EventMask.SCROLL_MASK;
events |= Gdk.EventMask.SMOOTH_SCROLL_MASK;
+ orientation = VERTICAL;
+ get_style_context ().add_class (Gtk.STYLE_CLASS_VIEW);
+ add (header_bar);
+ add (error_bar);
+ add (info_bar);
add (stack);
+ show_all ();
+
+ error_bar.response.connect ((id) => error_bar.set_revealed (false));
+
+ Calendar.EventStore.get_default ().error_received.connect ((message) => {
+ Idle.add (() => {
+ error_label.label = message;
+ error_bar.set_revealed (true);
+ return false;
+ });
+ });
}
public override bool scroll_event (Gdk.EventScroll event) {
diff --git a/src/Grid/Header.vala b/src/Grid/Header.vala
index 236563773..a140c4099 100644
--- a/src/Grid/Header.vala
+++ b/src/Grid/Header.vala
@@ -56,7 +56,6 @@ public class Header : Gtk.EventBox {
// EventBox properties
set_visible_window (true); // needed for style
get_style_context ().add_provider (style_provider, 600);
- get_style_context ().add_class ("header");
labels = new Gtk.Label[7];
for (int c = 0; c < 7; c++) {
diff --git a/src/MainWindow.vala b/src/MainWindow.vala
index 18340f8c6..fe4618d6a 100644
--- a/src/MainWindow.vala
+++ b/src/MainWindow.vala
@@ -59,19 +59,9 @@ public class Maya.MainWindow : Hdy.ApplicationWindow {
weak Gtk.IconTheme default_theme = Gtk.IconTheme.get_default ();
default_theme.add_resource_path ("/io/elementary/calendar");
- var headerbar = new Calendar.Widgets.HeaderBar ();
-
- var error_label = new Gtk.Label (null);
- error_label.show ();
-
- var error_bar = new Gtk.InfoBar () {
- message_type = Gtk.MessageType.ERROR,
- revealed = false,
- show_close_button = true
+ calview = new View.CalendarView () {
+ vexpand = true
};
- error_bar.get_content_area ().add (error_label);
-
- var info_bar = new Calendar.Widgets.ConnectivityInfoBar ();
var sidebar = new View.AgendaView () {
no_show_all = true,
@@ -79,37 +69,25 @@ public class Maya.MainWindow : Hdy.ApplicationWindow {
};
sidebar.show ();
- calview = new View.CalendarView () {
- vexpand = true
- };
-
var hpaned = new Gtk.Paned (Gtk.Orientation.HORIZONTAL);
hpaned.pack1 (calview, true, false);
hpaned.pack2 (sidebar, false, false);
- var grid = new Gtk.Grid ();
- grid.orientation = Gtk.Orientation.VERTICAL;
- grid.add (headerbar);
- grid.add (error_bar);
- grid.add (info_bar);
- grid.add (hpaned);
+ add (hpaned);
- add (grid);
+ var header_group = new Hdy.HeaderGroup ();
+ header_group.add_header_bar (calview.header_bar);
+ header_group.add_header_bar (sidebar.header_bar);
+
+ var size_group = new Gtk.SizeGroup (VERTICAL);
+ size_group.add_widget (calview.header_bar);
+ size_group.add_widget (sidebar.header_bar);
calview.on_event_add.connect ((date) => on_tb_add_clicked (date));
calview.selection_changed.connect ((date) => sidebar.set_selected_date (date));
- error_bar.response.connect ((id) => error_bar.set_revealed (false));
sidebar.event_removed.connect (on_remove);
Maya.Application.saved_state.bind ("hpaned-position", hpaned, "position", GLib.SettingsBindFlags.DEFAULT);
-
- Calendar.EventStore.get_default ().error_received.connect ((message) => {
- Idle.add (() => {
- error_label.label = message;
- error_bar.set_revealed (true);
- return false;
- });
- });
}
public void on_tb_add_clicked (DateTime dt) {
diff --git a/src/Widgets/HeaderBar.vala b/src/Widgets/HeaderBar.vala
index 9bafb9f05..3335aa32b 100644
--- a/src/Widgets/HeaderBar.vala
+++ b/src/Widgets/HeaderBar.vala
@@ -32,13 +32,6 @@ public class Calendar.Widgets.HeaderBar : Hdy.HeaderBar {
construct {
var application_instance = ((Gtk.Application) GLib.Application.get_default ());
- var button_add = new Gtk.Button.from_icon_name ("appointment-new", Gtk.IconSize.LARGE_TOOLBAR);
- button_add.action_name = Maya.MainWindow.ACTION_PREFIX + Maya.MainWindow.ACTION_NEW_EVENT;
- button_add.tooltip_markup = Granite.markup_accel_tooltip (
- application_instance.get_accels_for_action (button_add.action_name),
- _("Create a new event")
- );
-
var button_today = new Gtk.Button.from_icon_name ("calendar-go-today", Gtk.IconSize.LARGE_TOOLBAR);
button_today.action_name = Maya.MainWindow.ACTION_PREFIX + Maya.MainWindow.ACTION_SHOW_TODAY;
button_today.tooltip_markup = Granite.markup_accel_tooltip (
@@ -46,13 +39,6 @@ public class Calendar.Widgets.HeaderBar : Hdy.HeaderBar {
_("Go to today's date")
);
- var source_popover = new Calendar.Widgets.SourcePopover ();
-
- var menu_button = new Gtk.MenuButton ();
- menu_button.image = new Gtk.Image.from_icon_name ("open-menu", Gtk.IconSize.LARGE_TOOLBAR);
- menu_button.popover = source_popover;
- menu_button.tooltip_text = _("Manage Calendars");
-
month_switcher = new Calendar.Widgets.DateSwitcher (10) {
valign = Gtk.Align.CENTER
};
@@ -60,11 +46,17 @@ public class Calendar.Widgets.HeaderBar : Hdy.HeaderBar {
valign = Gtk.Align.CENTER
};
+ var button_add = new Gtk.Button.from_icon_name ("appointment-new", Gtk.IconSize.LARGE_TOOLBAR) {
+ action_name = Maya.MainWindow.ACTION_PREFIX + Maya.MainWindow.ACTION_NEW_EVENT
+ };
+ button_add.tooltip_markup = Granite.markup_accel_tooltip (
+ application_instance.get_accels_for_action (button_add.action_name),
+ _("Create a new event")
+ );
+
var calmodel = Calendar.EventStore.get_default ();
set_switcher_date (calmodel.month_start);
- var contractor = new Maya.View.Widgets.ContractorButtonWithMenu (_("Export or Share the default Calendar"));
-
var title_grid = new Gtk.Grid ();
title_grid.column_spacing = 6;
title_grid.add (button_today);
@@ -73,11 +65,10 @@ public class Calendar.Widgets.HeaderBar : Hdy.HeaderBar {
var spinner = new Maya.View.Widgets.DynamicSpinner ();
- pack_start (button_add);
pack_start (spinner);
+ pack_end (button_add);
set_custom_title (title_grid);
- pack_end (menu_button);
- pack_end (contractor);
+ get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
month_switcher.left_clicked.connect (() => Calendar.EventStore.get_default ().change_month (-1));
month_switcher.right_clicked.connect (() => Calendar.EventStore.get_default ().change_month (1));