diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-06-09 18:56:27 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-07-16 01:14:43 +0800 |
commit | 858a2a884dbc243c485f1424d90675e06fa207b2 (patch) | |
tree | d9469a1bef86685b7741fdae05ff8f30605e5b96 /modules/calendar/e-memo-shell-backend.c | |
parent | 51a41db621693114f5ee60d48e7e6442fc85fcc4 (diff) | |
download | gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar.gz gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar.bz2 gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar.lz gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar.xz gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.tar.zst gsoc2013-evolution-858a2a884dbc243c485f1424d90675e06fa207b2.zip |
Clean up "ensure_sources" backend routines.
Remove redundant logic (we call e_source_list_ensure_group() and then
proceed to do the same thing it just did), and use "local:" as the base
URI for the "On This Computer" group.
This requires commit 9e0845207b39f256f7e81d388741ed30a764ea7b in
Evolution-Data-Server to work properly.
Diffstat (limited to 'modules/calendar/e-memo-shell-backend.c')
-rw-r--r-- | modules/calendar/e-memo-shell-backend.c | 67 |
1 files changed, 12 insertions, 55 deletions
diff --git a/modules/calendar/e-memo-shell-backend.c b/modules/calendar/e-memo-shell-backend.c index 3996fa699f..8f5bf40825 100644 --- a/modules/calendar/e-memo-shell-backend.c +++ b/modules/calendar/e-memo-shell-backend.c @@ -72,10 +72,8 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) ESource *personal; EShell *shell; EShellSettings *shell_settings; - const gchar *data_dir; + GSList *sources, *iter; const gchar *name; - gchar *base_uri, base_uri_seventh; - gchar *filename; gboolean save_list = FALSE; personal = NULL; @@ -90,65 +88,25 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) return; } - data_dir = e_shell_backend_get_data_dir (shell_backend); - filename = g_build_filename (data_dir, "local", NULL); - base_uri = g_filename_to_uri (filename, NULL, NULL); - g_free (filename); - - if (strlen (base_uri) > 7) { - /* Compare only file:// part. If user home dir name - * changes we do not want to create one more group. */ - base_uri_seventh = base_uri[7]; - base_uri[7] = 0; - } else { - base_uri_seventh = -1; - } - on_this_computer = e_source_list_ensure_group ( - priv->source_list, _("On This Computer"), base_uri, TRUE); + priv->source_list, _("On This Computer"), "local:", TRUE); e_source_list_ensure_group ( - priv->source_list, _("On The Web"), WEB_BASE_URI, FALSE); - - if (base_uri_seventh != -1) { - base_uri[7] = base_uri_seventh; - } - - if (on_this_computer != NULL) { - GSList *sources, *iter; - const gchar *group_base_uri; - - sources = e_source_group_peek_sources (on_this_computer); - group_base_uri = e_source_group_peek_base_uri (on_this_computer); + priv->source_list, _("On The Web"), "webcal://", FALSE); - /* Make sure this group includes a "Personal" source. */ - for (iter = sources; iter != NULL; iter = iter->next) { - ESource *source = iter->data; - const gchar *relative_uri; + g_return_if_fail (on_this_computer); - relative_uri = e_source_peek_relative_uri (source); - if (relative_uri == NULL) - continue; + sources = e_source_group_peek_sources (on_this_computer); - if (strcmp (PERSONAL_RELATIVE_URI, relative_uri) != 0) - continue; + /* Make sure this group includes a "Personal" source. */ + for (iter = sources; iter != NULL; iter = iter->next) { + ESource *source = iter->data; + const gchar *relative_uri; + relative_uri = e_source_peek_relative_uri (source); + if (g_strcmp0 (relative_uri, "system") == 0) { personal = source; break; } - - /* Make sure we have the correct base URI. This can - * change when the user's home directory changes. */ - if (strcmp (base_uri, group_base_uri) != 0) { - e_source_group_set_base_uri ( - on_this_computer, base_uri); - - /* XXX We shouldn't need this sync call here as - * set_base_uri() results in synching to GConf, - * but that happens in an idle loop and too late - * to prevent the user from seeing a "Cannot - * Open ... because of invalid URI" error. */ - save_list = TRUE; - } } name = _("Personal"); @@ -158,7 +116,7 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) GSList *selected; gchar *primary; - source = e_source_new (name, PERSONAL_RELATIVE_URI); + source = e_source_new (name, "system"); e_source_set_color_spec (source, "#BECEDD"); e_source_group_add_source (on_this_computer, source, -1); g_object_unref (source); @@ -189,7 +147,6 @@ memo_shell_backend_ensure_sources (EShellBackend *shell_backend) } g_object_unref (on_this_computer); - g_free (base_uri); if (save_list) e_source_list_sync (priv->source_list, NULL); |