[gnome-pilot/dbus] Remove Monitor and EventNotify method calls



commit a59b5220838b007a01a8d77fd9a2bc4ac814fce9
Author: Halton Huo <halton huo sun com>
Date:   Tue Mar 16 15:15:24 2010 +0800

    Remove Monitor and EventNotify method calls
    
    I do not think this is needed with dbus.

 applet/pilot.c                   |    2 +
 capplet/gpilotd-control-applet.c |    4 +
 gpilotd/gnome-pilot-client.gob   |  136 -----------
 gpilotd/gpilot-daemon.c          |  498 +-------------------------------------
 gpilotd/gpilot-daemon.h          |   23 --
 gpilotd/gpilot-daemon.xml        |   46 ----
 utils/gpilotd-client.c           |    8 +
 7 files changed, 15 insertions(+), 702 deletions(-)
---
diff --git a/applet/pilot.c b/applet/pilot.c
index f26f217..191466d 100644
--- a/applet/pilot.c
+++ b/applet/pilot.c
@@ -1042,11 +1042,13 @@ timeout (PilotApplet *self)
 			pilot_draw (self);
 			/* FIXME: add gpilot_monitor_state_change () */
 		} else {
+                        /* TODO conntcted monitor and notifications on
 			gnome_pilot_client_monitor_on_all_pilots (self->gpc);
 			
 			gnome_pilot_client_notify_on (self->gpc,GNOME_Pilot_NOTIFY_CONNECT);
 			gnome_pilot_client_notify_on (self->gpc,GNOME_Pilot_NOTIFY_CONDUIT);
 			gnome_pilot_client_notify_on (self->gpc,GNOME_Pilot_NOTIFY_DISCONNECT);
+                        */
 			
 			gtk_tooltips_set_tip (self->tooltips, 
 					      GTK_WIDGET (self->applet),
diff --git a/capplet/gpilotd-control-applet.c b/capplet/gpilotd-control-applet.c
index 04556a7..50210d6 100644
--- a/capplet/gpilotd-control-applet.c
+++ b/capplet/gpilotd-control-applet.c
@@ -48,11 +48,15 @@ monitor_pilots (GnomePilotClient *gpc, PilotState * state)
 		while (tmp!= NULL){
 			GPilotPilot *pilot =(GPilotPilot*)tmp->data;
 			g_message ("pilot = %s",pilot->name);
+                        /*TODO turn on notify with dbus 
 			gnome_pilot_client_monitor_on (gpc,pilot->name);
+                        */
 			tmp = tmp->next;
 		}
+                /*TODO turn on notify with dbus 
 		gnome_pilot_client_notify_on (gpc, GNOME_Pilot_NOTIFY_CONNECT);
 		gnome_pilot_client_notify_on (gpc, GNOME_Pilot_NOTIFY_DISCONNECT);
+                */
 	}
 }
 
diff --git a/gpilotd/gnome-pilot-client.gob b/gpilotd/gnome-pilot-client.gob
index c576c37..927f2ad 100644
--- a/gpilotd/gnome-pilot-client.gob
+++ b/gpilotd/gnome-pilot-client.gob
@@ -461,142 +461,6 @@ class Gnome:Pilot:Client from Gtk:Object {
 		return self_connect_to_daemon (self);
         }
 
