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

Loading…
Cancel
Save