[gnome-calendar] application: load a GoaClient on init
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] application: load a GoaClient on init
- Date: Mon, 25 May 2015 16:59:48 +0000 (UTC)
commit 71d93bd914431dd4a87afc222be157c05938db63
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Apr 30 16:51:37 2015 -0300
application: load a GoaClient on init
It is done here to make it reusable for
the future initial setup dialog too.
src/gcal-application.c | 31 +++++++++++++++++++++++++++++++
src/gcal-application.h | 2 ++
2 files changed, 33 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 2785c22..01e066b 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -30,6 +30,7 @@
#include <glib-object.h>
#include <gio/gio.h>
#include <glib/gi18n.h>
+#include <goa/goa.h>
#define CSS_FILE "resource:///org/gnome/calendar/gtk-styles.css"
@@ -37,6 +38,8 @@ struct _GcalApplicationPrivate
{
GtkWidget *window;
+ GoaClient *client;
+
GSettings *settings;
GcalManager *manager;
@@ -89,6 +92,10 @@ static void gcal_application_dbus_unregister (GApplication *
GDBusConnection *connection,
const gchar *object_path);
+static void gcal_application_goa_client_ready (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data);
+
G_DEFINE_TYPE_WITH_PRIVATE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
static gboolean show_version = FALSE;
@@ -212,10 +219,34 @@ gcal_application_init (GcalApplication *self)
priv->search_provider = gcal_shell_search_provider_new ();
gcal_shell_search_provider_connect (priv->search_provider, priv->manager);
+ goa_client_new (NULL, // we won't really cancel it
+ (GAsyncReadyCallback) gcal_application_goa_client_ready,
+ self);
+
self->priv = priv;
}
static void
+gcal_application_goa_client_ready (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ GcalApplicationPrivate *priv = GCAL_APPLICATION (user_data)->priv;
+ GError *error = NULL;
+
+ priv->client = goa_client_new_finish (result, &error);
+
+ if (error != NULL)
+ {
+ g_warning ("%s: Error retrieving GoaClient: %s",
+ G_STRFUNC,
+ error->message);
+
+ g_error_free (error);
+ }
+}
+
+static void
gcal_application_finalize (GObject *object)
{
GcalApplicationPrivate *priv = GCAL_APPLICATION (object)->priv;
diff --git a/src/gcal-application.h b/src/gcal-application.h
index 9e55d9c..116a59b 100644
--- a/src/gcal-application.h
+++ b/src/gcal-application.h
@@ -23,6 +23,7 @@
#include "gcal-manager.h"
#include <gtk/gtk.h>
+#include <goa/goa.h>
G_BEGIN_DECLS
@@ -58,6 +59,7 @@ void gcal_application_set_uuid (GcalApplication *application,
const gchar *uuid);
void gcal_application_set_initial_date (GcalApplication *application,
const icaltimetype *date);
+GoaClient* gcal_application_get_client (GcalApplication *application);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]