[evolution] Bug #612181 - Show recurring events in italic in date navigator



commit bad8aff04f274c58c584bd5f7e8a396918aa9fb4
Author: Milan Crha <mcrha redhat com>
Date:   Wed Nov 3 16:35:02 2010 +0100

    Bug #612181 - Show recurring events in italic in date navigator

 calendar/gui/apps_evolution_calendar.schemas.in |   13 +++++++++++++
 calendar/gui/dialogs/cal-prefs-dialog.c         |    7 +++++++
 calendar/gui/dialogs/cal-prefs-dialog.ui        |   17 ++++++++++++++++-
 calendar/gui/dialogs/recurrence-page.c          |    2 +-
 calendar/gui/gnome-cal.c                        |    2 +-
 calendar/gui/tag-calendar.c                     |   22 +++++++++++++++++++++-
 calendar/gui/tag-calendar.h                     |    3 ++-
 modules/calendar/e-cal-shell-settings.c         |    4 ++++
 8 files changed, 65 insertions(+), 5 deletions(-)
---
diff --git a/calendar/gui/apps_evolution_calendar.schemas.in b/calendar/gui/apps_evolution_calendar.schemas.in
index c37bbbd..229020a 100644
--- a/calendar/gui/apps_evolution_calendar.schemas.in
+++ b/calendar/gui/apps_evolution_calendar.schemas.in
@@ -506,6 +506,19 @@
       </locale>
     </schema>
 
+
+     <schema>
+      <key>/schemas/apps/evolution/calendar/display/recur_events_italic</key>
+      <applyto>/apps/evolution/calendar/display/recur_events_italic</applyto>
+      <owner>evolution-calendar</owner>
+      <type>bool</type>
+      <default>false</default>
+      <locale name="C">
+        <short>Recurrent Events in Italic</short>
+        <long>Show days with recurrent events in italic font in bottom left calendar.</long>
+      </locale>
+    </schema>
+
     <!-- Memos -->
 
     <schema>
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c
index 266d699..6316211 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.c
+++ b/calendar/gui/dialogs/cal-prefs-dialog.c
@@ -789,6 +789,13 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs,
 		G_BINDING_BIDIRECTIONAL |
 		G_BINDING_SYNC_CREATE);
 
+	widget = e_builder_get_widget (prefs->builder, "recur_events_italic");
+	g_object_bind_property (
+		shell_settings, "cal-recur-events-italic",
+		widget, "active",
+		G_BINDING_BIDIRECTIONAL |
+		G_BINDING_SYNC_CREATE);
+
 	prefs->month_scroll_by_week = e_builder_get_widget (prefs->builder, "month_scroll_by_week");
 
 	widget = e_builder_get_widget (prefs->builder, "tasks_due_today_color");
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.ui b/calendar/gui/dialogs/cal-prefs-dialog.ui
index 6b6218d..7e581cf 100644
--- a/calendar/gui/dialogs/cal-prefs-dialog.ui
+++ b/calendar/gui/dialogs/cal-prefs-dialog.ui
@@ -978,6 +978,21 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="recur_events_italic">
+                    <property name="label" translatable="yes">Show r_ecurring events in italic in bottom left calendar</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">4</property>
+                  </packing>
+                </child>
+                <child>
                   <object class="GtkCheckButton" id="month_scroll_by_week">
                     <property name="label" translatable="yes">Sc_roll Month View by a week</property>
                     <property name="visible">True</property>
@@ -989,7 +1004,7 @@
                   <packing>
                     <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">4</property>
+                    <property name="position">5</property>
                   </packing>
                 </child>
               </object>
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 4014cfb..f5ef574 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -271,7 +271,7 @@ preview_recur (RecurrencePage *rpage)
 	fill_component (rpage, comp);
 
 	tag_calendar_by_comp (E_CALENDAR (priv->preview_calendar), comp,
-			      client, zone, TRUE, FALSE);
+			      client, zone, TRUE, FALSE, FALSE);
 	g_object_unref (comp);
 }
 
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 9b9400d..3945003 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -775,7 +775,7 @@ dn_e_cal_view_objects_added_cb (ECalView *query, GList *objects, gpointer data)
 		tag_calendar_by_comp (
 			priv->date_navigator, comp,
 			e_cal_view_get_client (query),
-			NULL, FALSE, TRUE);
+			NULL, FALSE, TRUE, TRUE);
 		g_object_unref (comp);
 	}
 }
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index f700da5..0af271e 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -29,6 +29,8 @@
 #endif
 
 #include <libecal/e-cal-time-util.h>
