[gnome-online-accounts] telepathy: add a stub for the Telepathy provider



commit 73f6f0625b7842c58a2cca23d6107e0ad036c162
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Fri Jun 28 18:21:04 2013 +0100

    telepathy: add a stub for the Telepathy provider
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696267

 configure.ac                          |   11 ++
 src/goabackend/Makefile.am            |    1 +
 src/goabackend/goatelepathyprovider.c |  192 +++++++++++++++++++++++++++++++++
 src/goabackend/goatelepathyprovider.h |   48 ++++++++
 4 files changed, 252 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 1580961..48b6f1d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -290,6 +290,16 @@ if test "$enable_windows_live" != "no"; then
   AC_DEFINE(GOA_WINDOWS_LIVE_ENABLED, 1, [Enable Windows Live data provider])
 fi
 
+# Telepathy
+AC_ARG_ENABLE([telepathy],
+              [AS_HELP_STRING([--enable-telepathy],
+              [Enable Telepathy IM provider])],
+              [],
+              [enable_telepathy=yes])
+if test "$enable_exchange" != "no"; then
+  AC_DEFINE(GOA_TELEPATHY_ENABLED, 1, [Enable Telepathy data provider])
+fi
+
 # Kerberos
 AC_ARG_ENABLE([kerberos],
               [AS_HELP_STRING([--enable-kerberos],
@@ -477,6 +487,7 @@ echo "
        Yahoo provider:                 ${enable_yahoo} (OAuth 1.0, key:${with_yahoo_consumer_key} 
secret:${with_yahoo_consumer_secret})
        Facebook provider:              ${enable_facebook} (OAuth 2.0, id:${with_facebook_client_id})
        Windows Live provider:          ${enable_windows_live} (OAuth 2.0, id:${with_windows_live_client_id})
+        Telepathy provider:             ${enable_telepathy}
 
        Maintainer mode:                ${USE_MAINTAINER_MODE}
        Building api docs:              ${enable_gtk_doc}
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index 5cdf301..8368bf7 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -78,6 +78,7 @@ libgoa_backend_1_0_la_SOURCES =                                               \
        goatwitterprovider.h            goatwitterprovider.c            \
        goaflickrprovider.h             goaflickrprovider.c             \
        goawindowsliveprovider.h        goawindowsliveprovider.c        \
+       goatelepathyprovider.h          goatelepathyprovider.c          \
        goautils.h                      goautils.c                      \
        goaspinnerbutton.h              goaspinnerbutton.c              \
        goawebview.h                    goawebview.c                    \
diff --git a/src/goabackend/goatelepathyprovider.c b/src/goabackend/goatelepathyprovider.c
new file mode 100644
index 0000000..09ee533
--- /dev/null
+++ b/src/goabackend/goatelepathyprovider.c
@@ -0,0 +1,192 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2012, 2013 Red Hat, Inc.
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Marco Barisione <marco barisione collabora co uk>
+ */
+
+#include "config.h"
+#include <glib/gi18n-lib.h>
+
+#include "goaprovider.h"
+#include "goaprovider-priv.h"
+#include "goatelepathyprovider.h"
+
+
+/**
+ * GoaTelepathyProvider:
+ *
+ * The #GoaTelepathyProvider structure contains only private data and should
+ * only be accessed using the provided API.
+ */
+struct _GoaTelepathyProvider
+{
+  /*< private >*/
+  GoaProvider parent_instance;
+};
+
+typedef struct _GoaTelepathyProviderClass GoaTelepathyProviderClass;
+
+struct _GoaTelepathyProviderClass
+{
+  GoaProviderClass parent_class;
+};
+
+/**
+ * SECTION:goatelepathyprovider
+ * @title: GoaTelepathyProvider
+ * @short_description: A provider for Telepathy
+ *
+ * #GoaTelepathyProvider is used for handling Telepathy IM accounts.
+ */
+
+G_DEFINE_TYPE (GoaTelepathyProvider, goa_telepathy_provider, GOA_TYPE_PROVIDER);
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static const gchar *
+get_provider_type (GoaProvider *provider)
+{
+  return GOA_TELEPATHY_PROVIDER_BASE_TYPE;
+}
+
+static gchar *
+get_provider_name (GoaProvider *provider,
+                   GoaObject   *object)
+{
+  return g_strdup (_("Other chat account"));
+
+}
+
+static GoaProviderGroup
+get_provider_group (GoaProvider *provider)
+{
+  return GOA_PROVIDER_GROUP_CHAT;
+}
+
+static GoaProviderFeatures
+get_provider_features (GoaProvider *provider)
+{
+  return GOA_PROVIDER_FEATURE_CHAT;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static GoaObject *
+add_account (GoaProvider  *provider,
+             GoaClient    *client,
+             GtkDialog    *dialog,
+             GtkBox       *vbox,
+             GError      **error)
+{
+  return NULL;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+refresh_account (GoaProvider  *provider,
+                 GoaClient    *client,
+                 GoaObject    *object,
+                 GtkWindow    *parent,
+                 GError      **error)
+{
+  return FALSE;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static gboolean
+build_object (GoaProvider        *provider,
+              GoaObjectSkeleton  *object,
+              GKeyFile           *key_file,
+              const gchar        *group,
+              GDBusConnection    *connection,
+              gboolean            just_added,
+              GError            **error)
+{
+  gboolean ret;
+
+  ret = FALSE;
+
+  /* Chain up */
+  if (!GOA_PROVIDER_CLASS (goa_telepathy_provider_parent_class)->build_object (provider,
+                                                                               object,
+                                                                               key_file,
+                                                                               group,
+                                                                               connection,
+                                                                               just_added,
+                                                                               error))
+    goto out;
+
+  /* ret = TRUE; */
+
+out:
+  return ret;
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+show_account (GoaProvider         *provider,
+              GoaClient           *client,
+              GoaObject           *object,
+              GtkBox              *vbox,
+              GtkGrid             *left,
+              GtkGrid             *right)
+{
+  /* Chain up */
+  GOA_PROVIDER_CLASS (goa_telepathy_provider_parent_class)->show_account (provider,
+                                                                          client,
+                                                                          object,
+                                                                          vbox,
+                                                                          left,
+                                                                          right);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+goa_telepathy_provider_init (GoaTelepathyProvider *provider)
+{
+}
+
+static void
+goa_telepathy_provider_finalize (GObject *object)
+{
+  (G_OBJECT_CLASS (goa_telepathy_provider_parent_class)->finalize) (object);
+}
+
+static void
+goa_telepathy_provider_class_init (GoaTelepathyProviderClass *klass)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GoaProviderClass *provider_class = GOA_PROVIDER_CLASS (klass);
+
+  object_class->finalize = goa_telepathy_provider_finalize;
+
+  provider_class->get_provider_type     = get_provider_type;
+  provider_class->get_provider_name     = get_provider_name;
+  provider_class->get_provider_group    = get_provider_group;
+  provider_class->get_provider_features = get_provider_features;
+  provider_class->add_account           = add_account;
+  provider_class->refresh_account       = refresh_account;
+  provider_class->build_object          = build_object;
+  provider_class->show_account          = show_account;
+}
diff --git a/src/goabackend/goatelepathyprovider.h b/src/goabackend/goatelepathyprovider.h
new file mode 100644
index 0000000..8c92bba
--- /dev/null
+++ b/src/goabackend/goatelepathyprovider.h
@@ -0,0 +1,48 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/*
+ * Copyright (C) 2012, 2013 Red Hat, Inc.
+ * Copyright (C) 2013 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: Marco Barisione <marco barisione collabora co uk>
+ */
+
+#if !defined (__GOA_BACKEND_INSIDE_GOA_BACKEND_H__) && !defined (GOA_BACKEND_COMPILATION)
+#error "Only <goabackend/goabackend.h> can be included directly."
+#endif
+
+#ifndef __GOA_TELEPATHY_PROVIDER_H__
+#define __GOA_TELEPATHY_PROVIDER_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/* All instances of this provider are in the form "telepathy/SERVICE-NAME". */
+#define GOA_TELEPATHY_PROVIDER_BASE_TYPE "telepathy"
+
+#define GOA_TYPE_TELEPATHY_PROVIDER   (goa_telepathy_provider_get_type ())
+#define GOA_TELEPATHY_PROVIDER(o)     (G_TYPE_CHECK_INSTANCE_CAST ((o), GOA_TYPE_TELEPATHY_PROVIDER, 
GoaTelepathyProvider))
+#define GOA_IS_TELEPATHY_PROVIDER(o)  (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOA_TYPE_TELEPATHY_PROVIDER))
+
+typedef struct _GoaTelepathyProvider GoaTelepathyProvider;
+
+GType                    goa_telepathy_provider_get_type                (void) G_GNUC_CONST;
+
+G_END_DECLS
+
+#endif /* __GOA_TELEPATHY_PROVIDER_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]