[gnome-pilot/dbus] Rework dbus method org.gnome.GnomePilot.Daemon.GetPilotIDs
- From: Halton Huo <haltonhuo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-pilot/dbus] Rework dbus method org.gnome.GnomePilot.Daemon.GetPilotIDs
- Date: Wed, 17 Mar 2010 07:11:29 +0000 (UTC)
commit ca60f0bae9add626c9b9f3b875e5f123284ed13a
Author: Halton Huo <halton huo sun com>
Date: Wed Mar 17 11:21:53 2010 +0800
Rework dbus method org.gnome.GnomePilot.Daemon.GetPilotIDs
Use "gpilotd-client --listpilots=all" to test.
gpilotd/gnome-pilot-client.gob | 6 +++---
gpilotd/gpilot-daemon.c | 3 +--
gpilotd/gpilot-daemon.xml | 2 +-
utils/gpilotd-client.c | 18 +-----------------
4 files changed, 6 insertions(+), 23 deletions(-)
---
diff --git a/gpilotd/gnome-pilot-client.gob b/gpilotd/gnome-pilot-client.gob
index 4f44204..10af028 100644
--- a/gpilotd/gnome-pilot-client.gob
+++ b/gpilotd/gnome-pilot-client.gob
@@ -1015,12 +1015,12 @@ error: if (file_copied == FALSE) {
return GPILOTD_ERR_FAILED;
}
- (*output) = g_new0 (int, g_list_length (arr->len));
+ (*output) = g_new0 (int, arr->len);
for (i = 0; i < arr->len; i++) {
- (*output)[i] = GPOINTER_TO_INT (g_ptr_array_index (arr, i));
+ (*output)[i] = GPOINTER_TO_UINT (g_ptr_array_index (arr, i));
}
- g_ptr_array_free (arr, TRUE);
+ g_ptr_array_free (arr, FALSE);
return GPILOTD_OK;
}
diff --git a/gpilotd/gpilot-daemon.c b/gpilotd/gpilot-daemon.c
index 09c0fe8..9e087c9 100644
--- a/gpilotd/gpilot-daemon.c
+++ b/gpilotd/gpilot-daemon.c
@@ -2061,8 +2061,7 @@ gpilot_daemon_get_pilot_ids (GpilotDaemon *daemon,
for(i=0; i < g_list_length (l); i++) {
GPilotPilot *pilot = GPILOT_PILOT (g_list_nth (l, i)->data);
- g_ptr_array_add (*pilots,
- &pilot->pilot_id);
+ g_ptr_array_add (*pilots, (pilot->pilot_id));
}
return TRUE;
diff --git a/gpilotd/gpilot-daemon.xml b/gpilotd/gpilot-daemon.xml
index 14bbc4b..2e4022e 100644
--- a/gpilotd/gpilot-daemon.xml
+++ b/gpilotd/gpilot-daemon.xml
@@ -223,7 +223,7 @@
</method>
<method name="GetPilotIDs">
- <arg name="pilots" direction="out" type="ai">
+ <arg name="pilots" direction="out" type="au">
<doc:doc>
<doc:summary>An array of pilot IDs.</doc:summary>
</doc:doc>
diff --git a/utils/gpilotd-client.c b/utils/gpilotd-client.c
index e008829..bf4b22c 100644
--- a/utils/gpilotd-client.c
+++ b/utils/gpilotd-client.c
@@ -22,7 +22,6 @@ int arg_pause=0,
arg_listbases = 0,
arg_listusers = 0,
arg_listcradles = 0,
- arg_listpilots = 0,
arg_monitorall=0,
arg_monitor,
arg_getinfo = 0;
@@ -52,12 +51,11 @@ static GOptionEntry options[] = {
{"userid", '\0', 0, G_OPTION_ARG_STRING, &arg_username, N_("Username to set"), N_("USERNAME")},
{"monitor", 'm', 0, G_OPTION_ARG_NONE, &arg_monitor, N_("Monitor the specified PDA's actions"), NULL},
{"monitorall", 'A', 0, G_OPTION_ARG_NONE, &arg_monitorall, N_("Monitor all PDAs"), NULL},
- {"listpilotsbylogin", '\0', 0, G_OPTION_ARG_STRING, &arg_list_by_login, N_("list PDAs by login (all for all pilots)"), N_("LOGIN")},
+ {"listpilots", '\0', 0, G_OPTION_ARG_STRING, &arg_list_by_login, N_("list PDAs by login (all for all pilots)"), N_("LOGIN")},
{"pilot", '\0', 0, G_OPTION_ARG_STRING, &arg_pilot, N_("Specify PDA to operate on (defaults to MyPDA)"), N_("PILOTNAME")},
{"cradle", '\0', 0, G_OPTION_ARG_STRING, &arg_cradle, N_("Specify a cradle to operate on (defaults to Cradle0)"), N_("CRADLENAME")},
{"listusers", '\0', 0, G_OPTION_ARG_NONE, &arg_listusers, N_("List users"), NULL},
{"listcradles", '\0', 0, G_OPTION_ARG_NONE, &arg_listcradles, N_("List cradles"), NULL},
- {"listpilots", '\0', 0, G_OPTION_ARG_NONE, &arg_listpilots, N_("List pilots"), NULL},
{"listbases", 'l', 0, G_OPTION_ARG_NONE, &arg_listbases, N_("List the specified PDA's bases"), NULL},
{NULL},
};
@@ -161,18 +159,6 @@ static void list_cradles (void) {
g_message ("No cradle");
}
-static void list_pilots (void) {
- GList *list = NULL,*ptr;
-
- gnome_pilot_client_get_pilots (gpc, &list);
- if (list)
- for (ptr = list; ptr; ptr = ptr->next) {
- g_message ("pilot %s", (char*)ptr->data);
- }
- else
- g_message ("No pilot");
- }
-
static void list_bases (void) {
GList *list = NULL,*ptr;
@@ -444,8 +430,6 @@ main (int argc, char *argv[]) {
list_users ();
} else if (arg_listcradles) {
list_cradles ();
- } else if (arg_listpilots) {
- list_pilots ();
} else if (arg_listbases) {
list_bases ();
} else if (arg_list_by_login) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]