-	public gint monitor_on (self,
-			       const gchar *pilot_id (check null)) onerror GPILOTD_ERR_INVAL {
-		GError   *error;
-		gboolean  res;
-		gboolean  on;
-
-		g_return_val_if_fail (self->proxy != NULL, GPILOTD_ERR_NOT_CONNECTED);
-		error = NULL;
-		on = TRUE;
-		
-		res = dbus_g_proxy_call (self->proxy,
-					"Monitor",
-					&error,
-					G_TYPE_STRING, pilot_id,
-					G_TYPE_BOOLEAN, &on,
-					G_TYPE_INVALID,
-                                        G_TYPE_INVALID);
-
-		if (!res) {
-			g_warning ("Unable to turn off monitor for pilot %s: %s", pilot_id, error->message);   
-			g_error_free (error);
-			return GPILOTD_ERR_FAILED;
-		}
-
-		return GPILOTD_OK;
-	}	
-
-        public gint monitor_on_all_pilots (self) {
-		GList   *pilots = NULL,
-			*ptr;
-		gint ret = GPILOTD_OK;
-		
-		if (self_get_pilots (self,&pilots) != GPILOTD_OK) return GPILOTD_ERR_FAILED;
-		
-		for (ptr = pilots; ptr; ptr = ptr->next) {
-			ret = self_monitor_on (self,(gchar*)ptr->data);
-		}
-		g_list_foreach (pilots,(GFunc)g_free,NULL);
-		return ret;
-        }
-
-	public gint monitor_off (self,
-				const gchar *pilot_id (check null)) onerror GPILOTD_ERR_INVAL {
-		GError   *error;
-		gboolean  res;
-		gboolean  on;
-
-		g_return_val_if_fail (self->proxy != NULL, GPILOTD_ERR_NOT_CONNECTED);
-		error = NULL;
-		on = FALSE;
-		
-		res = dbus_g_proxy_call (self->proxy,
-					"Monitor",
-					&error,
-					G_TYPE_STRING, pilot_id,
-					G_TYPE_BOOLEAN, &on,
-					G_TYPE_INVALID,
-                                        G_TYPE_INVALID);
-
-		if (!res) {
-			g_warning ("Unable to turn off monitor for pilot %s: %s", pilot_id, error->message);   
-			g_error_free (error);
-			return GPILOTD_ERR_FAILED;
-		}
-
-		return GPILOTD_OK;
-	}	
-
-        public gint monitor_off_all_pilots (self) {
-		GList   *pilots = NULL,
-			*ptr;
-		gint ret = GPILOTD_OK;
-		
-		if (self_get_pilots (self,&pilots) != GPILOTD_OK) return GPILOTD_ERR_FAILED;
-		
-		for (ptr = pilots; ptr; ptr = ptr->next) {
-			ret = self_monitor_off (self,(gchar*)ptr->data);
-		}
-		g_list_foreach (pilots,(GFunc)g_free,NULL);
-		return ret;
-	}
-
-	public gint notify_on (self,
-			      GNOME_Pilot_EventType type) {
-		GError   *error;
-		gboolean  res;
-		gboolean  on;
-
-		g_return_val_if_fail (self->proxy != NULL, GPILOTD_ERR_NOT_CONNECTED);
-		error = NULL;
-		on = TRUE;
-		
-		res = dbus_g_proxy_call (self->proxy,
-					"EventNotify",
-					&error,
-					G_TYPE_INT, &type,
-					G_TYPE_BOOLEAN, &on,
-					G_TYPE_INVALID,
-                                        G_TYPE_INVALID);
-
-		if (!res) {
-			g_warning ("Unable to turn on notification for event %d: %s", type, error->message);   
-			g_error_free (error);
-			return GPILOTD_ERR_FAILED;
-		}
-
-		return GPILOTD_OK;
-	}	
-
-	public gint notify_off (self,
-			       GNOME_Pilot_EventType type) onerror GPILOTD_ERR_INVAL {
-		GError   *error;
-		gboolean  res;
-		gboolean  on;
-
-		g_return_val_if_fail (self->proxy != NULL, GPILOTD_ERR_NOT_CONNECTED);
-		error = NULL;
-		on = FALSE;
-		
-		res = dbus_g_proxy_call (self->proxy,
-					"EventNotify",
-					&error,
-					G_TYPE_INT, &type,
-					G_TYPE_BOOLEAN, &on,
-					G_TYPE_INVALID,
-                                        G_TYPE_INVALID);
-
-		if (!res) {
-			g_warning ("Unable to turn on notification for event %d: %s", type, error->message);   
-			g_error_free (error);
-			return GPILOTD_ERR_FAILED;
-		}
-
-		return GPILOTD_OK;
-	}	
-
 	public gint restore (self,
 			    const gchar *pilot_id (check null),
 			    const gchar *directory (check null),
diff --git a/gpilotd/gpilot-daemon.c b/gpilotd/gpilot-daemon.c
index 13daefd..1446081 100644
--- a/gpilotd/gpilot-daemon.c
+++ b/gpilotd/gpilot-daemon.c
@@ -103,12 +103,7 @@ G_DEFINE_TYPE (GpilotDaemon, gpilot_daemon, G_TYPE_OBJECT)
 
 struct GpilotDaemonPrivate
 {
-        GPilotContext *gpilotd_context;
-        /* maps from a pilot name GPilotd_Orb_Pilot_Notifications* */
-        GHashTable *notifications;
-        /* maps from a client_id to GSList** of pilotnames begin monitored */
-        GHashTable *monitors;
-
+        GPilotContext   *gpilotd_context;
         DBusGProxy      *bus_proxy;
         DBusGConnection *connection;
 };
@@ -133,27 +128,6 @@ enum {
 
 static guint signals [LAST_SIGNAL] = { 0, };
 
-/** structure that carries a GSList to gchar*  (IORs) for
-    each notification type */
-
-typedef struct {
-        GSList* connect;
-        GSList* disconnect;
-        GSList* request_complete;
-        GSList* request_timeout;
-        GSList* backup;
-        GSList* conduit;
-        GSList* userinfo_requested;
-        GSList* sysinfo_requested;
-        GSList* userinfo_sent;
-} PilotNotifications;
-
-typedef struct {
-  gpointer daemon;
-  gpointer client_id;
-  GNOME_Pilot_EventType event;
-} GPilotd_notify_on_helper_foreach_carrier;
-
 static void
 gpilot_daemon_pause_device (GPilotDevice *device,
                             gpointer      data)
@@ -1679,12 +1653,6 @@ gpilot_daemon_pause (GpilotDaemon   *daemon,
 
         priv->gpilotd_context->paused = on_off;
 
-        /* TODO
-        g_hash_table_foreach (priv->monitors,
-                              (GHFunc)gpilotd_corba_pause_notify_monitor,
-                              &on_off);
-        */
-
         if (priv->gpilotd_context->paused) {
                 g_list_foreach (priv->gpilotd_context->devices,
                                 (GFunc)gpilot_daemon_pause_device,
@@ -2356,412 +2324,6 @@ gpilot_daemon_set_user_info (GpilotDaemon   *daemon,
         return ret;
 }
 
-/* Notification operations */
-static gboolean
-monitor_on (GpilotDaemon   *daemon,
-            const char     *pilot_name,
-            GError         **error)
-{
-        GpilotDaemonPrivate *priv;
-        gchar               *client_id;
-        gboolean             ret;
-        GSList             **pilots;
-        GSList              *element;
-        
-        ret = FALSE;
-        priv = daemon->priv;
-
-        /* TODO
-        GET_AND_CHECK_CLIENT_ID(client_id,cb,0); 
-         */
-        LOG (("monitor_on(pilot_name=\"%s\",client_id = %.20s...)",
-              pilot_name, client_id));       
-                
-        if ((pilots = g_hash_table_lookup (priv->monitors, client_id)) == NULL) {
-                pilots = g_new0 (GSList*, 1);
-                *pilots = g_slist_prepend (*pilots, g_strdup (pilot_name));
-                g_hash_table_insert (priv->monitors, g_strdup (client_id), pilots);
-        } else {
-                element = g_slist_find_custom (*pilots, (gchar*)pilot_name,
-                                              (GCompareFunc)strcmp);
-                *pilots = g_slist_prepend (*pilots, g_strdup(pilot_name));
-        }
-        ret = TRUE;
- out:
-        g_free(client_id);
-        return ret;
-}
- 
-/* used by monitor_off_helper to remove callback IORs from a GSList* */
-static void 
-monitor_off_remover (GSList      **list,
-		     const gchar  *client_id) 
-{
-	GSList *element;
-
-	/* No, these will often be called with NULL pointers, so don't change these
-	   to g_return..., too much output */
-	if (list == NULL) return;
-	if (*list == NULL) return;
-	g_assert (client_id != NULL);
-
-	element = g_slist_find_custom (*list, (gpointer)client_id,
-                                       (GCompareFunc)strcmp);
-	if (element) {
-		g_free (element->data);
-		*list = g_slist_remove (*list, element->data); 
-	}
-
-	if (g_slist_length (*list) == 0) {
-		g_slist_free (*list);
-		*list = NULL;
-	} 
-}
-
-/* used by monitor_off to erase callback IORs from the 
-   PilotNotifications object for the given pilot_id */
-static void 
-monitor_off_helper_2 (GpilotDaemon *daemon,
-                      const gchar  *pilot,
-		      const gchar  *client_id) 
-{
-        GpilotDaemonPrivate *priv;
-	PilotNotifications  *notifications;
-
-        g_return_if_fail (GPILOT_IS_DAEMON (daemon));
-	g_return_if_fail (pilot != NULL);
-	g_return_if_fail (client_id != NULL);
-
-        priv = daemon->priv;
-
-	LOG (("removing monitor on %s for %.10s", pilot, client_id));
-	notifications = g_hash_table_lookup (priv->notifications, pilot);
-	if (notifications == NULL)
-                return;
-
-	monitor_off_remover (&notifications->connect, client_id);
-	monitor_off_remover (&notifications->disconnect, client_id);
-	monitor_off_remover (&notifications->backup, client_id);
-	monitor_off_remover (&notifications->conduit, client_id);
-	monitor_off_remover (&notifications->request_complete, client_id);
-	monitor_off_remover (&notifications->request_timeout, client_id);
-	monitor_off_remover (&notifications->userinfo_requested, client_id);
-	monitor_off_remover (&notifications->sysinfo_requested, client_id);
-	monitor_off_remover (&notifications->userinfo_sent, client_id);
-
-	if(notifications->connect == NULL &&
-	   notifications->disconnect == NULL &&
-	   notifications->backup == NULL &&
-	   notifications->conduit == NULL &&
-	   notifications->request_complete == NULL &&
-	   notifications->request_timeout == NULL &&
-	   notifications->userinfo_requested == NULL &&
-	   notifications->sysinfo_requested == NULL &&
-	   notifications->userinfo_sent == NULL) {
-		gpointer key,elem;
- 
-		key = NULL; elem = NULL;
-		g_hash_table_lookup_extended (priv->notifications, pilot, 
-                                              &key, &elem);
-		g_hash_table_remove (priv->notifications, key);
-		g_free (key);
-		g_free(elem);
-	}
-}
-
-#ifdef DEBUG_CODE
-static void
-debug_monitors (gchar    *key,
-                GSList  **value,
-                gpointer  data)
-{
-        GpilotDaemon        *daemon;
-        GpilotDaemonPrivate *priv;
-	GSList *e;
-	PilotNotifications *nots;
-
-        daemon = GPILOT_DAEMON (data);
-        priv = daemon->priv;
-
-	for (e = *value; e; e = g_slist_next (e)) {
-		g_print ("%s is monitoring %s", key, (char*)e->data);
-		nots = g_hash_table_lookup (priv->notifications, e->data);
-		if (nots == NULL)
-			g_print (" - no notifications");
-		else {
-			g_print (" - ");
-			if (nots->connect) g_print("connect,");
-			if (nots->disconnect) g_print("disconnect,");
-		}
-		g_print("\n");
-	}
-}
-#endif
-
-static void 
-monitor_off_helper (GpilotDaemon *daemon,
-                    const gchar  *pilot,
-		    const gchar  *client_id) 
-{
-        GpilotDaemonPrivate *priv;
-	GSList **pilots;
-
-        priv = daemon->priv;
-
-	if((pilots = g_hash_table_lookup (priv->monitors, client_id)) != NULL) {
-		GSList *element;
-		if((element = g_slist_find_custom(*pilots,
-						  (gpointer)pilot,
-						  (GCompareFunc)strcmp))!=NULL) {
-			/* random nuking in the notification lists */
-			monitor_off_helper_2 (daemon, pilot, client_id);
-
-			/* nuke pilot from list */
-			g_free (element->data);
-			*pilots = g_slist_remove (*pilots, element->data);
-			
-			/* if pilots is empty now, nuke fom priv->monitors */
-			if(g_slist_length (*pilots) == 0) {
-				gpointer key;
-				gpointer elem;
-				
-				key = NULL; elem = NULL;
-				g_hash_table_lookup_extended (priv->monitors,
-							      client_id,
-							      &key,
-							      &elem);
-				g_hash_table_remove (priv->monitors, (gchar *)key);
-				g_free ((gchar *)key);
-				g_slist_free (*(GSList **)elem);
-				g_free ((GSList **)elem); 
-			} 
-		} else {
-			GSList *e;
-			/* This really shouldn't happen, dump list for debug purposes */
-			LOG (("Could not find any link for %s",pilot));
-			for(e=*pilots; e; e = g_slist_next (e)) {
-				LOG(("pilots slist dump: %s",
-				    e->data==NULL?"(null)":(char*)e->data));
-			}			
-		}
-		
-	} else {
-		LOG (("couldn't find any monitor for %.10s",client_id));
-	}
-
-#ifdef DEBUG_CODE
-        g_print ("\n");
-        g_hash_table_foreach (priv->monitors,
-                             (GHFunc)debug_monitors, daemon);
-#endif
-}
-
-static gboolean
-monitor_off (GpilotDaemon   *daemon,
-             const char     *pilot_name,
-             GError         **error)
-{
-        GpilotDaemonPrivate *priv;
-        gchar               *client_id;
-        gboolean             ret;
-        
-        ret = FALSE;
-        priv = daemon->priv;
-
-        /* TODO
-        GET_AND_CHECK_CLIENT_ID(client_id,cb,0); 
-         */
-        LOG (("monitor_off(pilot_name=\"%.10s\",client_id = %.20s...)",
-              pilot_name, client_id));       
-                
-        monitor_off_helper (daemon, pilot_name, client_id);
-        ret = TRUE;
- out:
-        g_free(client_id);
-        return ret;
-}
-
-gboolean
-gpilot_daemon_monitor (GpilotDaemon   *daemon,
-                       const char     *pilot_name,
-                       gboolean        on,
-                       GError        **error)
-{
-        gboolean ret;
-        GpilotDaemonPrivate *priv;
-
-        ret = FALSE;
-        priv = daemon->priv;
-
-        if (pilot_id_from_name (pilot_name, priv->gpilotd_context) == 0) {
-                g_set_error (error,
-                             GPILOT_DAEMON_ERROR,
-                             GPILOT_DAEMON_ERROR_GENERAL,
-                             "Unknow pilot %s",
-                             pilot_name);
-                goto out;
-        }
-
-        if (on)
-                ret = monitor_on (daemon, pilot_name, error);
-        else
-                ret = monitor_off (daemon, pilot_name, error);
- out:
-        return ret;
-}
- 
-static void 
-notify_on_helper (const gchar   *pilot,
-		  GPilotd_notify_on_helper_foreach_carrier *carrier) 
-{
-        GpilotDaemon        *daemon;
-        GpilotDaemonPrivate *priv;
-	PilotNotifications  *notifications;
-
-        daemon = GPILOT_DAEMON(carrier->daemon);
-        priv = daemon->priv;
-	notifications = g_hash_table_lookup (priv->notifications, pilot);
-
-	if(notifications == NULL) {
-		notifications = g_new0 (PilotNotifications,1);
-		g_hash_table_insert (priv->notifications,
-                                     g_strdup (pilot), notifications);
-	}
-	switch (carrier->event) {
-	case GNOME_Pilot_NOTIFY_CONNECT: 
-		notifications->connect = g_slist_prepend(notifications->connect,
-							 g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_DISCONNECT: 
-		notifications->disconnect = g_slist_prepend(notifications->disconnect,
-							    g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_BACKUP: 
-		notifications->backup = g_slist_prepend(notifications->backup,
-							g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_CONDUIT: 
-		notifications->conduit = g_slist_prepend(notifications->conduit,
-							 g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_REQUEST_COMPLETION: 
-		notifications->request_complete = g_slist_prepend(notifications->request_complete,
-								  g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_REQUEST_TIMEOUT: 
-		notifications->request_timeout = g_slist_prepend(notifications->request_timeout,
-								 g_strdup(carrier->client_id));
-		break;
-	case GNOME_Pilot_NOTIFY_USERINFO_REQUESTED: 
-		/* FIXME: what was this request to do ? notify when the info was requested or when returned ? */
-		/*notifications->userinfo_requested = g_slist_prepend(notifications->connect,g_strdup(carrier->client_id)); */
-		break;
-	case GNOME_Pilot_NOTIFY_SYSINFO_REQUESTED: 
-		/* FIXME: what was this request to do ? notify when the info was requested or when returned ? */
-		/*notifications->sysinfo_requestde = g_slist_prepend(notifications->connect,g_strdup(carrier->client_id));*/
-		break;
-	case GNOME_Pilot_NOTIFY_USERINFO_SENT: 
-		notifications->userinfo_sent = g_slist_prepend(notifications->userinfo_sent,
-							       g_strdup(carrier->client_id));
-		break;
-	default:
-		g_assert_not_reached();
-		break;
-	}
-}
-
-static gboolean 
-notify_on (GpilotDaemon *daemon, 
-           GNOME_Pilot_EventType     event, 
-           char         *client_id,
-           GError      **error)
-{
-	GSList **pilots;
-        gboolean ret;
-	GPilotd_notify_on_helper_foreach_carrier carrier;
-
-        ret = FALSE;
-	if((pilots = g_hash_table_lookup (daemon->priv->monitors, client_id)) == NULL) {
-                g_set_error (error,
-                             GPILOT_DAEMON_ERROR,
-                             GPILOT_DAEMON_ERROR_GENERAL,
-                             "No monitors");
-                goto out;
-	}
-	carrier.client_id = client_id;
-	carrier.event = event;
-	g_slist_foreach (*pilots, (GFunc)notify_on_helper, (gpointer)&carrier);
-
-        ret = TRUE;
- out:
-        return ret;
-}
-
-static gboolean 
-notify_off (GpilotDaemon *daemon, 
-            GNOME_Pilot_EventType     event, 
-            char         *client_id,
-            GError      **error)
-{
-	GSList **pilots;
-	GPilotd_notify_on_helper_foreach_carrier carrier;
-
-	carrier.client_id = client_id;
-	carrier.event = event;
-	g_warning ("Unimplemented method");
-	/*
-	g_slist_foreach(*pilots,(GFunc)notify_on_helper,(gpointer)&carrier);
-	*/
-
-        return TRUE;
-}
-
-gboolean
-gpilot_daemon_event_notify (GpilotDaemon   *daemon,
-                            GNOME_Pilot_EventType       event,
-                            gboolean        on,
-                            GError        **error)
-{
-        gchar *client_id;
-        gchar *event_type;
-        gboolean ret;
-
-        /* TODO
-	GET_AND_CHECK_CLIENT_ID_VOID(client_id,cb);
-         */
-        event_type = NULL;
-        switch(event) {
-        case GNOME_Pilot_NOTIFY_CONNECT: 
-                event_type = g_strdup("CONNECT"); break;
-        case GNOME_Pilot_NOTIFY_DISCONNECT: 
-                event_type = g_strdup("DISCONNECT"); break;
-        case GNOME_Pilot_NOTIFY_BACKUP: 
-                event_type = g_strdup("BACKUP"); break;
-        case GNOME_Pilot_NOTIFY_CONDUIT: 
-                event_type = g_strdup("CONDUIT"); break;
-        case GNOME_Pilot_NOTIFY_REQUEST_COMPLETION: 
-                event_type = g_strdup("REQUEST_COMPLETION"); break;
-        case GNOME_Pilot_NOTIFY_REQUEST_TIMEOUT: 
-                event_type = g_strdup("REQUEST_TIMEOUT"); break;
-        case GNOME_Pilot_NOTIFY_USERINFO_REQUESTED: 
-                event_type = g_strdup("USERINFO_REQUESTED"); break;
-        case GNOME_Pilot_NOTIFY_USERINFO_SENT: 
-                event_type = g_strdup("USERINFO_SENT"); break;
-        default: g_assert_not_reached(); break;
-        }
-        LOG (("notify_off(event_type=%s,callback=%.20s...)",
-              event_type, client_id));
-        g_free (event_type);
-
-        if (on)
-                ret = notify_on (daemon, event, client_id, error);
-        else
-                ret = notify_off (daemon, event, client_id, error);
-
-        g_free (client_id);
-        return ret;
-}
-
 void
 dbus_notify_connected (const gchar    *pilot_id,
                        struct PilotUser user_info)
@@ -3165,8 +2727,6 @@ gpilot_daemon_init (GpilotDaemon *daemon)
 {
         daemon->priv = GPILOT_DAEMON_GET_PRIVATE (daemon);
 
-        daemon->priv->monitors = g_hash_table_new (g_str_hash, g_str_equal);
-        daemon->priv->notifications = g_hash_table_new (g_str_hash, g_str_equal);
         daemon->priv->gpilotd_context = gpilot_context_new ();
         gpilot_context_init_user (daemon->priv->gpilotd_context);
 
@@ -3176,53 +2736,6 @@ gpilot_daemon_init (GpilotDaemon *daemon)
 }
 
 static void
-cleanup_code_g_free (gpointer a,
-                     gpointer b)
-{
-        g_free (a);
-}
-
-static void                   
-cleanup_code_monitors_remover (gchar   *key,
-                               GSList **value,
-                               gpointer data)
-{       
-        g_free (key);
-        if (value) g_slist_foreach (*value, cleanup_code_g_free, NULL);
-}
-
-static void
-cleanup_code_notifications_remover (gchar *key,
-                                    PilotNotifications *value,
-                                    gpointer data)
-{
-        g_free(key);
-        if (value){
-                g_slist_foreach(value->connect,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->disconnect,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->request_complete,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->request_timeout,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->backup,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->conduit,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->userinfo_requested,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->sysinfo_requested,cleanup_code_g_free,NULL);
-                g_slist_foreach(value->userinfo_sent,cleanup_code_g_free,NULL);
-
-                g_slist_free(value->connect);
-                g_slist_free(value->disconnect);
-                g_slist_free(value->request_complete);
-                g_slist_free(value->request_timeout);
-                g_slist_free(value->backup);
-                g_slist_free(value->conduit);
-                g_slist_free(value->userinfo_requested);
-                g_slist_free(value->sysinfo_requested);
-                g_slist_free(value->userinfo_sent);
-                g_free(value);
-        }
-
-}
-
-static void
 gpilot_daemon_finalize (GObject *object)
 {
         GpilotDaemon *daemon;
@@ -3234,15 +2747,6 @@ gpilot_daemon_finalize (GObject *object)
 
         g_return_if_fail (daemon->priv != NULL);
 
-        g_hash_table_foreach_remove (daemon->priv->monitors,
-                                    (GHRFunc)cleanup_code_monitors_remover,
-                                    NULL);
-        g_hash_table_destroy (daemon->priv->monitors);
-        g_hash_table_foreach_remove (daemon->priv->notifications,
-                                     (GHRFunc)cleanup_code_notifications_remover,
-                                    NULL);
-        g_hash_table_destroy (daemon->priv->notifications);
-
         if (daemon->priv->bus_proxy != NULL) {
                 g_object_unref (daemon->priv->bus_proxy);    
         }
diff --git a/gpilotd/gpilot-daemon.h b/gpilotd/gpilot-daemon.h
index c816d84..340064d 100644
--- a/gpilotd/gpilot-daemon.h
+++ b/gpilotd/gpilot-daemon.h
@@ -129,19 +129,6 @@ typedef enum
 
 typedef enum
 {
-        GNOME_Pilot_NOTIFY_CONNECT,
-        GNOME_Pilot_NOTIFY_DISCONNECT,
-        GNOME_Pilot_NOTIFY_BACKUP,
-        GNOME_Pilot_NOTIFY_CONDUIT,
-        GNOME_Pilot_NOTIFY_REQUEST_COMPLETION,
-        GNOME_Pilot_NOTIFY_REQUEST_TIMEOUT,
-        GNOME_Pilot_NOTIFY_USERINFO_REQUESTED,
-        GNOME_Pilot_NOTIFY_SYSINFO_REQUESTED,
-        GNOME_Pilot_NOTIFY_USERINFO_SENT
-} GNOME_Pilot_EventType;
-
-typedef enum
-{
         GNOME_Pilot_SYNCHRONIZE,
         GNOME_Pilot_CONDUIT_DEFAULT,
         GNOME_Pilot_COPY_FROM_PILOT,
@@ -279,16 +266,6 @@ gboolean        gpilot_daemon_set_user_info     (GpilotDaemon   *daemon,
                                                  const char     *username,
                                                  unsigned long  *handle,
                                                  GError        **error);
-/* Notification operations */
-gboolean        gpilot_daemon_monitor           (GpilotDaemon   *daemon,
-                                                 const char     *pilot_name,
-                                                 gboolean        on,
-                                                 GError        **error);
-gboolean        gpilot_daemon_event_notify      (GpilotDaemon   *daemon,
-                                                 GNOME_Pilot_EventType       event_type,
-                                                 gboolean        on,
-                                                 GError        **error);
-
 /* general functions */
 guint32         pilot_id_from_name              (const gchar    *name,
                                                  GPilotContext  *context);
diff --git a/gpilotd/gpilot-daemon.xml b/gpilotd/gpilot-daemon.xml
index 1b1c069..14bbc4b 100644
--- a/gpilotd/gpilot-daemon.xml
+++ b/gpilotd/gpilot-daemon.xml
@@ -450,52 +450,6 @@
       </doc:doc>
     </method>
 
-    <method name="Monitor">
-      <arg name="pilot_name" direction="in" type="s">
-        <doc:doc>
-          <doc:summary>The pilot name.</doc:summary>
-        </doc:doc>
-      </arg>
-      <arg name="on" direction="in" type="b">
-        <doc:doc>
-          <doc:summary>Indicate turn monitor on or off.</doc:summary>
-        </doc:doc>
-      </arg>
-      <doc:doc>
-        <doc:description>
-          <doc:para>This method initiates a request to</doc:para>
-        </doc:description>
-      </doc:doc>
-    </method>
-
-    <method name="EventNotify">
-      <arg name="event" direction="in" type="u">
-        <doc:doc>
-          <doc:summary>The event type, currently we support following events:
-                        0 - NOTIFY_CONNECT,
-                        1 - NOTIFY_DISCONNECT,
-                        2 - NOTIFY_BACKUP,
-                        3 - NOTIFY_CONDUIT,
-                        4 - NOTIFY_REQUEST_COMPLETION,
-                        5 - NOTIFY_REQUEST_TIMEOUT,
-                        6 - NOTIFY_USERINFO_REQUESTED,
-                        7 - NOTIFY_SYSINFO_REQUESTED,
-                        8 - NOTIFY_USERINFO_SENT
-          </doc:summary>
-        </doc:doc>
-      </arg>
-      <arg name="on" direction="in" type="b">
-        <doc:doc>
-          <doc:summary>Indicate turn monitor on or off.</doc:summary>
-        </doc:doc>
-      </arg>
-      <doc:doc>
-        <doc:description>
-          <doc:para>This method initiates a request to turn on or off a notification of given event.</doc:para>
-        </doc:description>
-      </doc:doc>
-    </method>
-
     <signal name="Connected">
       <arg name="pilot_id" type="s">
         <doc:doc>
diff --git a/utils/gpilotd-client.c b/utils/gpilotd-client.c
index c7d1953..2a45054 100644
--- a/utils/gpilotd-client.c
+++ b/utils/gpilotd-client.c
@@ -404,27 +404,35 @@ main (int argc, char *argv[]) {
 		list_by_login ();
 	} else if (arg_monitor) {
 		g_message ("Monitor on %s",arg_pilot);
+                /*TODO turn on notify with dbus
 		gnome_pilot_client_monitor_on (gpc,arg_pilot);
 		gnome_pilot_client_notify_on (gpc,GNOME_Pilot_NOTIFY_CONNECT);
 		gnome_pilot_client_notify_on (gpc,GNOME_Pilot_NOTIFY_DISCONNECT);
+                */
 		
 		gnome_pilot_client_connect__pilot_connect (gpc, pilot_connect, NULL);
 		gnome_pilot_client_connect__pilot_disconnect (gpc, pilot_disconnect, &stay_alive);
 
 		the_loop ();
 
+                /*TODO turn off notify with dbus
 		gnome_pilot_client_notify_off (gpc,GNOME_Pilot_NOTIFY_CONNECT);
 		gnome_pilot_client_notify_off (gpc,GNOME_Pilot_NOTIFY_DISCONNECT);
 		gnome_pilot_client_monitor_off (gpc,arg_pilot);
+                */
 	} else if (arg_monitorall) {
 		g_message ("Monitor on all");
+                /*TODO turn on notify with dbus
 		gnome_pilot_client_monitor_on_all_pilots (gpc);
+                */
 
 		gnome_pilot_client_connect__pilot_connect (gpc, pilot_connect, NULL);
 		gnome_pilot_client_connect__pilot_disconnect (gpc, pilot_disconnect, &stay_alive);
 
 		the_loop ();
+                /*TODO turn on notify with dbus
 		gnome_pilot_client_monitor_off_all_pilots (gpc);		
+                */
 	} else if (arg_getinfo) {
 		g_message ("Get SystemInfo");
 		get_system_info ();



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