aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-07-15 00:41:54 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-07-15 01:38:12 +0800
commit6d9e836a6fa0bb501f9fad4306373092bd758d29 (patch)
tree7843b42c00bc45175bbe8e80059cf2643aa1ee89 /calendar/gui
parent374bd42f69aca2e132fd854c9619f3d7491f1f96 (diff)
parente5fe0c9a3b74bf4910d768d65bb59a53c3792001 (diff)
downloadgsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar.gz
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar.bz2
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar.lz
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar.xz
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.tar.zst
gsoc2013-evolution-6d9e836a6fa0bb501f9fad4306373092bd758d29.zip
Merge branch 'master' into kill-bonobo
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/calendar-component.c154
-rw-r--r--calendar/gui/dialogs/comp-editor.c2
2 files changed, 155 insertions, 1 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 02bf9a0072..b207c028a6 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -126,6 +126,160 @@ calcomp_vpane_resized (GtkWidget *vpane, GdkEventButton *e, CalendarComponentVie
return FALSE;
}
+<<<<<<< HEAD:calendar/gui/calendar-component.c
+=======
+static void
+ensure_sources (CalendarComponent *component)
+{
+ ESourceList *source_list;
+ ESourceGroup *on_this_computer;
+ ESourceGroup *contacts;
+ ESource *personal_source;
+ ESource *birthdays_source;
+ gchar *base_uri, *base_uri_proto, base_uri_proto_seventh;
+ const gchar *base_dir;
+ gchar *create_source;
+
+ personal_source = NULL;
+ birthdays_source = NULL;
+
+ if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) {
+ g_warning ("Could not get calendar source list from GConf!");
+ return;
+ }
+
+ base_dir = calendar_component_peek_base_directory (component);
+ base_uri = g_build_filename (base_dir, "local", NULL);
+
+ base_uri_proto = g_filename_to_uri (base_uri, NULL, NULL);
+ if (strlen (base_uri_proto) > 7) {
+ /* compare only file:// part. If user home dir name changes we do not want to create
+ one more group */
+ base_uri_proto_seventh = base_uri_proto[7];
+ base_uri_proto[7] = 0;
+ } else {
+ base_uri_proto_seventh = -1;
+ }
+
+ on_this_computer = e_source_list_ensure_group (source_list, _("On This Computer"), base_uri_proto, TRUE);
+ contacts = e_source_list_ensure_group (source_list, _("Contacts"), CONTACTS_BASE_URI, TRUE);
+ e_source_list_ensure_group (source_list, _("On The Web"), WEB_BASE_URI, FALSE);
+ e_source_list_ensure_group (source_list, _("Weather"), WEATHER_BASE_URI, FALSE);
+
+ if (base_uri_proto_seventh != -1) {
+ base_uri_proto[7] = base_uri_proto_seventh;
+ }
+
+ if (on_this_computer) {
+ /* make sure "Personal" shows up as a source under
+ this group */
+ GSList *sources = e_source_group_peek_sources (on_this_computer);
+ GSList *s;
+ for (s = sources; s; s = s->next) {
+ ESource *source = E_SOURCE (s->data);
+ const gchar *relative_uri;
+
+ relative_uri = e_source_peek_relative_uri (source);
+ if (relative_uri == NULL)
+ continue;
+ if (!strcmp (PERSONAL_RELATIVE_URI, relative_uri)) {
+ personal_source = source;
+ break;
+ }
+ }
+ /* Make sure we have the correct base uri. This can change when user's
+ homedir name changes */
+ if (strcmp (base_uri_proto, e_source_group_peek_base_uri (on_this_computer))) {
+ e_source_group_set_base_uri (on_this_computer, base_uri_proto);
+
+ /* *sigh* . We shouldn't need this sync call here as set_base_uri
+ call results in synching to gconf, but that happens in idle loop
+ and too late to prevent user seeing "Can not Open ... because of invalid uri" error.*/
+ e_source_list_sync (source_list,NULL);
+ }
+ }
+
+ if (personal_source) {
+ /* ensure the source name is in current locale, not read from configuration */
+ e_source_set_name (personal_source, _("Personal"));
+ } else {
+ gchar *primary_calendar = calendar_config_get_primary_calendar();
+ GSList *calendars_selected;
+
+ /* Create the default Person addressbook */
+ personal_source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI);
+ e_source_group_add_source (on_this_computer, personal_source, -1);
+ g_object_unref (personal_source);
+
+ calendars_selected = calendar_config_get_calendars_selected ();
+ if (!primary_calendar && !calendars_selected) {
+ GSList selected;
+
+ calendar_config_set_primary_calendar (e_source_peek_uid (personal_source));
+
+ selected.data = (gpointer)e_source_peek_uid (personal_source);
+ selected.next = NULL;
+ calendar_config_set_calendars_selected (&selected);
+ }
+
+ if (calendars_selected) {
+ g_slist_foreach (calendars_selected, (GFunc) g_free, NULL);
+ g_slist_free (calendars_selected);
+ }
+
+ g_free (primary_calendar);
+ e_source_set_color_spec (personal_source, "#BECEDD");
+ }
+
+ if (contacts) {
+ GSList *sources = e_source_group_peek_sources (contacts);
+ if (sources) {
+ birthdays_source = E_SOURCE (sources->data); /* There is only one source under Contacts Group*/
+
+ if (sources->next) {
+ /* Ensure we have only one contacts source - we was able to create more than one before */
+ GSList *l = NULL, *p;
+
+ for (p = sources->next; p; p = p->next)
+ l = g_slist_prepend (l, p->data);
+
+ for (p = l; p; p = p->next)
+ e_source_group_remove_source (contacts, p->data);
+
+ g_slist_free (l);
+ }
+ }
+ }
+
+ create_source = e_source_group_get_property (contacts, "create_source");
+ if (!create_source)
+ e_source_group_set_property (contacts, "create_source", "no");
+ g_free (create_source);
+
+ if (birthdays_source) {
+ /* ensure the source name is in current locale, not read from configuration */
+ e_source_set_name (birthdays_source, _("Birthdays & Anniversaries"));
+ } else {
+ birthdays_source = e_source_new (_("Birthdays & Anniversaries"), "/");
+ e_source_group_add_source (contacts, birthdays_source, -1);
+ g_object_unref (birthdays_source);
+ }
+
+ if (!e_source_get_property (birthdays_source, "delete"))
+ e_source_set_property(birthdays_source, "delete", "no");
+
+ if (e_source_peek_color_spec (birthdays_source) == NULL)
+ e_source_set_color_spec (birthdays_source, "#DDBECE");
+
+ component->priv->source_list = source_list;
+
+ g_object_unref (on_this_computer);
+ g_object_unref (contacts);
+ g_free (base_uri_proto);
+ g_free (base_uri);
+}
+
+>>>>>>> master:calendar/gui/calendar-component.c
/* Utility functions. */
static gboolean
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index 3ed798a6f0..7aa242f18e 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -2034,6 +2034,7 @@ comp_editor_set_flags (CompEditor *editor,
g_return_if_fail (IS_COMP_EDITOR (editor));
editor->priv->flags = flags;
+ editor->priv->user_org = flags & COMP_EDITOR_USER_ORG;
g_object_notify (G_OBJECT (editor), "flags");
}
@@ -2494,7 +2495,6 @@ real_edit_comp (CompEditor *editor, ECalComponent *comp)
priv->comp = e_cal_component_clone (comp);
priv->existing_org = e_cal_component_has_organizer (comp);
- priv->user_org = (itip_organizer_is_user (comp, priv->client) || itip_sentby_is_user (comp, priv->client));
priv->warned = FALSE;
update_window_border (editor, NULL);