[gnome-calendar] year-view: initial UI for no events days
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] year-view: initial UI for no events days
- Date: Tue, 20 Jan 2015 22:11:01 +0000 (UTC)
commit 4247018bde89e350f05c80f98d1f594dbe4add81
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Tue Jan 20 17:06:22 2015 -0500
year-view: initial UI for no events days
data/theme/gtk-styles.css | 18 +++++++++++++
data/ui/year-view.ui | 59 +++++++++++++++++++++++++++++++++++++++++---
src/gcal-year-view.c | 16 ++++++++++++
3 files changed, 89 insertions(+), 4 deletions(-)
---
diff --git a/data/theme/gtk-styles.css b/data/theme/gtk-styles.css
index 64fa21e..052fa46 100644
--- a/data/theme/gtk-styles.css
+++ b/data/theme/gtk-styles.css
@@ -118,10 +118,28 @@
font-size: 11px;
}
+.italic-label {
+ font-style: italic;
+}
+
GtkListBox.sidebar {
background-color: @theme_bg_color;
}
+GtkBox.sidebar {
+ background-color: @theme_bg_color;
+ border-color: @borders;
+ border-style: solid;
+}
+
+GtkBox.sidebar:dir(ltr) {
+ border-left-width: 1px;
+}
+
+GtkBox.sidebar:dir(rtl) {
+ border-right-width: 1px;
+}
+
GcalYearView GtkScrolledWindow {
border-top-width: 0;
border-bottom-width: 0;
diff --git a/data/ui/year-view.ui b/data/ui/year-view.ui
index b06714f..cb96cfb 100644
--- a/data/ui/year-view.ui
+++ b/data/ui/year-view.ui
@@ -24,17 +24,68 @@
<property name="width_request">200</property>
<property name="orientation">vertical</property>
<child>
- <object class="GtkScrolledWindow" id="navigator_sidebar">
+ <object class="GtkStack" id="navigator_stack">
<property name="visible">True</property>
- <property name="shadow_type">out</property>
- <property name="vexpand">True</property>
<child>
- <object class="GtkListBox" id="events_sidebar">
+ <object class="GtkScrolledWindow" id="navigator_sidebar">
+ <property name="visible">True</property>
+ <property name="shadow_type">out</property>
+ <property name="vexpand">True</property>
+ <child>
+ <object class="GtkListBox" id="events_sidebar">
+ <property name="visible">True</property>
+ <style>
+ <class name="sidebar" />
+ </style>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ <property name="name">events-list</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox">
<property name="visible">True</property>
+ <property name="orientation">vertical</property>
<style>
<class name="sidebar" />
</style>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="margin">6</property>
+ <property name="label" translatable="True">Today</property>
+ <style>
+ <class name="sidebar-header" />
+ </style>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="halign">start</property>
+ <property name="margin_start">6</property>
+ <property name="label" translatable="True">No events</property>
+ <style>
+ <class name="dim-label" />
+ <class name="italic-label"/>
+ </style>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
+ <packing>
+ <property name="position">1</property>
+ <property name="name">no-events</property>
+ </packing>
</child>
</object>
<packing>
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index 9548d2a..2da206e 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -48,6 +48,7 @@ struct _GcalYearViewPrivate
GtkWidget *navigator;
GtkWidget *sidebar;
GtkWidget *events_sidebar;
+ GtkWidget *navigator_stack;
GtkWidget *navigator_sidebar;
GtkWidget *popover; /* Popover for popover_mode */
@@ -244,6 +245,20 @@ update_sidebar (GcalYearView *year_view)
days_widgets_array = g_new0 (GList*, days_span);
events = gcal_manager_get_events (priv->manager, priv->start_selected_date, priv->end_selected_date);
+
+ /* XXX: compare_date_only does not work if is_date field is different */
+ priv->start_selected_date->is_date = priv->current_date->is_date;
+ if (events == NULL && icaltime_compare_date_only (*(priv->start_selected_date), *(priv->current_date)) ==
0)
+ {
+ days_span = 0;
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->navigator_stack), "no-events");
+ }
+ else
+ {
+ gtk_stack_set_visible_child_name (GTK_STACK (priv->navigator_stack), "events-list");
+ }
+ priv->start_selected_date->is_date = 0;
+
for (l = events; l != NULL; l = g_list_next (l))
{
GcalEventData *data = l->data;
@@ -1164,6 +1179,7 @@ gcal_year_view_class_init (GcalYearViewClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, navigator);
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, sidebar);
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, events_sidebar);
+ gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, navigator_stack);
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, navigator_sidebar);
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, popover);
gtk_widget_class_bind_template_child_private (widget_class, GcalYearView, popover_sidebar);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]