[evolution/wip/webkit2] Bug 760563 - [Calendar] Add option to show icons in the Month View



commit de54761cb0492881fa810757f6fd12be0f3385ef
Author: Milan Crha <mcrha redhat com>
Date:   Mon Jan 25 17:03:38 2016 +0100

    Bug 760563 - [Calendar] Add option to show icons in the Month View

 calendar/gui/e-week-view-event-item.c            |    3 +-
 calendar/gui/e-week-view.c                       |   60 +++++++++++++++++++++-
 calendar/gui/e-week-view.h                       |    5 ++
 data/org.gnome.evolution.calendar.gschema.xml.in |    5 ++
 modules/calendar/e-calendar-preferences.c        |    6 ++
 modules/calendar/e-calendar-preferences.ui       |   23 +++++++--
 modules/settings/e-settings-calendar-view.c      |    5 ++
 7 files changed, 101 insertions(+), 6 deletions(-)
---
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index 6a64484..618d150 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -446,7 +446,8 @@ week_view_event_item_draw_icons (EWeekViewEventItem *event_item,
        parent = gtk_widget_get_parent (GTK_WIDGET (canvas));
        week_view = E_WEEK_VIEW (parent);
 
-       if (e_week_view_get_multi_week_view (week_view))
+       if (e_week_view_get_multi_week_view (week_view) &&
+           !e_week_view_get_show_icons_month_view (week_view))
                return;
 
        if (!is_array_index_in_bounds (week_view->events, event_item->priv->event_num))
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 0c31e85..05ba0b0 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -99,6 +99,8 @@ struct _EWeekViewPrivate {
        GDateWeekday display_start_day;
 
        gulong notify_week_start_day_id;
+
+       gboolean show_icons_month_view;
 };
 
 typedef struct {
@@ -197,6 +199,7 @@ enum {
        PROP_0,
        PROP_COMPRESS_WEEKEND,
        PROP_SHOW_EVENT_END_TIMES,
+       PROP_SHOW_ICONS_MONTH_VIEW,
        PROP_IS_EDITING
 };
 
@@ -773,6 +776,12 @@ week_view_set_property (GObject *object,
                                E_WEEK_VIEW (object),
                                g_value_get_boolean (value));
                        return;
+
+               case PROP_SHOW_ICONS_MONTH_VIEW:
+                       e_week_view_set_show_icons_month_view (
+                               E_WEEK_VIEW (object),
+                               g_value_get_boolean (value));
+                       return;
        }
 
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -799,6 +808,13 @@ week_view_get_property (GObject *object,
                                E_WEEK_VIEW (object)));
                        return;
 
+               case PROP_SHOW_ICONS_MONTH_VIEW:
+                       g_value_set_boolean (
+                               value,
+                               e_week_view_get_show_icons_month_view (
+                               E_WEEK_VIEW (object)));
+                       return;
+
                case PROP_IS_EDITING:
                        g_value_set_boolean (value, e_week_view_is_editing (E_WEEK_VIEW (object)));
                        return;
@@ -1624,6 +1640,17 @@ e_week_view_class_init (EWeekViewClass *class)
                        G_PARAM_READWRITE |
                        G_PARAM_STATIC_STRINGS));
 
+       g_object_class_install_property (
+               object_class,
+               PROP_SHOW_ICONS_MONTH_VIEW,
+               g_param_spec_boolean (
+                       "show-icons-month-view",
+                       "Show Icons Month View",
+                       NULL,
+                       FALSE,
+                       G_PARAM_READWRITE |
+                       G_PARAM_STATIC_STRINGS));
+
        g_object_class_override_property (
                object_class,
                PROP_IS_EDITING,
@@ -2454,6 +2481,37 @@ e_week_view_set_show_event_end_times (EWeekView *week_view,
        g_object_notify (G_OBJECT (week_view), "show-event-end-times");
 }
 
+gboolean
+e_week_view_get_show_icons_month_view (EWeekView *week_view)
+{
+       g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), TRUE);
+
+       return week_view->priv->show_icons_month_view;
+}
+
+void
+e_week_view_set_show_icons_month_view (EWeekView *week_view,
+                                      gboolean show_icons_month_view)
+{
+       g_return_if_fail (E_IS_WEEK_VIEW (week_view));
+
+       if (show_icons_month_view == week_view->priv->show_icons_month_view)
+               return;
+
+       week_view->priv->show_icons_month_view = show_icons_month_view;
+
+       if (e_week_view_get_multi_week_view (week_view)) {
+               e_week_view_recalc_cell_sizes (week_view);
+               week_view->events_need_reshape = TRUE;
+               e_week_view_check_layout (week_view);
+
+               gtk_widget_queue_draw (week_view->titles_canvas);
+               gtk_widget_queue_draw (week_view->main_canvas);
+       }
+
+       g_object_notify (G_OBJECT (week_view), "show-icons-month-view");
+}
+
 static gboolean
 e_week_view_recalc_display_start_day (EWeekView *week_view)
 {
@@ -3588,7 +3646,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
                show_icons = FALSE;
                use_max_width = TRUE;
        } else if (e_week_view_get_multi_week_view (week_view)) {
-               show_icons = FALSE;
+               show_icons = e_week_view_get_show_icons_month_view (week_view);
        }
 
        /* Calculate how many icons we need to show. */
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index d120645..18a5f8c 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -380,6 +380,11 @@ gboolean   e_week_view_get_show_event_end_times
 void           e_week_view_set_show_event_end_times
                                                (EWeekView *week_view,
                                                 gboolean show_event_end_times);
