diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-11-02 04:32:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-11-05 02:18:34 +0800 |
commit | a2e309c2a1735bd68b315aa971388e20db3a8621 (patch) | |
tree | d9da4a5546d45406b693e2893363a911b7eddd4b /calendar | |
parent | 6fdbedf62c34a78d403d0376a4403b2196da0385 (diff) | |
download | gsoc2013-evolution-a2e309c2a1735bd68b315aa971388e20db3a8621.tar.gz gsoc2013-evolution-a2e309c2a1735bd68b315aa971388e20db3a8621.tar.zst gsoc2013-evolution-a2e309c2a1735bd68b315aa971388e20db3a8621.zip |
Rename CalUnits to EDurationType.
And move the definition to e-util-enums.h so we get a GType for it.
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/calendar-config.c | 56 | ||||
-rw-r--r-- | calendar/gui/calendar-config.h | 23 | ||||
-rw-r--r-- | calendar/gui/comp-util.c | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 32 | ||||
-rw-r--r-- | calendar/gui/e-itip-control.c | 8 |
6 files changed, 66 insertions, 71 deletions
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 882459f13f..a572ac004e 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -90,16 +90,16 @@ calendar_config_locale_supports_12_hour_format (void) /* Returns the string representation of a units value */ static const gchar * -units_to_string (CalUnits units) +units_to_string (EDurationType units) { switch (units) { - case CAL_DAYS: + case E_DURATION_DAYS: return "days"; - case CAL_HOURS: + case E_DURATION_HOURS: return "hours"; - case CAL_MINUTES: + case E_DURATION_MINUTES: return "minutes"; default: @@ -108,17 +108,17 @@ units_to_string (CalUnits units) } /* opposite function to 'units_to_string' */ -static CalUnits +static EDurationType string_to_units (const gchar *units) { - CalUnits res; + EDurationType res; if (units && !strcmp (units, "days")) - res = CAL_DAYS; + res = E_DURATION_DAYS; else if (units && !strcmp (units, "hours")) - res = CAL_HOURS; + res = E_DURATION_HOURS; else - res = CAL_MINUTES; + res = E_DURATION_MINUTES; return res; } @@ -397,22 +397,22 @@ calendar_config_set_hide_completed_tasks (gboolean hide) gconf_client_set_bool (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED, hide, NULL); } -CalUnits +EDurationType calendar_config_get_hide_completed_tasks_units (void) { gchar *units; - CalUnits cu; + EDurationType cu; calendar_config_init (); units = gconf_client_get_string (config, CALENDAR_CONFIG_TASKS_HIDE_COMPLETED_UNITS, NULL); if (units && !strcmp (units, "minutes")) - cu = CAL_MINUTES; + cu = E_DURATION_MINUTES; else if (units && !strcmp (units, "hours")) - cu = CAL_HOURS; + cu = E_DURATION_HOURS; else - cu = CAL_DAYS; + cu = E_DURATION_DAYS; g_free (units); @@ -420,17 +420,17 @@ calendar_config_get_hide_completed_tasks_units (void) } void -calendar_config_set_hide_completed_tasks_units (CalUnits cu) +calendar_config_set_hide_completed_tasks_units (EDurationType cu) { gchar *units; calendar_config_init (); switch (cu) { - case CAL_MINUTES : + case E_DURATION_MINUTES : units = g_strdup ("minutes"); break; - case CAL_HOURS : + case E_DURATION_HOURS : units = g_strdup ("hours"); break; default : @@ -542,15 +542,15 @@ calendar_config_set_default_reminder_interval (gint interval) * calendar_config_get_default_reminder_units: * * Queries the units of time in which default reminders should be created for - * new appointments, e.g. CAL_MINUTES for "5 minutes". + * new appointments, e.g. E_DURATION_MINUTES for "5 minutes". * * Return value: Time units for default reminders. **/ -CalUnits +EDurationType calendar_config_get_default_reminder_units (void) { gchar *units; - CalUnits cu; + EDurationType cu; calendar_config_init (); @@ -563,12 +563,12 @@ calendar_config_get_default_reminder_units (void) /** * calendar_config_set_default_reminder_units: - * @units: Time units, e.g. CAL_MINUTES for "5 minutes". + * @units: Time units, e.g. E_DURATION_MINUTES for "5 minutes". * * Sets the units to be used for default reminders in new appointments. **/ void -calendar_config_set_default_reminder_units (CalUnits units) +calendar_config_set_default_reminder_units (EDurationType units) { calendar_config_init (); @@ -586,7 +586,7 @@ calendar_config_set_default_reminder_units (CalUnits units) * are retrieved even when returns FALSE. **/ gboolean -calendar_config_get_ba_reminder (gint *interval, CalUnits *units) +calendar_config_get_ba_reminder (gint *interval, EDurationType *units) { calendar_config_init (); @@ -614,7 +614,7 @@ calendar_config_get_ba_reminder (gint *interval, CalUnits *units) * @units: The units of the reminder; can be NULL. **/ void -calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, CalUnits *units) +calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, EDurationType *units) { calendar_config_init (); @@ -642,7 +642,7 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed) gchar *sexp = NULL; if (calendar_config_get_hide_completed_tasks ()) { - CalUnits units; + EDurationType units; gint value; units = calendar_config_get_hide_completed_tasks_units (); @@ -667,13 +667,13 @@ calendar_config_get_hide_completed_tasks_sexp (gboolean get_completed) tt = icaltime_current_time_with_zone (zone); switch (units) { - case CAL_DAYS: + case E_DURATION_DAYS: icaltime_adjust (&tt, -value, 0, 0, 0); break; - case CAL_HOURS: + case E_DURATION_HOURS: icaltime_adjust (&tt, 0, -value, 0, 0); break; - case CAL_MINUTES: + case E_DURATION_MINUTES: icaltime_adjust (&tt, 0, 0, -value, 0); break; default: diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index af183d3d2e..8f41276b89 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -32,6 +32,7 @@ #include <gdk/gdk.h> #include <libecal/e-cal.h> #include <gconf/gconf-client.h> +#include <e-util/e-util-enums.h> /* These are used to get/set the working days in the week. The bit-flags are combined together. The bits must be from 0 (Sun) to 6 (Sat) to match the @@ -47,14 +48,6 @@ typedef enum CAL_SATURDAY = 1 << 6 } CalWeekdays; -/* Units for settings. */ -typedef enum -{ - CAL_DAYS, - CAL_HOURS, - CAL_MINUTES -} CalUnits; - void calendar_config_remove_notification (guint id); /* @@ -109,8 +102,9 @@ void calendar_config_set_memos_selected (GSList *selected); gboolean calendar_config_get_hide_completed_tasks (void); void calendar_config_set_hide_completed_tasks (gboolean hide); -CalUnits calendar_config_get_hide_completed_tasks_units (void); -void calendar_config_set_hide_completed_tasks_units (CalUnits units); +EDurationType + calendar_config_get_hide_completed_tasks_units (void); +void calendar_config_set_hide_completed_tasks_units (EDurationType units); gint calendar_config_get_hide_completed_tasks_value (void); void calendar_config_set_hide_completed_tasks_value (gint value); @@ -127,8 +121,9 @@ void calendar_config_set_use_default_reminder (gboolean value); gint calendar_config_get_default_reminder_interval (void); void calendar_config_set_default_reminder_interval (gint interval); -CalUnits calendar_config_get_default_reminder_units (void); -void calendar_config_set_default_reminder_units (CalUnits units); +EDurationType + calendar_config_get_default_reminder_units (void); +void calendar_config_set_default_reminder_units (EDurationType units); /* Returns TRUE if the locale has 'am' and 'pm' strings defined, i.e. it supports 12-hour time format. */ @@ -145,8 +140,8 @@ void calendar_config_select_day_second_zone (void); guint calendar_config_add_notification_day_second_zone (GConfClientNotifyFunc func, gpointer data); /* Birthdays & Anniversaries reminder settings */ -gboolean calendar_config_get_ba_reminder (gint *interval, CalUnits *units); -void calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, CalUnits *units); +gboolean calendar_config_get_ba_reminder (gint *interval, EDurationType *units); +void calendar_config_set_ba_reminder (gboolean *enabled, gint *interval, EDurationType *units); /* Scroll in a month view by a week, not by a month */ gboolean calendar_config_get_month_scroll_by_week (void); diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c index 2254d49cf6..d0182a0f8d 100644 --- a/calendar/gui/comp-util.c +++ b/calendar/gui/comp-util.c @@ -290,7 +290,7 @@ cal_comp_event_new_with_defaults (ECal *client, gboolean all_day) icalcomponent *icalcomp; ECalComponent *comp; gint interval; - CalUnits units; + EDurationType units; ECalComponentAlarm *alarm; icalproperty *icalprop; ECalComponentAlarmTrigger trigger; @@ -331,15 +331,15 @@ cal_comp_event_new_with_defaults (ECal *client, gboolean all_day) trigger.u.rel_duration.is_neg = TRUE; switch (units) { - case CAL_MINUTES: + case E_DURATION_MINUTES: trigger.u.rel_duration.minutes = interval; break; - case CAL_HOURS: + case E_DURATION_HOURS: trigger.u.rel_duration.hours = interval; break; - case CAL_DAYS: + case E_DURATION_DAYS: trigger.u.rel_duration.days = interval; break; diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 6316211c8a..f404d08927 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -45,12 +45,12 @@ static const gint time_division_map[] = { /* The following two are kept separate in case we need to re-order each menu individually */ static const gint hide_completed_units_map[] = { - CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 + E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1 }; /* same is used for Birthdays & Anniversaries calendar */ static const gint default_reminder_units_map[] = { - CAL_MINUTES, CAL_HOURS, CAL_DAYS, -1 + E_DURATION_MINUTES, E_DURATION_HOURS, E_DURATION_DAYS, -1 }; static GtkVBoxClass *parent_class = NULL; @@ -331,7 +331,7 @@ ba_reminder_interval_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) static void ba_reminder_units_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) { - CalUnits units = e_dialog_combo_box_get (prefs->ba_reminder_units, default_reminder_units_map); + EDurationType units = e_dialog_combo_box_get (prefs->ba_reminder_units, default_reminder_units_map); calendar_config_set_ba_reminder (NULL, NULL, &units); } @@ -451,7 +451,7 @@ setup_changes (CalendarPrefsDialog *prefs) static void show_task_list_config (CalendarPrefsDialog *prefs) { - CalUnits units; + EDurationType units; gboolean hide_completed_tasks; /* Hide Completed Tasks. */ @@ -517,7 +517,7 @@ show_config (CalendarPrefsDialog *prefs) { gint time_divisions; gboolean set = FALSE; - CalUnits units; + EDurationType units; gint interval; /* Day's second zone */ diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index 94b25a0510..0418c7f5df 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -180,7 +180,7 @@ struct _EventPagePrivate { ESendOptionsDialog *sod; gchar *old_summary; - CalUnits alarm_units; + EDurationType alarm_units; gint alarm_interval; /* This is TRUE if both the start & end timezone are the same. If the @@ -517,7 +517,7 @@ clear_widgets (EventPage *epage) } static gboolean -is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) +is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type) { ECalComponentAlarmTrigger trigger; ECalComponentAlarmRepeat repeat; @@ -600,7 +600,7 @@ is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units if (user_interval != -1) { switch (user_units) { - case CAL_DAYS: + case E_DURATION_DAYS: if (trigger.u.rel_duration.days == user_interval && trigger.u.rel_duration.hours == 0 && trigger.u.rel_duration.minutes == 0) { @@ -610,7 +610,7 @@ is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units } break; - case CAL_HOURS: + case E_DURATION_HOURS: if (trigger.u.rel_duration.days == 0 && trigger.u.rel_duration.hours == user_interval && trigger.u.rel_duration.minutes == 0) { @@ -620,7 +620,7 @@ is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units } break; - case CAL_MINUTES: + case E_DURATION_MINUTES: if (trigger.u.rel_duration.days == 0 && trigger.u.rel_duration.hours == 0 && trigger.u.rel_duration.minutes == user_interval) { @@ -636,7 +636,7 @@ is_custom_alarm (ECalComponentAlarm *ca, gchar *old_summary, CalUnits user_units } static gboolean -is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) +is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type) { ECalComponentAlarm *ca; gboolean result; @@ -652,7 +652,7 @@ is_custom_alarm_uid_list (ECalComponent *comp, GList *alarms, gchar *old_summary } static gboolean -is_custom_alarm_store (EAlarmList *alarm_list_store, gchar *old_summary, CalUnits user_units, gint user_interval, gint *alarm_type) +is_custom_alarm_store (EAlarmList *alarm_list_store, gchar *old_summary, EDurationType user_units, gint user_interval, gint *alarm_type) { const ECalComponentAlarm *alarm; GtkTreeModel *model; @@ -1492,15 +1492,15 @@ event_page_fill_component (CompEditorPage *page, ECalComponent *comp) case ALARM_USER_TIME: switch (calendar_config_get_default_reminder_units ()) { - case CAL_DAYS: + case E_DURATION_DAYS: trigger.u.rel_duration.days = priv->alarm_interval; break; - case CAL_HOURS: + case E_DURATION_HOURS: trigger.u.rel_duration.hours = priv->alarm_interval; break; - case CAL_MINUTES: + case E_DURATION_MINUTES: trigger.u.rel_duration.minutes = priv->alarm_interval; break; } @@ -2744,15 +2744,15 @@ alarm_changed_cb (GtkWidget *widget, case ALARM_USER_TIME: e_alarm_list_clear (priv->alarm_list_store); switch (calendar_config_get_default_reminder_units ()) { - case CAL_DAYS: + case E_DURATION_DAYS: trigger.u.rel_duration.days = priv->alarm_interval; break; - case CAL_HOURS: + case E_DURATION_HOURS: trigger.u.rel_duration.hours = priv->alarm_interval; break; - case CAL_MINUTES: + case E_DURATION_MINUTES: trigger.u.rel_duration.minutes = priv->alarm_interval; break; } @@ -2992,19 +2992,19 @@ init_widgets (EventPage *epage) combo_label = NULL; switch (priv->alarm_units) { - case CAL_DAYS: + case E_DURATION_DAYS: if (priv->alarm_interval != 1) { combo_label = g_strdup_printf (ngettext("%d day before appointment", "%d days before appointment", priv->alarm_interval), priv->alarm_interval); } break; - case CAL_HOURS: + case E_DURATION_HOURS: if (priv->alarm_interval != 1) { combo_label = g_strdup_printf (ngettext("%d hour before appointment", "%d hours before appointment", priv->alarm_interval), priv->alarm_interval); } break; - case CAL_MINUTES: + case E_DURATION_MINUTES: if (priv->alarm_interval != 15) { combo_label = g_strdup_printf (ngettext("%d minute before appointment", "%d minutes before appointment", priv->alarm_interval), priv->alarm_interval); } diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 2c1c452299..6c96b1a4e6 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -1620,7 +1620,7 @@ show_current (EItipControl *itip) if (calendar_config_get_use_default_reminder ()) { ECalComponentAlarm *acomp; gint interval; - CalUnits units; + EDurationType units; ECalComponentAlarmTrigger trigger; interval = calendar_config_get_default_reminder_interval (); @@ -1636,13 +1636,13 @@ show_current (EItipControl *itip) trigger.u.rel_duration.is_neg = TRUE; switch (units) { - case CAL_MINUTES: + case E_DURATION_MINUTES: trigger.u.rel_duration.minutes = interval; break; - case CAL_HOURS: + case E_DURATION_HOURS: trigger.u.rel_duration.hours = interval; break; - case CAL_DAYS: + case E_DURATION_DAYS: trigger.u.rel_duration.days = interval; break; default: |