[evolution-data-server] Gut EOfflineListener.



commit 6de5b0fe9ac320e90e108dca757087022686bf61
Author: Matthew Barnes <mbarnes redhat com>
Date:   Thu Apr 12 08:15:25 2012 -0400

    Gut EOfflineListener.
    
    EOfflineListener no longer uses GConf, and e_offline_listen_get_state()
    now returns EOL_STATE_ONLINE always.  No one should be using this class
    by now anyway.

 libebackend/e-offline-listener.c |  135 ++++++--------------------------------
 1 files changed, 21 insertions(+), 114 deletions(-)
---
diff --git a/libebackend/e-offline-listener.c b/libebackend/e-offline-listener.c
index f920893..e9469d7 100644
--- a/libebackend/e-offline-listener.c
+++ b/libebackend/e-offline-listener.c
@@ -37,11 +37,6 @@
 #endif
 
 #include "e-offline-listener.h"
-#include <gconf/gconf-client.h>
-
-#define E_OFFLINE_LISTENER_GET_PRIVATE(obj) \
-	(G_TYPE_INSTANCE_GET_PRIVATE \
-	((obj), E_TYPE_OFFLINE_LISTENER, EOfflineListenerPrivate))
 
 G_DEFINE_TYPE (EOfflineListener, e_offline_listener, G_TYPE_OBJECT)
 
@@ -52,68 +47,32 @@ enum {
 
 static guint signals[NUM_SIGNALS] = { 0 };
 
-struct _EOfflineListenerPrivate {
-	GConfClient *default_client;
-	gboolean is_offline_now;
-};
-
 static void
-set_online_status (EOfflineListener *eol,
-                   gboolean is_offline)
-{
-	g_signal_emit (eol, signals[CHANGED], 0);
-}
-
-static void
-online_status_changed (GConfClient *client,
-                       gint cnxn_id,
-                       GConfEntry *entry,
-                       gpointer data)
+e_offline_listener_class_init (EOfflineListenerClass *class)
 {
-	GConfValue *value;
-	gboolean offline;
-	EOfflineListener *eol;
-	EOfflineListenerPrivate *priv;
-
-	eol = E_OFFLINE_LISTENER (data);
-	g_return_if_fail (eol != NULL);
-
-	priv = eol->priv;
-	offline = FALSE;
-	value = gconf_entry_get_value (entry);
-	if (value)
-		offline = gconf_value_get_bool (value);
+	GObjectClass *object_class;
 
-	if (priv->is_offline_now != offline) {
-		priv->is_offline_now = offline;
+	object_class = G_OBJECT_CLASS (class);
 
-		set_online_status (eol, offline);
-	}
+	/**
+	 * EOfflineListener::changed:
+	 * @listener: the #EOfflineListener that received the signal
+	 *
+	 * Emitted when Evolution's online/offline state changes.
+	 **/
+	signals[CHANGED] = g_signal_new (
+		"changed",
+		G_OBJECT_CLASS_TYPE (object_class),
+		G_SIGNAL_RUN_LAST,
+		G_STRUCT_OFFSET (EOfflineListenerClass, changed),
+		NULL, NULL,
+		g_cclosure_marshal_VOID__VOID,
+		G_TYPE_NONE, 0);
 }
 
 static void
-setup_offline_listener (EOfflineListener *eol)
+e_offline_listener_init (EOfflineListener *eol)
 {
-	EOfflineListenerPrivate *priv = eol->priv;
-
-	priv->default_client = gconf_client_get_default ();
-
-	gconf_client_add_dir (
-		priv->default_client,
-		"/apps/evolution/shell",
-		GCONF_CLIENT_PRELOAD_RECURSIVE, NULL);
-
-	gconf_client_notify_add (
-		priv->default_client,
-		"/apps/evolution/shell/start_offline",
-		(GConfClientNotifyFunc) online_status_changed,
-		eol, NULL, NULL);
-
-	priv->is_offline_now = gconf_client_get_bool (
-		priv->default_client,
-		"/apps/evolution/shell/start_offline", NULL);
-
-	set_online_status (eol, priv->is_offline_now);
 }
 
 /**
@@ -128,66 +87,14 @@ setup_offline_listener (EOfflineListener *eol)
 EOfflineListener *
 e_offline_listener_new (void)
 {
-	EOfflineListener *eol = g_object_new (E_TYPE_OFFLINE_LISTENER, NULL);
-
-	setup_offline_listener (eol);
-
-	return eol;
-}
-
-static void
-offline_listener_dispose (GObject *object)
-{
-	EOfflineListenerPrivate *priv;
-
-	priv = E_OFFLINE_LISTENER_GET_PRIVATE (object);
-
-	if (priv->default_client) {
-		g_object_unref (priv->default_client);
-		priv->default_client = NULL;
-	}
-
-	/* Chain up to parent's dispose() method. */
-	G_OBJECT_CLASS (e_offline_listener_parent_class)->dispose (object);
-}
-
-static void
-e_offline_listener_init (EOfflineListener *eol)
-{
-	eol->priv = E_OFFLINE_LISTENER_GET_PRIVATE (eol);
-}
-
-static void
-e_offline_listener_class_init (EOfflineListenerClass *class)
-{
-	GObjectClass *object_class;
-
-	g_type_class_add_private (class, sizeof (EOfflineListenerPrivate));
-
-	object_class = G_OBJECT_CLASS (class);
-	object_class->dispose = offline_listener_dispose;
-
-	/**
-	 * EOfflineListener::changed:
-	 * @listener: the #EOfflineListener that received the signal
-	 *
-	 * Emitted when Evolution's online/offline state changes.
-	 **/
-	signals[CHANGED] = g_signal_new (
-		"changed",
-		G_OBJECT_CLASS_TYPE (object_class),
-		G_SIGNAL_RUN_LAST,
-		G_STRUCT_OFFSET (EOfflineListenerClass, changed),
-		NULL, NULL,
-		g_cclosure_marshal_VOID__VOID,
-		G_TYPE_NONE, 0);
+	return g_object_new (E_TYPE_OFFLINE_LISTENER, NULL);
 }
 
 /**
  * e_offline_listener_get_state:
  * @eol: an #EOfflineListener
  *
- * FIXME Document me!
+ * This function now simply returns #EOL_STATE_ONLINE always.
  *
  * Returns: #EOL_STATE_OFFLINE or #EOL_STATE_ONLINE
  *
@@ -198,5 +105,5 @@ e_offline_listener_get_state (EOfflineListener *eol)
 {
 	g_return_val_if_fail (E_IS_OFFLINE_LISTENER (eol), EOL_STATE_OFFLINE);
 
-	return eol->priv->is_offline_now ? EOL_STATE_OFFLINE : EOL_STATE_ONLINE;
+	return EOL_STATE_ONLINE;
 }



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