Improving the capplet's druid



Hi Folks

I have attached a patch that I have been developing to get the capplet's
druid to better report errors (i.e. I have started to resolve some of
the FIXMEs in orbit_daemon_glue.c).

WARNING: The patch as attached does not work.

Basically we get a gpilotd crash when we try to throw the exception.
Looking at the code this is because the code automatically generated by
orbit-idl ultimately tries to dereference a NULL pointer.

I can resolve this by adding an integer argument to the exceptions I
want to throw (in gnome-pilot.idl) but this seems a bit messy. Having
run the code in the debugger I am a bit doubtful that any of the
gpthrow(MissingFile, 0) and gpthrow(NoAccess, 0) stuff will work at all.

Can
 a) anyone tell me if this is true?
 b) anyone tell me if or how to fix gpthrow?
 c) tell me if there is a more suitable mailing list!?

	Cheers

	Daniel
	--xx--
 
diff -Naur gnome-pilot-0.1.65.clone/capplet/gnome-pilot-druid.c gnome-pilot-0.1.65/capplet/gnome-pilot-druid.c
--- gnome-pilot-0.1.65.clone/capplet/gnome-pilot-druid.c	2002-10-13 21:07:29.000000000 +0100
+++ gnome-pilot-0.1.65/capplet/gnome-pilot-druid.c	2001-11-05 15:20:26.000000000 +0000
@@ -479,7 +479,6 @@
 	GnomePilotDruidPrivate *priv;
 	GNOME_Pilot_UserInfo user;
 	gchar *text;
-	gint res;
 
 	priv = gpd->priv;
 
@@ -502,7 +501,7 @@
 		user.userID = priv->pilot->pilot_id;
 		user.username = priv->pilot->pilot_username;
 
-		res = gnome_pilot_client_set_user_info (priv->gpc,
+		gnome_pilot_client_set_user_info (priv->gpc,
 						  priv->device->name,
 						  user,
 						  FALSE,
@@ -518,30 +517,11 @@
 
 		save_config_and_restart (priv->gpc, priv->state);
 
-		res = gnome_pilot_client_get_user_info (priv->gpc, priv->device->name, GNOME_Pilot_IMMEDIATE, 0, &priv->handle);
+		gnome_pilot_client_get_user_info (priv->gpc, priv->device->name, GNOME_Pilot_IMMEDIATE, 0, &priv->handle);
 	}
 	gtk_label_set_text (GTK_LABEL (priv->sync_label), text);
         g_free (text);
 
-	if (res != GPILOTD_OK) {
-		gchar *msg;
-
-		switch (res) {
-		case GPILOTD_ERR_NO_ACCESS:
-			msg = _("You do not have permission to access %s.\n");
-			break;
-		case GPILOTD_ERR_FAILED:
-			msg = _("%s does not exists.\n");
-			break;
-		}
-
-		msg = g_strdup_printf(msg, priv->device->name);
-		error_dialog(msg);
-		g_free(msg);
-
-		return;
-	}
-
 	if (priv->handle <= 0) {
 		error_dialog (_("Failed sending request to gpilotd"));
 		return;
diff -Naur gnome-pilot-0.1.65.clone/gpilotd/gnome-pilot-client.gob gnome-pilot-0.1.65/gpilotd/gnome-pilot-client.gob
--- gnome-pilot-0.1.65.clone/gpilotd/gnome-pilot-client.gob	2002-10-13 20:55:56.000000000 +0100
+++ gnome-pilot-0.1.65/gpilotd/gnome-pilot-client.gob	2002-01-23 17:21:51.000000000 +0000
@@ -54,8 +54,7 @@
 	GPILOTD_ERR_INVAL=-1,
 	GPILOTD_ERR_NOT_CONNECTED=-2,
 	GPILOTD_ERR_FAILED=-3,
-	GPILOTD_ERR_INTERNAL=-4,
-	GPILOTD_ERR_NO_ACCESS=-5
+	GPILOTD_ERR_INTERNAL=-4
 };
 
 %}
@@ -818,19 +817,9 @@
 						       &self->ev);
 
 		if (self->ev._major != CORBA_NO_EXCEPTION) {
-			gint res;
-
 			g_warning ("%s:%d: Caught exception: %s",__FILE__,__LINE__, CORBA_exception_id (&self->ev));
-
-			/* decode the exception so was can warn the user about file permissions */
-			if (0 == strcmp (ex_GNOME_Pilot_NoAccess, CORBA_exception_id (&self->ev))) {
-				res = GPILOTD_ERR_NO_ACCESS;
-			} else {
-				res = GPILOTD_ERR_FAILED;
-			}
-
 			CORBA_exception_free (&self->ev);
-			return res;
+			return GPILOTD_ERR_FAILED;
 		}
 
 		if (handle!=NULL) *handle =val;
diff -Naur gnome-pilot-0.1.65.clone/gpilotd/orbit_daemon_glue.c gnome-pilot-0.1.65/gpilotd/orbit_daemon_glue.c
--- gnome-pilot-0.1.65.clone/gpilotd/orbit_daemon_glue.c	2002-10-13 21:16:45.000000000 +0100
+++ gnome-pilot-0.1.65/gpilotd/orbit_daemon_glue.c	2001-11-05 15:20:28.000000000 +0000
@@ -33,7 +33,6 @@
 #include "orbit_daemon_glue.h"
 #include "queue_io.h"
 #include "manager.h"
-#include <errno.h>
 #include <pwd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -486,22 +485,7 @@
 
 	LOG("corba: get_user_info(cradle=%s,survival=%d,timeout=%d)",
 	    cradle,survival,timeout);
-
-	/* throw an exception if we do not have permission to access
-	 * the Palm device
-	 */
-	if (0 != access(cradle, R_OK | W_OK)) {
-		switch(errno) {
-		case EACCES:
-			gpthrow(NoAccess, 0);
-			break;
-		case ENOENT:
-		default:
-			gpthrow(MissingFile, 0);
-			break;
-		}
-	}
-
+	/* FIXME: check for cradle existance, throw exn if not */
 	req.type = GREQ_GET_USERINFO;
 	req.timeout = survival==GNOME_Pilot_PERSISTENT?0:timeout;
 	req.pilot_id = 0;


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