+gboolean       e_week_view_get_show_icons_month_view
+                                               (EWeekView *week_view);
+void           e_week_view_set_show_icons_month_view
+                                               (EWeekView *week_view,
+                                                gboolean show_icons_month_view);
 
 void           e_week_view_delete_occurrence   (EWeekView *week_view);
 
diff --git a/data/org.gnome.evolution.calendar.gschema.xml.in 
b/data/org.gnome.evolution.calendar.gschema.xml.in
index 20965b4..95f6304 100644
--- a/data/org.gnome.evolution.calendar.gschema.xml.in
+++ b/data/org.gnome.evolution.calendar.gschema.xml.in
@@ -324,6 +324,11 @@
       <_summary>Show appointment end times in week and month views</_summary>
       <_description>Whether to display the end time of events in the week and month views</_description>
     </key>
+    <key name="show-icons-month-view" type="b">
+      <default>false</default>
+      <_summary>Show appointment icons in the month view</_summary>
+      <_description>Whether to show icons of events in the month view</_description>
+    </key>
     <key name="show-memo-preview" type="b">
       <default>true</default>
       <_summary>Show the memo preview pane</_summary>
diff --git a/modules/calendar/e-calendar-preferences.c b/modules/calendar/e-calendar-preferences.c
index 888b4ba..73346e9 100644
--- a/modules/calendar/e-calendar-preferences.c
+++ b/modules/calendar/e-calendar-preferences.c
@@ -932,6 +932,12 @@ calendar_preferences_construct (ECalendarPreferences *prefs,
                widget, "active",
                G_SETTINGS_BIND_DEFAULT);
 
+       widget = e_builder_get_widget (prefs->builder, "show_icons_month_view");
+       g_settings_bind (
+               settings, "show-icons-month-view",
+               widget, "active",
+               G_SETTINGS_BIND_DEFAULT);
+
        widget = e_builder_get_widget (prefs->builder, "compress_weekend");
        g_settings_bind (
                settings, "compress-weekend",
diff --git a/modules/calendar/e-calendar-preferences.ui b/modules/calendar/e-calendar-preferences.ui
index f03ad75..2b17953 100644
--- a/modules/calendar/e-calendar-preferences.ui
+++ b/modules/calendar/e-calendar-preferences.ui
@@ -827,6 +827,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="show_icons_month_view">
+                    <property name="label" translatable="yes">Show appointment _icons in the month 
view</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkCheckButton" id="compress_weekend">
                     <property name="label" translatable="yes">_Compress weekends in month view</property>
                     <property name="visible">True</property>
@@ -838,7 +853,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="position">3</property>
                   </packing>
                 </child>
                 <child>
@@ -853,7 +868,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">3</property>
+                    <property name="position">4</property>
                   </packing>
                 </child>
                 <child>
@@ -868,7 +883,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">4</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
                 <child>
@@ -883,7 +898,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">5</property>
+                    <property name="position">6</property>
                   </packing>
                 </child>
               </object>
diff --git a/modules/settings/e-settings-calendar-view.c b/modules/settings/e-settings-calendar-view.c
index a144cfb..4cacb34 100644
--- a/modules/settings/e-settings-calendar-view.c
+++ b/modules/settings/e-settings-calendar-view.c
@@ -92,6 +92,11 @@ settings_calendar_view_constructed (GObject *object)
                        settings, "show-event-end",
                        extensible, "show-event-end-times",
                        G_SETTINGS_BIND_GET);
+
+               g_settings_bind (
+                       settings, "show-icons-month-view",
+                       extensible, "show-icons-month-view",
+                       G_SETTINGS_BIND_GET);
        }
 
        g_object_unref (settings);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]