[gnome-contacts/wip/nielsdg/setup-add-accounts: 16/16] WIP: allow to add online accounts when setting up.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts/wip/nielsdg/setup-add-accounts: 16/16] WIP: allow to add online accounts when setting up.
- Date: Wed, 3 Jan 2018 19:42:07 +0000 (UTC)
commit 23e4648ad1c21f1927157459366a6e7267164cd4
Author: Niels De Graef <nielsdegraef gmail com>
Date: Thu Dec 28 15:42:58 2017 +0100
WIP: allow to add online accounts when setting up.
meson.build | 3 +++
src/contacts-esd-setup.c | 1 -
src/contacts-setup-window.vala | 15 +++++++++++++++
src/meson.build | 1 +
vapi/goa-backend-1.0.deps | 1 +
vapi/goa-backend-1.0.vapi | 36 ++++++++++++++++++++++++++++++++++++
6 files changed, 56 insertions(+), 1 deletions(-)
---
diff --git a/meson.build b/meson.build
index 9238512..710e082 100644
--- a/meson.build
+++ b/meson.build
@@ -38,6 +38,7 @@ glib = dependency('glib-2.0', version: '>=' + min_glib_version)
gmodule_export = dependency('gmodule-export-2.0', version: '>=' + min_glib_version)
gnome_desktop = dependency('gnome-desktop-3.0')
goa = dependency('goa-1.0')
+goa_backend = dependency('goa-backend-1.0')
gtk = dependency('gtk+-3.0', version: '>= 3.22.0')
libebook = dependency('libebook-1.2', version: '>=' + min_eds_version)
libedataserver = dependency('libedataserver-1.2', version: '>=' + min_eds_version)
@@ -81,6 +82,8 @@ conf.set_quoted('PACKAGE_VERSION', meson.project_version())
conf.set_quoted('PKGDATADIR', pkgdatadir)
conf.set_quoted('PKGLIBDIR', pkglibdir)
conf.set_quoted('VERSION', meson.project_version())
+conf.set('GOA_API_IS_SUBJECT_TO_CHANGE', true)
+conf.set('GOA_BACKEND_API_IS_SUBJECT_TO_CHANGE', true)
configure_file(output: 'config.h', configuration: conf)
# Post-install scripts
diff --git a/src/contacts-esd-setup.c b/src/contacts-esd-setup.c
index 936be16..7a7f872 100644
--- a/src/contacts-esd-setup.c
+++ b/src/contacts-esd-setup.c
@@ -21,7 +21,6 @@
#include <libedataserverui/libedataserverui.h>
#include <glib/gi18n-lib.h>
-#define GOA_API_IS_SUBJECT_TO_CHANGE
#include <goa/goa.h>
#include <gtk/gtk.h>
diff --git a/src/contacts-setup-window.vala b/src/contacts-setup-window.vala
index 4b13a85..dd5ed13 100644
--- a/src/contacts-setup-window.vala
+++ b/src/contacts-setup-window.vala
@@ -55,6 +55,21 @@ public class Contacts.SetupWindow : Gtk.ApplicationWindow {
fill_accounts_list (store);
+ // TODO make this a clickbable listbox
+ // TODO if accountslist is empty: don't show accountslist
+ GLib.List<Goa.Provider>? providers = null;
+ Goa.Provider.get_all ( (obj, res) => {
+ try {
+ Goa.Provider.get_all_finish (out providers, res);
+ } catch (Error e) {
+ warning ("Couldn't get list of providers!");
+ }
+
+ foreach (var provider in providers)
+ if (Goa.ProviderFeatures.CONTACTS in provider.get_provider_features ())
+ warning ("Found contacts provider \"%s\"", provider.get_provider_name ());
+ });
+
this.setup_done_button.clicked.connect (() => {
var selected_store = this.setup_accounts_list.selected_store as Edsf.PersonaStore;
setup_done (selected_store);
diff --git a/src/meson.build b/src/meson.build
index 2a387c3..76a70c4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -54,6 +54,7 @@ contacts_deps = [
glib,
gnome_desktop,
goa,
+ goa_backend,
gtk,
libebook,
libedataserver,
diff --git a/vapi/goa-backend-1.0.deps b/vapi/goa-backend-1.0.deps
new file mode 100644
index 0000000..fb7e14c
--- /dev/null
+++ b/vapi/goa-backend-1.0.deps
@@ -0,0 +1 @@
+goa-1.0
diff --git a/vapi/goa-backend-1.0.vapi b/vapi/goa-backend-1.0.vapi
new file mode 100644
index 0000000..af53759
--- /dev/null
+++ b/vapi/goa-backend-1.0.vapi
@@ -0,0 +1,36 @@
+[CCode (cheader_filename = "goabackend/goabackend.h")]
+namespace Goa {
+ public class Provider : GLib.Object {
+ // FIXME: we would ofc like this to be an async method, but it seems that _finish is not helping us
+ // by not having AsyncResult as its first argument
+ public static void get_all (GLib.AsyncReadyCallback cb);
+ public static bool get_all_finish (out GLib.List<Provider> providers, GLib.AsyncResult res) throws
GLib.Error;
+
+ public string get_provider_name (Goa.Object? object = null);
+ public GLib.Icon get_provider_icon (Goa.Object? object = null);
+ public unowned string get_provider_type ();
+ public ProviderFeatures get_provider_features ();
+
+ public void add_account (Goa.Client client, Gtk.Dialog dialog, Gtk.Box vbox) throws GLib.Error;
+ }
+
+ [Flags]
+ [CCode (cprefix = "GOA_PROVIDER_FEATURE_")]
+ public enum ProviderFeatures {
+ BRANDED,
+ MAIL,
+ CALENDAR,
+ CONTACTS,
+ CHAT,
+ DOCUMENTS,
+ PHOTOS,
+ FILES,
+ TICKETING,
+ READ_LATER,
+ PRINTERS,
+ MAPS,
+ MUSIC,
+ TODO,
+ INVALID;
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]