diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-06-01 19:33:52 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-06-01 19:33:52 +0800 |
commit | c12dc5766786efa9c2e82fb0b59fa1edf18d5f38 (patch) | |
tree | ad052a623a4c4de7e50861cbdbed3944f92aa60f /calendar | |
parent | af2178334938f9f45aa2c39f6880394bb5c12988 (diff) | |
download | gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar.gz gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar.bz2 gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar.lz gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar.xz gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.tar.zst gsoc2013-evolution-c12dc5766786efa9c2e82fb0b59fa1edf18d5f38.zip |
GnomeCalendar: Avoid runtime warnings during initialization.
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/gui/gnome-cal.c | 112 |
1 files changed, 60 insertions, 52 deletions
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c index 616a26b949..4afafd475b 100644 --- a/calendar/gui/gnome-cal.c +++ b/calendar/gui/gnome-cal.c @@ -1395,71 +1395,79 @@ gnome_calendar_set_search_query (GnomeCalendar *gcal, static void update_task_and_memo_views (GnomeCalendar *gcal) { - ECalModel *memo_model; - ECalModel *task_model; - ECalModel *view_model; - EMemoTable *memo_table; - ETaskTable *task_table; - time_t start = -1, end = -1; - gchar *hide_completed_tasks_sexp; - - /* Set the query on the task pad. */ - - task_table = E_TASK_TABLE (gcal->priv->task_table); - task_model = e_task_table_get_model (task_table); - - hide_completed_tasks_sexp = - calendar_config_get_hide_completed_tasks_sexp (FALSE); - - if (hide_completed_tasks_sexp != NULL) { - if (gcal->priv->sexp != NULL) { - gchar *sexp; - - sexp = g_strdup_printf ( - "(and %s %s)", - hide_completed_tasks_sexp, - gcal->priv->sexp); - e_cal_model_set_search_query (task_model, sexp); - g_free (sexp); + if (gcal->priv->task_table != NULL) { + ECalModel *task_model; + ETaskTable *task_table; + gchar *hide_completed_tasks_sexp; + + /* Set the query on the task pad. */ + + task_table = E_TASK_TABLE (gcal->priv->task_table); + task_model = e_task_table_get_model (task_table); + + hide_completed_tasks_sexp = + calendar_config_get_hide_completed_tasks_sexp (FALSE); + + if (hide_completed_tasks_sexp != NULL) { + if (gcal->priv->sexp != NULL) { + gchar *search_query; + + search_query = g_strdup_printf ( + "(and %s %s)", + hide_completed_tasks_sexp, + gcal->priv->sexp); + e_cal_model_set_search_query ( + task_model, search_query); + g_free (search_query); + } else { + e_cal_model_set_search_query ( + task_model, hide_completed_tasks_sexp); + } } else { e_cal_model_set_search_query ( - task_model, hide_completed_tasks_sexp); + task_model, gcal->priv->sexp); } - } else { - e_cal_model_set_search_query (task_model, gcal->priv->sexp); + + g_free (hide_completed_tasks_sexp); } - g_free (hide_completed_tasks_sexp); + if (gcal->priv->memo_table != NULL) { + ECalModel *memo_model; + ECalModel *view_model; + EMemoTable *memo_table; + time_t start = -1, end = -1; - /* Set the query on the memo pad. */ + /* Set the query on the memo pad. */ - memo_table = E_MEMO_TABLE (gcal->priv->memo_table); - memo_model = e_memo_table_get_model (memo_table); + memo_table = E_MEMO_TABLE (gcal->priv->memo_table); + memo_model = e_memo_table_get_model (memo_table); - view_model = gnome_calendar_get_model (gcal); - e_cal_model_get_time_range (view_model, &start, &end); + view_model = gnome_calendar_get_model (gcal); + e_cal_model_get_time_range (view_model, &start, &end); - if (start != -1 && end != -1) { - gchar *iso_start; - gchar *iso_end; - gchar *sexp; + if (start != -1 && end != -1) { + gchar *search_query; + gchar *iso_start; + gchar *iso_end; - iso_start = isodate_from_time_t (start); - iso_end = isodate_from_time_t (end); + iso_start = isodate_from_time_t (start); + iso_end = isodate_from_time_t (end); - sexp = g_strdup_printf ( - "(and (or (not (has-start?)) " - "(occur-in-time-range? (make-time \"%s\") " - "(make-time \"%s\") \"%s\")) %s)", - iso_start, iso_end, - gcal_get_default_tzloc (gcal), - gcal->priv->sexp ? gcal->priv->sexp : ""); + search_query = g_strdup_printf ( + "(and (or (not (has-start?)) " + "(occur-in-time-range? (make-time \"%s\") " + "(make-time \"%s\") \"%s\")) %s)", + iso_start, iso_end, + gcal_get_default_tzloc (gcal), + gcal->priv->sexp ? gcal->priv->sexp : ""); - e_cal_model_set_search_query (memo_model, sexp); + e_cal_model_set_search_query ( + memo_model, search_query); - g_free (iso_start); - g_free (iso_end); - g_free (sexp); + g_free (search_query); + g_free (iso_start); + g_free (iso_end); + } } } |