[gnome-pilot/dbus] Add dbus_notify_xxx to replace orbet_notify_xxx functions.



commit a38439df80339c71667291afeed612cd0b8be7fe
Author: Halton Huo <halton huo sun com>
Date:   Thu Mar 4 19:05:36 2010 +0800

    Add dbus_notify_xxx to replace orbet_notify_xxx functions.

 gpilotd/gpilot-daemon.c |   87 +++++++++++++++++++++++++++++++++++++++++++++++
 gpilotd/gpilot-daemon.h |   40 +++++++++++++++++++++
 gpilotd/gpilotd.c       |   22 ++++++------
 gpilotd/manager.c       |   40 +++++++++++-----------
 4 files changed, 158 insertions(+), 31 deletions(-)
---
diff --git a/gpilotd/gpilot-daemon.c b/gpilotd/gpilot-daemon.c
index 9a216b3..fbc374e 100644
--- a/gpilotd/gpilot-daemon.c
+++ b/gpilotd/gpilot-daemon.c
@@ -1248,6 +1248,93 @@ gpilot_daemon_event_notify (GpilotDaemon   *daemon,
         return ret;
 }
 
+void
+dbus_notify_connected (const gchar    *pilot_id,
+                       struct PilotUser user_info)
+{
+}
+
+void
+dbus_notify_disconnected (const gchar    *pilot_id)
+{
+}
+
+void
+dbus_notify_completion (GPilotRequest **req)
+{
+}
+
+void
+dbus_notify_userinfo (struct PilotUser    user_info,
+                      GPilotRequest     **req)
+{
+}
+
+void
+dbus_notify_sysinfo (const gchar      *pilot_id,
+                     struct SysInfo    sysinfo,
+                     struct CardInfo   cardinfo,
+                     GPilotRequest   **req)
+{
+}
+
+
+void
+dbus_notify_conduit_start (const gchar              *pilot_id,
+                           GnomePilotConduit        *conduit,
+                           GnomePilotConduitSyncType type)
+{
+}
+
+void
+dbus_notify_conduit_end (const gchar       *pilot_id,
+                         GnomePilotConduit *conduit)
+{
+}
+
+void
+dbus_notify_conduit_error (const gchar       *pilot_id,
+                           GnomePilotConduit *conduit,
+                           const gchar       *message)
+{
+}
+
+void
+dbus_notify_conduit_message (const gchar       *pilot_id,
+                             GnomePilotConduit *conduit,
+                             const gchar       *message)
+{
+}
+
+void
+dbus_notify_conduit_progress (const gchar       *pilot_id,
+                              GnomePilotConduit *conduit,
+                              gint               current,
+                              gint               total)
+{
+}
+
+void
+dbus_notify_overall_progress (const gchar    *pilot_id,
+                              gint            current,
+                              gint            total)
+{
+}
+
+void
+dbus_notify_daemon_message (const gchar       *pilot_id,
+                            GnomePilotConduit *conduit,
+                            const gchar       *message)
+{
+}
+
+void
+dbus_notify_daemon_error (const gchar       *pilot_id,
+                          GnomePilotConduit *conduit,
+                          const gchar       *message)
+{
+}
+
 static void
 gpilot_daemon_class_init (GpilotDaemonClass *klass)
 {
diff --git a/gpilotd/gpilot-daemon.h b/gpilotd/gpilot-daemon.h
index 0693963..3e97db9 100644
--- a/gpilotd/gpilot-daemon.h
+++ b/gpilotd/gpilot-daemon.h
@@ -28,6 +28,8 @@ G_BEGIN_DECLS
 #include <dbus/dbus-glib.h>
 
 #include "gnome-pilot-structures.h"
+#include "gnome-pilot-dbinfo.h"
+#include "queue_io.h"
 
 #define GPILOT_TYPE_DAEMON         (gpilot_daemon_get_type ())
 #define GPILOT_DAEMON(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GPILOT_TYPE_DAEMON, GpilotDaemon))
@@ -292,6 +294,44 @@ guint32         pilot_id_from_name              (const gchar    *name,
                                                  GPilotContext  *context);
 gchar*          pilot_name_from_id              (guint32         id,
                                                  GPilotContext  *context);
+
+/* send dbus signals */
+void            dbus_notify_connected           (const gchar    *pilot_id,
+                                                 struct PilotUser user_info);
+void            dbus_notify_disconnected        (const gchar    *pilot_id);
+void            dbus_notify_completion          (GPilotRequest **req);
+void            dbus_notify_userinfo            (struct PilotUser user_info,
+                                                 GPilotRequest **req);
+void            dbus_notify_sysinfo             (const gchar    *pilot_id,
+                                                 struct SysInfo  sysinfo,
+                                                 struct CardInfo cardinfo,
+                                                 GPilotRequest **req);
+
+void            dbus_notify_conduit_start       (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 GnomePilotConduitSyncType);
+void            dbus_notify_conduit_end         (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit);
+void            dbus_notify_conduit_error       (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 const gchar    *message);
+void            dbus_notify_conduit_message     (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 const gchar    *message);
+void            dbus_notify_conduit_progress    (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 gint            current,
+                                                 gint            total);
+void            dbus_notify_overall_progress    (const gchar    *pilot_id,
+                                                 gint            current,
+                                                 gint            total);
+void            dbus_notify_daemon_message      (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 const gchar    *message);
+void            dbus_notify_daemon_error        (const gchar    *pilot_id,
+                                                 GnomePilotConduit *conduit,
+                                                 const gchar    *message);
+
 G_END_DECLS
 
 #endif /* __GPILOT_DAEMON_H */
diff --git a/gpilotd/gpilotd.c b/gpilotd/gpilotd.c
index 81f5472..166be86 100644
--- a/gpilotd/gpilotd.c
+++ b/gpilotd/gpilotd.c
@@ -457,9 +457,9 @@ gpilot_attempt_restore (struct PilotUser pu,
 		GPilotPilot *a_pilot;
 		a_pilot = gpilot_gui_restore (context, pilot);
 		if (a_pilot) {
-			orbed_notify_connect (pilot->name,pu);				
+			dbus_notify_connected (pilot->name,pu);				
 			result = gpilot_start_unknown_restore (pfd, device, a_pilot);
-			orbed_notify_disconnect (pilot->name);
+			dbus_notify_disconnected (pilot->name);
 		}
 	} else {
 		/* MUST GO */
@@ -518,7 +518,7 @@ do_cradle_events (int pfd,
 	gboolean ret = TRUE;
 	
 	/* elements in events freed by gpc_request_purge calls
-	   in orbed_notify_completion */
+	   in dbus_notify_completion */
 	events = gpc_queue_load_requests_for_cradle (device->name);
 	
 	g_message (_("Device %s has %d events"), device->name, g_list_length (events));
@@ -542,7 +542,7 @@ do_cradle_events (int pfd,
 				g_message (_("Sync continues"));
 				ret = FALSE;
 			}
-			orbed_notify_completion (&req);
+			dbus_notify_completion (&req);
 			break;
 		case GREQ_GET_SYSINFO: {
 			struct SysInfo sysinfo;
@@ -550,17 +550,17 @@ do_cradle_events (int pfd,
 
 			dlp_ReadStorageInfo (pfd, 0, &cardinfo);
 			dlp_ReadSysInfo (pfd, &sysinfo);
-			orbed_notify_sysinfo (device->name,
+			dbus_notify_sysinfo (device->name,
 					      sysinfo,
 					      cardinfo, 
 					      &req);
-			orbed_notify_completion (&req);
+			dbus_notify_completion (&req);
 		}
 		break;
 		case GREQ_GET_USERINFO:
 			g_message (_("Getting userinfo..."));
-			orbed_notify_userinfo (*pu,&req);
-			orbed_notify_completion (&req);
+			dbus_notify_userinfo (*pu,&req);
+			dbus_notify_completion (&req);
 			break;
 		case GREQ_NEW_USERINFO:
 			/* FIXME: this is to set the new and return the old (or something) 
@@ -568,7 +568,7 @@ do_cradle_events (int pfd,
 			   g_snprintf (pu->username,127,"%s",req->parameters.set_userinfo.user_id);
 			   pu->userID = req->parameters.set_userinfo.pilot_id;
 			   dlp_WriteUserInfo (pfd,pu);
-			   orbed_notify_completion (&req);
+			   dbus_notify_completion (&req);
 			*/
 			break;
 		default:
@@ -817,9 +817,9 @@ sync_device (GPilotDevice *device, GPilotContext *context)
 					gpilot_syncing_unknown_pilot (pu, pfd, device, context);
 				} else {
 					/* Pilot is known, make connect notifications */
-					orbed_notify_connect (pilot->name,pu);				
+					dbus_notify_connected (pilot->name,pu);				
 					gpilot_syncing_known_pilot (pilot, pu, pfd, device, context);
-					orbed_notify_disconnect (pilot->name);
+					dbus_notify_disconnected (pilot->name);
 				}				
 			}
 		}
diff --git a/gpilotd/manager.c b/gpilotd/manager.c
index b0297c4..e7aad15 100644
--- a/gpilotd/manager.c
+++ b/gpilotd/manager.c
@@ -176,7 +176,7 @@ gnome_pilot_conduit_backup_func (gchar *filename,
 				 gint db,
 				 gint total_dbs,
 				 GnomePilotBackupFuncCarrier *carrier) {
-	orbed_notify_overall_progress (carrier->pilot_name, db, total_dbs);
+	dbus_notify_overall_progress (carrier->pilot_name, db, total_dbs);
 	
 	g_message ("gnome_pilot_conduit_backup_func (%s)", filename);
 
@@ -191,7 +191,7 @@ conduit_progress_callback (GnomePilotConduit *conduit,
 			   gint total,
 			   gint current,
 			   gpointer pilot_id) {
-	orbed_notify_conduit_progress ((gchar*)pilot_id,
+	dbus_notify_conduit_progress ((gchar*)pilot_id,
 				       conduit,
 				       current,
 				       total);
@@ -201,7 +201,7 @@ static void
 conduit_message_callback (GnomePilotConduit *conduit, 
 			  gchar *message,
 			  gpointer pilot_id) {
-	orbed_notify_conduit_message ((gchar*)pilot_id,
+	dbus_notify_conduit_message ((gchar*)pilot_id,
 				      conduit,
 				      message);
 }
@@ -210,7 +210,7 @@ static void
 conduit_error_callback (GnomePilotConduit *conduit, 
 			gchar *message,
 			gpointer pilot_id) {
-	orbed_notify_conduit_error ((gchar*)pilot_id,
+	dbus_notify_conduit_error ((gchar*)pilot_id,
 				    conduit,
 				    message);
 }
@@ -303,7 +303,7 @@ iterate_dbs (gint pfd,
 
 	pilot_info = gpilot_find_pilot_by_id (pu->userID, context->pilots);
 
-	orbed_notify_daemon_message (pilot_info->name, NULL, _("Collecting synchronization info..."));
+	dbus_notify_daemon_message (pilot_info->name, NULL, _("Collecting synchronization info..."));
 
 	while (1) {
 		GnomePilotDBInfo *dbinfo;
@@ -380,7 +380,7 @@ iterate_dbs (gint pfd,
 				set_callbacks (FALSE, GNOME_PILOT_CONDUIT (conduit), pilot_info->name);
 			}
 
-			orbed_notify_overall_progress (pilot_info->name, index, g_list_length (dbs)); 
+			dbus_notify_overall_progress (pilot_info->name, index, g_list_length (dbs)); 
 
 			/*
 			  It seems pretty erratic which has this and which hasn't,
@@ -427,11 +427,11 @@ conduit_synchronize (GnomePilotConduitStandard *conduit, GnomePilotDBInfo *dbinf
 
 	write_sync_type_line_to_pilot (dbinfo, GNOME_PILOT_CONDUIT (conduit), _("Synchronizing %s\n"));
 
-	orbed_notify_conduit_start (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_start (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit),
 				   GnomePilotConduitSyncTypeSynchronize);
 	err = gnome_pilot_conduit_standard_synchronize (conduit, dbinfo);
-	orbed_notify_conduit_end (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_end (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit));
 	return err;
 }
@@ -446,11 +446,11 @@ conduit_copy_to_pilot (GnomePilotConduitStandard *conduit, GnomePilotDBInfo *dbi
 
 	write_sync_type_line_to_pilot (dbinfo, GNOME_PILOT_CONDUIT (conduit), _("Copy to PDA %s\n"));
 
-	orbed_notify_conduit_start (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_start (dbinfo->pilotInfo->name,
 				    GNOME_PILOT_CONDUIT (conduit),
 				    GnomePilotConduitSyncTypeCopyToPilot);
 	err = gnome_pilot_conduit_standard_copy_to_pilot (conduit, dbinfo);
-	orbed_notify_conduit_end (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_end (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit));
 	return err;
 }
@@ -464,11 +464,11 @@ conduit_copy_from_pilot (GnomePilotConduitStandard *conduit, GnomePilotDBInfo *d
 
 	write_sync_type_line_to_pilot (dbinfo, GNOME_PILOT_CONDUIT (conduit), _("Copy from PDA %s\n"));
 
-	orbed_notify_conduit_start (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_start (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit),
 				   GnomePilotConduitSyncTypeCopyFromPilot);
 	err = gnome_pilot_conduit_standard_copy_from_pilot (conduit, dbinfo);
-	orbed_notify_conduit_end (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_end (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit));
 	return err;
 }
@@ -482,11 +482,11 @@ conduit_merge_to_pilot (GnomePilotConduitStandard *conduit, GnomePilotDBInfo *db
 
 	write_sync_type_line_to_pilot (dbinfo, GNOME_PILOT_CONDUIT (conduit), _("Merge to PDA %s\n"));
 
-	orbed_notify_conduit_start (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_start (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit),
 				   GnomePilotConduitSyncTypeMergeToPilot);
 	err = gnome_pilot_conduit_standard_merge_to_pilot (conduit, dbinfo);
-	orbed_notify_conduit_end (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_end (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit));
 	return err;
 }
@@ -500,11 +500,11 @@ conduit_merge_from_pilot (GnomePilotConduitStandard *conduit, GnomePilotDBInfo *
 
 	write_sync_type_line_to_pilot (dbinfo, GNOME_PILOT_CONDUIT (conduit), _("Merge from PDA %s\n"));
 
-	orbed_notify_conduit_start (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_start (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit),
 				   GnomePilotConduitSyncTypeMergeFromPilot);
 	err = gnome_pilot_conduit_standard_merge_from_pilot (conduit, dbinfo);
-	orbed_notify_conduit_end (dbinfo->pilotInfo->name,
+	dbus_notify_conduit_end (dbinfo->pilotInfo->name,
 				   GNOME_PILOT_CONDUIT (conduit));
 	return err;
 }
@@ -570,7 +570,7 @@ install_db_foreach (GPilotRequest *req, GnomePilotInstallCarrier *carrier) {
 	set_callbacks (FALSE, carrier->conduit, pilot_name);
 
 	g_free (pilot_name);
-	orbed_notify_completion (&req);
+	dbus_notify_completion (&req);
 }
 
 static void
@@ -628,7 +628,7 @@ do_restore_foreach (GPilotRequest *req, GnomePilotInstallCarrier *carrier)
 	}
 
 	g_free (pilot_name);
-	orbed_notify_completion (&req);
+	dbus_notify_completion (&req);
 }
 
 static void
@@ -783,7 +783,7 @@ gpilot_start_unknown_restore (int pfd,
 		struct PilotUser pu;
 		char *tmp;
 		tmp = g_strdup_printf (_("Setting id/owner to %d/%s..."), pilot->pilot_id, pilot->pilot_username);
-		orbed_notify_daemon_message (pilot->name, NULL, tmp);
+		dbus_notify_daemon_message (pilot->name, NULL, tmp);
 		g_snprintf (pu.username, 127, "%s", pilot->pilot_username);
 		pu.userID = pilot->pilot_id;
 		dlp_WriteUserInfo (pfd, &pu);
@@ -840,7 +840,7 @@ run_conduit_sync_foreach (GPilotRequest *req,
 					  carrier->context); 
 		}
 	}
-	orbed_notify_completion (&req);
+	dbus_notify_completion (&req);
 }
 
 gboolean gpilot_initial_synchronize_operations (int pilot_socket,



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