+#include "shell/e-shell.h"
+#include "shell/e-shell-settings.h"
 #include "calendar-config.h"
 #include "tag-calendar.h"
 
@@ -39,6 +41,7 @@ struct calendar_tag_closure {
 	time_t end_time;
 
 	gboolean skip_transparent_events;
+	gboolean recur_events_italic;
 };
 
 /* Clears all the tags in a calendar and fills a closure structure with the
@@ -108,6 +111,8 @@ tag_calendar_cb (ECalComponent *comp,
 			return TRUE;
 
 		style = E_CALENDAR_ITEM_MARK_ITALIC;
+	} else if (c->recur_events_italic && e_cal_component_is_instance (comp)) {
+		style = E_CALENDAR_ITEM_MARK_ITALIC;
 	} else {
 		style = E_CALENDAR_ITEM_MARK_BOLD;
 	}
@@ -124,6 +129,18 @@ tag_calendar_cb (ECalComponent *comp,
 	return TRUE;
 }
 
+static gboolean
+get_recur_events_italic (void)
+{
+	EShell *shell;
+	EShellSettings *shell_settings;
+
+	shell = e_shell_get_default ();
+	shell_settings = e_shell_get_shell_settings (shell);
+
+	return e_shell_settings_get_boolean (shell_settings, "cal-recur-events-italic");
+}
+
 /**
  * tag_calendar_by_client:
  * @ecal: Calendar widget to tag.
@@ -152,6 +169,7 @@ tag_calendar_by_client (ECalendar *ecal,
 		return;
 
 	c.skip_transparent_events = TRUE;
+	c.recur_events_italic = get_recur_events_italic ();
 
 	e_cal_generate_instances (
 		client, c.start_time, c.end_time, tag_calendar_cb, &c);
@@ -202,7 +220,8 @@ tag_calendar_by_comp (ECalendar *ecal,
                       ECal *client,
                       icaltimezone *display_zone,
                       gboolean clear_first,
-                      gboolean comp_is_on_server)
+                      gboolean comp_is_on_server,
+		      gboolean can_recur_events_italic)
 {
 	struct calendar_tag_closure c;
 
@@ -217,6 +236,7 @@ tag_calendar_by_comp (ECalendar *ecal,
 		return;
 
 	c.skip_transparent_events = FALSE;
+	c.recur_events_italic = can_recur_events_italic && get_recur_events_italic ();
 
 	if (comp_is_on_server)
 		e_cal_generate_instances_for_object (
diff --git a/calendar/gui/tag-calendar.h b/calendar/gui/tag-calendar.h
index e1d9fcf..ebf9961 100644
--- a/calendar/gui/tag-calendar.h
+++ b/calendar/gui/tag-calendar.h
@@ -33,6 +33,7 @@
 void tag_calendar_by_client (ECalendar *ecal, ECal *client);
 void tag_calendar_by_comp (ECalendar *ecal, ECalComponent *comp,
 			   ECal *client, icaltimezone *display_zone,
-			   gboolean clear_first, gboolean comp_is_on_server);
+			   gboolean clear_first, gboolean comp_is_on_server,
+			   gboolean can_recur_events_italic);
 
 #endif
diff --git a/modules/calendar/e-cal-shell-settings.c b/modules/calendar/e-cal-shell-settings.c
index 0ab35eb..524157c 100644
--- a/modules/calendar/e-cal-shell-settings.c
+++ b/modules/calendar/e-cal-shell-settings.c
@@ -551,6 +551,10 @@ e_cal_shell_backend_init_settings (EShell *shell)
 		"/apps/evolution/calendar/tasks/primary_tasks");
 
 	e_shell_settings_install_property_for_key (
+		"cal-recur-events-italic",
+		"/apps/evolution/calendar/display/recur_events_italic");
+
+	e_shell_settings_install_property_for_key (
 		"cal-show-event-end-times",
 		"/apps/evolution/calendar/display/show_event_end");
 



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