New applet...

Dan Karmgard karmgard at ix.netcom.com
Tue Aug 26 17:36:26 CEST 2003


Hi Paul,
	OK. Well, strike 2 I guess. I've attached another patch. This one will
undo the previous patch, so if patch complains about previously applied
patches, give it a "y" to the question 

	Reversed (or previously applied) patch detected!  Assume -R? [n]

It will also fix the "pass device to scripts bug" as well as a bug in
the rate calculation.
	As for the main problem. I'm at a loss. So I'd ask that you do the
following, at the bottom of the file global.h there's a #define for the
variable DEBUG. Set it to TRUE then compile and install as usual but
route the output to a file, 

	$make >make-messages 2>&1;sudo make install >>make-messages 2>&1

from the top level directory. Then start the panel from a terminal,
again routing the output to a file, e.g.;

	xfce4-panel > panel-messages 2>&1

Then send me the output files. This way I'll at least know where to look
for the trouble.

On Sun, 2003-08-24 at 21:56, Paul Ladouceur wrote:
> Hi-dee-ho!
> 
> I've installed successfully the patch, compile & installed. But that 
> didn't solve the applet going into LEDS mode... Always stuck with the 
> Off-Line and Phone icon state! :-(
> 
> And i've found something else: When I uncheck the "Pass the device to 
> scripts", within a session it keeps the state. But if I logout -> login, 
> the properties always revert this option to enabled! :-(
> 
> As I've stated before, the revision 0.1.1 was better since I was able to 
> enable the LEDS just by going into properties and close it... everything 
> else (don't know for the "Pass the device.." option) was OK... So right 
> now (0.1.2), i've totally lost the On-Line functionnality of the applet, 
> except that I can start/stop my ppp0 connexion...
> 
> Regards,
> Ti-Paul.
> 
> 
> Dan Karmgard wrote:
> 
> >Hello Paul,
> >	Well, that was a tough nut to crack. However, I have at least a working
> >theory. I think the problem lies in how libgtop is reporting the device
> >flags that I use to detect if the device is active. I've made a patch
> >for pppdevice.c and attached it to this message. To apply copy the
> >attachment into xfce4-pppwatch-plugin-0.1.2/panel-plugin and enter 
> >
> >	patch -p0 <pppdevice.c.patch
> >
> >Then compile/install as usual. Let me know if this helps, and thanks for
> >testing efforts.
> >
> >  
> >
> >------------------------------------------------------------------------
> >
> >--- pppdevice.c	2003-08-24 17:13:47.000000000 -0500
> >+++ pppdevice.c.new	2003-08-24 17:05:15.000000000 -0500
> >@@ -106,7 +106,7 @@
> >   running = netload.if_flags & (1<<GLIBTOP_IF_FLAGS_RUNNING);
> >   running = (running) ? TRUE : FALSE;
> > 
> >-  if ( !up || !running || !netload.address ) {
> >+  if ( !up || !netload.address ) {
> >     int i;
> >     for (i=0;i<9;i++)
> >       printf("%a");
> >@@ -155,7 +155,7 @@
> >       running = (running) ? TRUE : FALSE;
> > 
> >       /*-- If this device doesn't have an address, don't bother with it --*/
> >-      if ( up && running && netload.address != 0 ) {
> >+      if ( up && netload.address != 0 ) {
> > 	strncpy( (char *)&modem.device_name, names[i], (size_t)6 );
> > 	modem.online = TRUE;
> > 	if ( DEBUG )
> >@@ -180,7 +180,7 @@
> >     running = (running) ? TRUE : FALSE;
> > 
> >     /*-- If this device isn't up and running (with an address), don't bother with it --*/
> >-    if ( up && running && (netload.address != 0) ) {
> >+    if ( up && (netload.address != 0) ) {
> >       strncpy( (char *)&modem.device_name, pppwatch_device_name, (size_t)6 );
> >       modem.online = TRUE;
> >       if ( DEBUG )
> >  
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >Xfce mailing list
> >Xfce at xfce.org
> >http://moongroup.com/mailman/listinfo/xfce
> >  
> >
> 
> 
> _______________________________________________
> Xfce mailing list
> Xfce at xfce.org
> http://moongroup.com/mailman/listinfo/xfce

-------------- next part --------------
--- pppdevice.c	2003-08-26 10:07:47.000000000 -0500
+++ save/pppdevice.c.old	2003-08-25 12:54:29.000000000 -0500
@@ -53,8 +53,7 @@
   if ( !modem.online ) {
     sprintf((char *)string, _("Off-Line"));
   } else {
-    float scale = (float)1000.0/(float)pppwatch_update_interval;
-    float rate = scale*(modem.traffic[Rx]+modem.traffic[Tx]);
+    float rate = modem.traffic[Rx]+modem.traffic[Tx];
     if ( rate >= MEGABYTES ) {
       rate /= MEGABYTES;
       if ( rate < 10.0f )
@@ -107,7 +106,7 @@
   running = netload.if_flags & (1<<GLIBTOP_IF_FLAGS_RUNNING);
   running = (running) ? TRUE : FALSE;
 
-  if ( !up || !running || !netload.address ) {
+  if ( !netload.address ) {
     int i;
     for (i=0;i<9;i++)
       printf("%a");
@@ -156,7 +155,7 @@
       running = (running) ? TRUE : FALSE;
 
       /*-- If this device doesn't have an address, don't bother with it --*/
-      if ( up && running && netload.address != 0 ) {
+      if ( netload.address != 0 ) {
 	strncpy( (char *)&modem.device_name, names[i], (size_t)6 );
 	modem.online = TRUE;
 	if ( DEBUG )
@@ -181,7 +180,7 @@
     running = (running) ? TRUE : FALSE;
 
     /*-- If this device isn't up and running (with an address), don't bother with it --*/
-    if ( up && running && netload.address != 0 ) {
+    if ( netload.address != 0 ) {
       strncpy( (char *)&modem.device_name, pppwatch_device_name, (size_t)6 );
       modem.online = TRUE;
       if ( DEBUG )
--- pppwatch.c	2003-08-26 09:58:23.000000000 -0500
+++ save/pppwatch.c.old	2003-08-26 10:09:26.000000000 -0500
@@ -18,7 +18,7 @@
 #include <libgnome-2.0/libgnome/gnome-sound.h>
 #endif
 
-#define PPPWATCH_ROOT "PPPWatch"
+#define PPPWATCHITOR_ROOT "PPPWatch"
 
 extern xmlDocPtr xmlconfig;
 #define DATA(node) xmlNodeListGetString(xmlconfig, node->children, 1)
@@ -84,19 +84,13 @@
     printf("Reading configuration\n");
 
   if ( node != NULL ) {
-    if (!node || !node->children) {
-      if ( DEBUG)
-	printf("Bad node! Returning!\n");
+    if (!node || !node->children)
       return;
-    }
 
     node = node->children;
   
-    if (!xmlStrEqual (node->name, (const xmlChar *) PPPWATCH_ROOT)) {
-      if ( DEBUG)
-	printf("Node Name Failed! (%s). Returning.\n", (const char *)node->name);
+    if (!xmlStrEqual (node->name, (const xmlChar *) PPPWATCHITOR_ROOT))
       return;
-    }
 
     for (node = node->children; node; node = node->next) {
       if ( xmlStrEqual (node->name, (const xmlChar *) "interval")) {
@@ -106,47 +100,26 @@
 	if ( n>0 ) {
 	  pppwatch_update_interval = n;
 	}
-
-	if ( DEBUG)
-	  printf("Got interval = %i\n", pppwatch_update_interval);
-
       } else if (xmlStrEqual(node->name, (const xmlChar *) "connect")) {
 	value = DATA(node);
 	if ( value )
 	  strcpy(pppwatch_connect_script_name, (const char *)value);
-
-	if ( DEBUG)
-	  printf("Got connect = %s\n", pppwatch_connect_script_name);
-
       } else if (xmlStrEqual(node->name, (const xmlChar *) "disconnect")) {
 	value = DATA(node);
 	if ( value )
 	  strcpy(pppwatch_disconnect_script_name, (const char *)value);
-
-	if ( DEBUG)
-	  printf("Got disconnect = %s\n", pppwatch_disconnect_script_name);
-
       } else if (xmlStrEqual(node->name, (const xmlChar *) "devicename")) {
 	value = DATA(node);
 	if ( value )
 	  strcpy(pppwatch_device_name, (const char *)value);
-
-	if ( DEBUG)
-	  printf("Got devicename = %s\n", pppwatch_device_name);
-
-      } else if (xmlStrEqual(node->name, (const xmlChar *) "pass_device")) {
+      } else if (xmlStrEqual(node->name, (const xmlChar *) "passdevice")) {
 	value = DATA(node);
 	if ( !strcmp(value, "true") )
 	  pppwatch_pass_device_as_parameter = TRUE;
 	else
 	  pppwatch_pass_device_as_parameter = FALSE;
-
-	if ( DEBUG)
-	  printf("Got passdevice = %s\n", pppwatch_pass_device_as_parameter ? "TRUE" : "FALSE");
       }
     }
-  } else if ( DEBUG) {
-    printf("node == NULL! No configuration read!\n");
   }
 
   /* Initialize the network device,
@@ -174,7 +147,7 @@
       printf("Writing configuration\n");
 
     root = xmlNewTextChild (parent, NULL, 
-			    (const xmlChar *)PPPWATCH_ROOT, 
+			    (const xmlChar *)PPPWATCHITOR_ROOT, 
 			    NULL);
 
     g_snprintf (value, 5, "%d", pppwatch_update_interval);
@@ -185,7 +158,7 @@
     xmlNewTextChild (root, NULL, (const xmlChar *)"devicename", (const xmlChar *)pppwatch_device_name);
 
     if ( pppwatch_pass_device_as_parameter )
-      xmlNewTextChild (root, NULL, (const xmlChar *)"pass_device", (const xmlChar *)"true");
+      xmlNewTextChild (root, NULL, (const xmlChar *)"passdevice", (const xmlChar *)"true");
     else
       xmlNewTextChild (root, NULL, (const xmlChar *)"pass_device", (const xmlChar *)"false");
 


More information about the Xfce mailing list