Added yandex provider (prebuild version) - mail, calendar added

i9
Alexey Berezhok 2 years ago
parent 4bcf52df93
commit 661cc5c0cf

@ -1,4 +1,4 @@
From 85427ac5d891661af27839383a3c26af7353b5cb Mon Sep 17 00:00:00 2001
From 955dfc25d92798b9c088ae92133533afa9590cdb Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <alexey.berezhok@softline.com>
Date: Tue, 2 May 2023 15:51:50 +0300
Subject: [PATCH] Added yandex provider (prebuild version)
@ -15,9 +15,9 @@ Subject: [PATCH] Added yandex provider (prebuild version)
src/goabackend/Makefile.am | 1 +
src/goabackend/Makefile.in | 14 +
src/goabackend/goaprovider.c | 4 +
src/goabackend/goayandexprovider.c | 339 ++++++++++++++++++
src/goabackend/goayandexprovider.c | 369 ++++++++++++++++++
src/goabackend/goayandexprovider.h | 37 ++
13 files changed, 529 insertions(+)
13 files changed, 559 insertions(+)
create mode 100644 data/icons/scalable/goa-account-yandex.svg
create mode 100644 data/icons/symbolic/goa-account-yandex-symbolic.svg
create mode 100644 src/goabackend/goayandexprovider.c
@ -352,10 +352,10 @@ index 9e5bd45..c4858b7 100644
#endif
diff --git a/src/goabackend/goayandexprovider.c b/src/goabackend/goayandexprovider.c
new file mode 100644
index 0000000..d25c0de
index 0000000..c64973d
--- /dev/null
+++ b/src/goabackend/goayandexprovider.c
@@ -0,0 +1,339 @@
@@ -0,0 +1,369 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright © 2011 2017 Red Hat, Inc.
@ -425,6 +425,8 @@ index 0000000..d25c0de
+{
+ return GOA_PROVIDER_FEATURE_BRANDED |
+ GOA_PROVIDER_FEATURE_MAIL |
+ GOA_PROVIDER_FEATURE_CALENDAR |
+ GOA_PROVIDER_FEATURE_CONTACTS |
+ GOA_PROVIDER_FEATURE_FILES;
+}
+
@ -455,7 +457,7 @@ index 0000000..d25c0de
+static guint
+get_credentials_generation (GoaProvider *provider)
+{
+ return 19;
+ return 22;
+}
+
+static const gchar *
@ -573,9 +575,13 @@ index 0000000..d25c0de
+ GoaAccount *account = NULL;
+ GoaMail *mail = NULL;
+ gchar *uri_drive;
+ gchar *uri_caldav;
+ gchar *uri_carddav;
+ gboolean ret = FALSE;
+ gboolean mail_enabled;
+ gboolean files_enabled;
+ gboolean calendar_enabled;
+ gboolean contacts_enabled;
+ const gchar *email_address;
+
+ /* Chain up */
@ -622,6 +628,18 @@ index 0000000..d25c0de
+ goa_object_skeleton_set_mail (object, NULL);
+ }
+
+ /* Calendar */
+ calendar_enabled = g_key_file_get_boolean (key_file, group, "CalendarEnabled", NULL);
+ uri_caldav = g_strconcat ("https://caldav.yandex.ru/", NULL);
+ goa_object_skeleton_attach_calendar (object, uri_caldav, calendar_enabled, FALSE);
+ g_free (uri_caldav);
+
+ /* Contacts */
+ contacts_enabled = g_key_file_get_boolean (key_file, group, "ContactsEnabled", NULL);
+ uri_carddav = g_strconcat ("https://carddav.yandex.ru/", NULL);
+ goa_object_skeleton_attach_contacts (object, uri_carddav, contacts_enabled, FALSE);
+ g_free (uri_carddav);
+
+ /* Files */
+ files_enabled = g_key_file_get_boolean (key_file, group, "FilesEnabled", NULL);
+ uri_drive = g_strconcat ("https://cloud-api.yandex.net/v1/disk", NULL);
@ -632,6 +650,8 @@ index 0000000..d25c0de
+ if (just_added)
+ {
+ goa_account_set_mail_disabled (account, !mail_enabled);
+ goa_account_set_calendar_disabled (account, !calendar_enabled);
+ goa_account_set_contacts_disabled (account, !contacts_enabled);
+ goa_account_set_files_disabled (account, !files_enabled);
+
+ g_signal_connect (account,
@ -639,6 +659,14 @@ index 0000000..d25c0de
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "MailEnabled");
+ g_signal_connect (account,
+ "notify::calendar-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "CalendarEnabled");
+ g_signal_connect (account,
+ "notify::contacts-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "ContactsEnabled");
+ g_signal_connect (account,
+ "notify::files-disabled",
+ G_CALLBACK (goa_util_account_notify_property_cb),
+ (gpointer) "FilesEnabled");
@ -659,6 +687,8 @@ index 0000000..d25c0de
+ GVariantBuilder *builder)
+{
+ g_variant_builder_add (builder, "{ss}", "MailEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "CalendarEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "ContactsEnabled", "true");
+ g_variant_builder_add (builder, "{ss}", "FilesEnabled", "true");
+}
+

Loading…
Cancel
Save