[Goodies-commits] r2098 - xfce4-genmon-plugin/trunk/panel-plugin

Julien Devemy jujucece at xfce.org
Tue Oct 10 13:23:22 CEST 2006


Author: jujucece
Date: 2006-10-10 11:23:21 +0000 (Tue, 10 Oct 2006)
New Revision: 2098

Modified:
   xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.c
   xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.h
   xfce4-genmon-plugin/trunk/panel-plugin/config_gui.c
   xfce4-genmon-plugin/trunk/panel-plugin/config_gui.h
   xfce4-genmon-plugin/trunk/panel-plugin/main.c
Log:
Clean of the code (no more tabs)


Modified: xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.c
===================================================================
--- xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.c	2006-10-10 09:38:18 UTC (rev 2097)
+++ xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.c	2006-10-10 11:23:21 UTC (rev 2098)
@@ -1,10 +1,11 @@
-// Generic Monitor plugin for the Xfce4 panel
-// Spawn - Spawn a process and capture its output
-// Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
-//                                      <http://rmlx.dyndns.org>
-// Copyright (c) 2006 Julien Devemy <jujucece at gmail.com>
-
-/*  This library is free software; you can redistribute it and/or
+/*
+ *  Generic Monitor plugin for the Xfce4 panel
+ *  Spawn - Spawn a process and capture its output
+ *  Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
+ *                                  <http://rmlx.dyndns.org>
+ *  Copyright (c) 2006 Julien Devemy <jujucece at gmail.com>
+ *  
+ *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
  *  License as published by the Free Software Foundation; either
  *  version 2.1 of the License, or (at your option) any later version.
@@ -17,17 +18,17 @@
  *  You should have received a copy of the GNU Lesser General Public
  *  License along with this library; if not, write to the Free Software
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
+ */
 
-	/* Posix-compliance to make sure that only the calling thread is
-	   duplicated, not the whole process (e.g Solaris) */
+/* Posix-compliance to make sure that only the calling thread is
+   duplicated, not the whole process (e.g Solaris) */
 
 #ifndef _POSIX_C_SOURCE
-#define _POSIX_C_SOURCE	199506L
+#define _POSIX_C_SOURCE 199506L
 #endif
 
 #ifndef _XOPEN_SOURCE
-#define _XOPEN_SOURCE	500
+#define _XOPEN_SOURCE 500
 #endif
 
 #include "cmdspawn.h"
@@ -52,8 +53,8 @@
 
 /**********************************************************************/
 static int ParseCmdline (const char *const p_pcCmdLine, char ***p_pppcArgv, ...
-			 /* &argc, */
-			 /* acError, ErrorBufferSize */ )
+ /* &argc, */
+ /* acError, ErrorBufferSize */ )
 /**********************************************************************/
  /* Split a commandline string into an argv-type dynamically allocated
     array. The caller shall free this array when not needed any longer */
@@ -61,9 +62,9 @@
     be sent to stderr */
  /* Return 0 on success, -1 on failure */
 {
-    const size_t    M = strlen (p_pcCmdLine),	// 
-	N = M + 1,		// 
-	P = M * sizeof (char *);
+    const size_t    M = strlen (p_pcCmdLine),
+        N = M + 1,
+        P = M * sizeof (char *);
     size_t          BufSafeSize;
     char            acFormat[16];
     char           *pcStr, *pcStr1, *pcStr2;
@@ -81,9 +82,9 @@
     va_start (ap, p_pppcArgv);
     piArgc = va_arg (ap, int *);
     if (piArgc) {
-	pcError = va_arg (ap, char *);
-	if (pcError)
-	    BufferSize = va_arg (ap, size_t);
+        pcError = va_arg (ap, char *);
+        if (pcError)
+            BufferSize = va_arg (ap, size_t);
     }
     va_end (ap);
 
@@ -93,14 +94,14 @@
     pcStr2 = (char *) malloc (N);
     argv = (char **) malloc (P);
     if (!(pcStr && pcStr1 && pcStr2 && argv)) {
-	if (pcError) {
-	    n = errno;
-	    snprintf (pcError, BufSafeSize, "malloc(%d): %s", n,
-		      strerror (n));
-	}
-	else
-	    perror ("malloc(argv)");
-	return (-1);
+        if (pcError) {
+            n = errno;
+            snprintf (pcError, BufSafeSize, "malloc(%d): %s", n,
+                strerror (n));
+        }
+        else
+            perror ("malloc(argv)");
+        return (-1);
     }
     memset (argv, 0, P);
 
@@ -108,42 +109,42 @@
     sprintf (acFormat, "%%s %%%dc", N - 1);
     strcpy (pcStr, p_pcCmdLine);
     for (argc = 0;;) {
-	memset (pcStr2, 0, N);
-	n = sscanf (pcStr, acFormat, pcStr1, pcStr2);
-	if (n <= 0)
-	    break;
-	argv[argc] = (char *) malloc (strlen (pcStr1) + 1);
-	if (!(argv[argc])) {
-	    if (pcError) {
-		n = errno;
-		snprintf (pcError, BufSafeSize, "malloc(%d): %s", n,
-			  strerror (n));
-	    }
-	    else
-		perror ("malloc(argv[i])");
-	    free (pcStr), free (pcStr1), free (pcStr2);
-	    while (argc-- > 0)
-		free (argv[argc]);
-	    free (argv);
-	    return (-1);
-	}
-	strcpy (argv[argc++], pcStr1);
-	if (n <= 1)
-	    break;
-	strcpy (pcStr, pcStr2);
+        memset (pcStr2, 0, N);
+        n = sscanf (pcStr, acFormat, pcStr1, pcStr2);
+        if (n <= 0)
+            break;
+        argv[argc] = (char *) malloc (strlen (pcStr1) + 1);
+        if (!(argv[argc])) {
+            if (pcError) {
+                n = errno;
+                snprintf (pcError, BufSafeSize, "malloc(%d): %s", n,
+                    strerror (n));
+            }
+            else
+                perror ("malloc(argv[i])");
+            free (pcStr), free (pcStr1), free (pcStr2);
+            while (argc-- > 0)
+                free (argv[argc]);
+            free (argv);
+            return (-1);
+        }
+        strcpy (argv[argc++], pcStr1);
+        if (n <= 1)
+            break;
+        strcpy (pcStr, pcStr2);
     }
     free (pcStr), free (pcStr1), free (pcStr2);
 
     *p_pppcArgv = argv;
     if (piArgc)
-	*piArgc = argc;
+        *piArgc = argc;
     return (0);
-}				// ParseCmdline()
+}// ParseCmdline()
 
 
 /**********************************************************************/
 int genmon_Spawn (char *const argv[], char *const p_pcOutput,
-		  const size_t p_BufferSize, const int wait)
+    const size_t p_BufferSize, const int wait)
 /**********************************************************************/
  /* Spawn a command and capture its output */
  /* Return 0 on success, otherwise copy stderr into the output string and
@@ -161,88 +162,87 @@
     int             i, j, k;
 
     if (p_BufferSize <= 0) {
-	fprintf (stderr, "Spawn() error: Wrong buffer size!\n");
-	return (-1);
+        fprintf (stderr, "Spawn() error: Wrong buffer size!\n");
+        return (-1);
     }
     memset (p_pcOutput, 0, p_BufferSize);
     if (!(*argv)) {
-	strncpy (p_pcOutput, "Spawn() error: No parameters passed!",
-		 BufSafeSize);
-	return (-1);
+        strncpy (p_pcOutput, "Spawn() error: No parameters passed!",
+            BufSafeSize);
+        return (-1);
     }
     for (i = 0; i < OUT_ERR; i++)
-	pipe (aaiPipe[i]);
+        pipe (aaiPipe[i]);
     switch (pid = fork ()) {
-	case -1:
-	    i = errno;
-	    snprintf (p_pcOutput, BufSafeSize, "fork(%d): %s", i,
-		      strerror (i));
-	    for (i = 0; i < OUT_ERR; i++)
-		for (j = 0; j < RD_WR; j++)
-		    close (aaiPipe[i][j]);
-	    return (-1);
-	case 0:
-	    /* Redirect stdout/stderr to associated pipe's write-ends */
-	    for (i = 0; i < OUT_ERR; i++) {
-		j = i + 1;	// stdout/stderr file descriptor
-		close (j);
-		k = dup2 (aaiPipe[i][WR], j);
-		if (k != j) {
-		    perror ("dup2()");
-		    exit (-1);
-		}
-	    }
-
-	    /* Execute the given command */
-	    execvp (argv[0], argv);
-	    perror (argv[0]);
-	    exit (-1);
+        case -1:
+            i = errno;
+            snprintf (p_pcOutput, BufSafeSize, "fork(%d): %s", i,
+                strerror (i));
+            for (i = 0; i < OUT_ERR; i++)
+                for (j = 0; j < RD_WR; j++)
+                    close (aaiPipe[i][j]);
+            return (-1);
+        case 0:
+            /* Redirect stdout/stderr to associated pipe's write-ends */
+            for (i = 0; i < OUT_ERR; i++) {
+                j = i + 1; // stdout/stderr file descriptor
+                close (j);
+                k = dup2 (aaiPipe[i][WR], j);
+                if (k != j) {
+                    perror ("dup2()");
+                    exit (-1);
+                }
+            }
+        /* Execute the given command */
+        execvp (argv[0], argv);
+        perror (argv[0]);
+        exit (-1);
     }
 
     /* Wait for child completion */
     if (wait == 1)
     {
-    	status = waitpid (pid, 0, 0);
-    	if (status == -1) {
-	i = errno;
-	snprintf (p_pcOutput, BufSafeSize, "waitpid(%d): %s", i,
-		  strerror (i));
-	fError = 1;
-	goto End;
-    	}
+        status = waitpid (pid, 0, 0);
+        if (status == -1) {
+            i = errno;
+            snprintf (p_pcOutput, BufSafeSize, "waitpid(%d): %s", i,
+                strerror (i));
+            fError = 1;
+            goto End;
+        }
 
-      /* Read stdout/stderr pipes' read-ends */
-      for (i = 0; i < OUT_ERR; i++) {
-  	aoPoll[i].fd = aaiPipe[i][RD];
-	  aoPoll[i].events = POLLIN;
-	  aoPoll[i].revents = 0;
-      }
-      poll (aoPoll, OUT_ERR, ~0);
-      for (i = 0; i < OUT_ERR; i++)
-	  if (aoPoll[i].revents & POLLIN)
-	      break;
-      if (i < OUT_ERR)
-	  read (aaiPipe[i][RD], p_pcOutput, BufSafeSize);
-      fError = (i != OUT);
+        /* Read stdout/stderr pipes' read-ends */
+        for (i = 0; i < OUT_ERR; i++) {
+            aoPoll[i].fd = aaiPipe[i][RD];
+            aoPoll[i].events = POLLIN;
+            aoPoll[i].revents = 0;
+        }
+        poll (aoPoll, OUT_ERR, ~0);
+        for (i = 0; i < OUT_ERR; i++)
+            if (aoPoll[i].revents & POLLIN)
+                break;
+        if (i < OUT_ERR)
+            read (aaiPipe[i][RD], p_pcOutput, BufSafeSize);
+        fError = (i != OUT);
 
-      /* Remove trailing carriage return if any */
-      if (p_pcOutput[(i = strlen (p_pcOutput) - 1)] == '\n')
-  	p_pcOutput[i] = 0;
+        /* Remove trailing carriage return if any */
+        if (p_pcOutput[(i = strlen (p_pcOutput) - 1)] == '\n')
+            p_pcOutput[i] = 0;
     }
 
-  End:
+    End:
     /* Close created pipes */
     for (i = 0; i < OUT_ERR; i++)
-	for (j = 0; j < RD_WR; j++)
-	    close (aaiPipe[i][j]);
+        for (j = 0; j < RD_WR; j++)
+            close (aaiPipe[i][j]);
 
     return (-fError);
-}				// Spawn()
+}// Spawn()
 
 
 /**********************************************************************/
 int genmon_SpawnCmd (const char *const p_pcCmdLine, char *const p_pcOutput,
-		     const size_t p_BufferSize, const int wait)
+    const size_t p_BufferSize, const int wait)
 /**********************************************************************/
  /* Spawn a command and capture its output */
  /* Return 0 on success, otherwise copy stderr into the output string and
@@ -257,40 +257,16 @@
     
     /* Split the commandline into an argv array */
     status = ParseCmdline (p_pcCmdLine, &argv, &argc,
-			   p_pcOutput, p_BufferSize);
+        p_pcOutput, p_BufferSize);
     if (status == -1)
-	/* Memory allocation problem */
-	return (-1);
+        /* Memory allocation problem */
+        return (-1);
 
     /* Spawn the command and free allocated memory */
     status = genmon_Spawn (argv, p_pcOutput, p_BufferSize, wait);
     while (argc-- > 0)
-	free (argv[argc]);
+        free (argv[argc]);
     free (argv);
     return (status);
-}				// SpawnCmd()
+}// SpawnCmd()
 
-
-	/**************************************************************/
-
-/*
-$Log: cmdspawn.c,v $
-Revision 1.4  2004/11/01 00:54:11  rogerms
-*** empty log message ***
-
-Revision 1.4  2004/10/28 23:39:29  RogerSeguin
-Fixed memory allocation bug
-
-Revision 1.3  2004/10/27 09:57:22  RogerSeguin
-Moved string-to-array commandline translation code into a separate function
-
-Revision 1.1.1.1  2004/09/09 13:35:51  rogerms
-V1.0
-
-Revision 1.2  2004/08/28 13:33:27  RogerSeguin
-Better processing
-
-Revision 1.1  2004/08/27 23:17:19  RogerSeguin
-Initial revision
-
-*/

Modified: xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.h
===================================================================
--- xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.h	2006-10-10 09:38:18 UTC (rev 2097)
+++ xfce4-genmon-plugin/trunk/panel-plugin/cmdspawn.h	2006-10-10 11:23:21 UTC (rev 2098)
@@ -1,8 +1,8 @@
 /*
  *  Generic Monitor plugin for the Xfce4 panel
- *  Spawn - Spawn a process and capture its output
+ *  Header file to spawn a process and capture its output
  *  Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
- *  					<http://rmlx.dyndns.org>
+ *                                  <http://rmlx.dyndns.org>
  *  Copyright (c) 2006 Julien Devemy <jujucece at gmail.com>
  *  
  *  This library is free software; you can redistribute it and/or
@@ -31,33 +31,20 @@
 #include <unistd.h>
 #include <inttypes.h>
 
-
-
 #ifdef __cplusplus
-extern          "C" {
+extern "C" {
 #endif
-    int             genmon_Spawn (char *const argv[],
-				  char *const StdOutCapture,
-				  const size_t StdOutSize, const int wait);
-    int             genmon_SpawnCmd (const char *const cmdline,
-				     char *const StdOutCapture,
-				     const size_t StdOutSize, const int wait);
+    int genmon_Spawn (char *const argv[],
+        char *const StdOutCapture,
+        const size_t StdOutSize, const int wait);
+    int genmon_SpawnCmd (const char *const cmdline,
+        char *const StdOutCapture,
+        const size_t StdOutSize, const int wait);
     /* Spawn the given command and capture its output (stdout) */
     /* Return 0 on success, otherwise copy stderr into the output string
        and return -1 */
 #ifdef __cplusplus
-}				/* extern "C" */
+}/* extern "C" */
 #endif
-/*
-$Log: cmdspawn.h,v $
-Revision 1.1.1.2  2004/11/01 00:22:46  rogerms
-*** empty log message ***
 
-Revision 1.1.1.1  2004/09/09 13:35:51  rogerms
-V1.0
-
-Revision 1.1  2004/08/27 23:16:48  RogerSeguin
-Initial revision
-
-*/
-#endif				/* _cmdspawn_h */
+#endif/* _cmdspawn_h */

Modified: xfce4-genmon-plugin/trunk/panel-plugin/config_gui.c
===================================================================
--- xfce4-genmon-plugin/trunk/panel-plugin/config_gui.c	2006-10-10 09:38:18 UTC (rev 2097)
+++ xfce4-genmon-plugin/trunk/panel-plugin/config_gui.c	2006-10-10 11:23:21 UTC (rev 2098)
@@ -1,7 +1,8 @@
 /*
  *  Generic Monitor plugin for the Xfce4 panel
+ *  Construct the configure GUI
  *  Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
- *  					<http://rmlx.dyndns.org>
+ *                                  <http://rmlx.dyndns.org>
  *  
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -31,15 +32,15 @@
 #include <libxfce4panel/xfce-panel-plugin.h>
 
 
-#define COPYVAL(var, field)	((var)->field = field)
+#define COPYVAL(var, field)    ((var)->field = field)
 
 
-	/**** GUI initially created using glade-2 ****/
+/**** GUI initially created using glade-2 ****/
 
-	/* Use the gtk_button_new_with_mnemonic() function for text-based
-	   push buttons */
-	/* Use "#define gtk_button_new_with_mnemonic(x) gtk_button_new()"
-	   for color-filled buttons */
+/* Use the gtk_button_new_with_mnemonic() function for text-based
+   push buttons */
+/* Use "#define gtk_button_new_with_mnemonic(x) gtk_button_new()"
+   for color-filled buttons */
 
 #define gtk_button_new_with_mnemonic(x) gtk_button_new()
 
@@ -51,7 +52,7 @@
   g_object_set_data (G_OBJECT (component), name, widget)
 
 int genmon_CreateConfigGUI (GtkWidget *vbox1,
-			    struct gui_t *p_poGUI)
+    struct gui_t *p_poGUI)
 {
     GtkWidget      *wPB_About;
     GtkWidget      *alignment2;
@@ -94,9 +95,8 @@
     gtk_widget_show (hbox3);
     gtk_container_add (GTK_CONTAINER (alignment2), hbox3);
 
-    image1 =
-	gtk_image_new_from_stock ("gnome-stock-about",
-				  GTK_ICON_SIZE_BUTTON);
+    image1 = gtk_image_new_from_stock ("gnome-stock-about",
+        GTK_ICON_SIZE_BUTTON);
     gtk_widget_show (image1);
     gtk_box_pack_start (GTK_BOX (hbox3), image1, FALSE, FALSE, 0);
 
@@ -116,66 +116,64 @@
     label1 = gtk_label_new (_("Command"));
     gtk_widget_show (label1);
     gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 0, 1,
-		      (GtkAttachOptions) (GTK_FILL),
-		      (GtkAttachOptions) (0), 0, 0);
+        (GtkAttachOptions) (GTK_FILL),
+        (GtkAttachOptions) (0), 0, 0);
     gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
     gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
 
     wTF_Cmd = gtk_entry_new ();
     gtk_widget_show (wTF_Cmd);
     gtk_table_attach (GTK_TABLE (table1), wTF_Cmd, 1, 2, 0, 1,
-		      (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-		      (GtkAttachOptions) (0), 0, 0);
+        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+        (GtkAttachOptions) (0), 0, 0);
     gtk_tooltips_set_tip (tooltips, wTF_Cmd,
-			  _
-			  ("Input the shell command to spawn, then press <Enter>"),
-			  NULL);
+        _("Input the shell command to spawn, then press <Enter>"),
+        NULL);
     gtk_entry_set_max_length (GTK_ENTRY (wTF_Cmd), 128);
 
     eventbox1 = gtk_event_box_new ();
     gtk_widget_show (eventbox1);
     gtk_table_attach (GTK_TABLE (table1), eventbox1, 1, 2, 2, 3,
-		      (GtkAttachOptions) (GTK_FILL),
-		      (GtkAttachOptions) (GTK_FILL), 0, 0);
+        (GtkAttachOptions) (GTK_FILL),
+        (GtkAttachOptions) (GTK_FILL), 0, 0);
 
     alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
     gtk_widget_show (alignment1);
     gtk_container_add (GTK_CONTAINER (eventbox1), alignment1);
 
     wSc_Period_adj = gtk_adjustment_new (15, 1, 3600, 1, 1, 10);
-    wSc_Period =
-	gtk_spin_button_new (GTK_ADJUSTMENT (wSc_Period_adj), 1, 0);
+    wSc_Period = gtk_spin_button_new (GTK_ADJUSTMENT (wSc_Period_adj), 1, 0);
     gtk_widget_show (wSc_Period);
     gtk_container_add (GTK_CONTAINER (alignment1), wSc_Period);
     gtk_tooltips_set_tip (tooltips, wSc_Period,
-			  _("Interval between 2 consecutive spawns"),
-			  NULL);
+        _("Interval between 2 consecutive spawns"),
+        NULL);
     gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (wSc_Period), TRUE);
 
     label2 = gtk_label_new (_("Period (s) "));
     gtk_widget_show (label2);
     gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 2, 3,
-		      (GtkAttachOptions) (GTK_FILL),
-		      (GtkAttachOptions) (0), 0, 0);
+        (GtkAttachOptions) (GTK_FILL),
+        (GtkAttachOptions) (0), 0, 0);
     gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);
     gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
 
     wTB_Title = gtk_check_button_new_with_mnemonic (_("Label"));
     gtk_widget_show (wTB_Title);
     gtk_table_attach (GTK_TABLE (table1), wTB_Title, 0, 1, 1, 2,
-		      (GtkAttachOptions) (GTK_FILL),
-		      (GtkAttachOptions) (0), 0, 0);
+        (GtkAttachOptions) (GTK_FILL),
+        (GtkAttachOptions) (0), 0, 0);
     gtk_tooltips_set_tip (tooltips, wTB_Title, _("Tick to display label"),
-			  NULL);
+        NULL);
 
     wTF_Title = gtk_entry_new ();
     gtk_widget_show (wTF_Title);
     gtk_table_attach (GTK_TABLE (table1), wTF_Title, 1, 2, 1, 2,
-		      (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
-		      (GtkAttachOptions) (0), 0, 0);
+        (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
+        (GtkAttachOptions) (0), 0, 0);
     gtk_tooltips_set_tip (tooltips, wTF_Title,
-			  _("Input the plugin label, then press <Enter>"),
-			  NULL);
+        _("Input the plugin label, then press <Enter>"),
+        NULL);
     gtk_entry_set_max_length (GTK_ENTRY (wTF_Title), 16);
     gtk_entry_set_text (GTK_ENTRY (wTF_Title), _("(genmon)"));
 
@@ -187,7 +185,7 @@
     gtk_widget_show (wPB_Font);
     gtk_box_pack_start (GTK_BOX (vbox1), wPB_Font, FALSE, FALSE, 0);
     gtk_tooltips_set_tip (tooltips, wPB_Font, _("Press to change font"),
-			  NULL);
+        NULL);
 
     alignment3 = gtk_alignment_new (0.5, 0.5, 0, 0);
     gtk_widget_show (alignment3);
@@ -197,8 +195,7 @@
     gtk_widget_show (hbox4);
     gtk_container_add (GTK_CONTAINER (alignment3), hbox4);
 
-    image2 =
-	gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_BUTTON);
+    image2 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_BUTTON);
     gtk_widget_show (image2);
     gtk_box_pack_start (GTK_BOX (hbox4), image2, FALSE, FALSE, 0);
 
@@ -208,29 +205,13 @@
     gtk_label_set_justify (GTK_LABEL (label11), GTK_JUSTIFY_LEFT);
 
     if (p_poGUI) {
-	COPYVAL (p_poGUI, wPB_About);
-	COPYVAL (p_poGUI, wTF_Cmd);
-	COPYVAL (p_poGUI, wTB_Title);
-	COPYVAL (p_poGUI, wTF_Title);
-	COPYVAL (p_poGUI, wSc_Period);
-	COPYVAL (p_poGUI, wPB_Font);
+        COPYVAL (p_poGUI, wPB_About);
+        COPYVAL (p_poGUI, wTF_Cmd);
+        COPYVAL (p_poGUI, wTB_Title);
+        COPYVAL (p_poGUI, wTF_Title);
+        COPYVAL (p_poGUI, wSc_Period);
+        COPYVAL (p_poGUI, wPB_Font);
     }
     return (0);
-}				/* CreateConfigGUI() */
+}/* CreateConfigGUI() */
 
-
-/*
-$Log: config_gui.c,v $
-Revision 1.1.1.2  2004/11/01 00:22:46  rogerms
-*** empty log message ***
-
-Revision 1.1.1.1  2004/09/09 13:35:51  rogerms
-V1.0
-
-Revision 1.2  2004/08/28 09:53:28  RogerSeguin
-Added font selector
-
-Revision 1.1  2004/08/27 23:17:29  RogerSeguin
-Initial revision
-
-*/

Modified: xfce4-genmon-plugin/trunk/panel-plugin/config_gui.h
===================================================================
--- xfce4-genmon-plugin/trunk/panel-plugin/config_gui.h	2006-10-10 09:38:18 UTC (rev 2097)
+++ xfce4-genmon-plugin/trunk/panel-plugin/config_gui.h	2006-10-10 11:23:21 UTC (rev 2098)
@@ -1,7 +1,8 @@
 /*
  *  Generic Monitor plugin for the Xfce4 panel
+ *  Header file to construct the configure GUI
  *  Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
- *  					<http://rmlx.dyndns.org>
+ *                                  <http://rmlx.dyndns.org>
  *  
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -47,27 +48,13 @@
 extern          "C" {
 #endif
 
-    int             genmon_CreateConfigGUI (GtkWidget * ParentWindow,
-					    struct gui_t *gui);
+    int genmon_CreateConfigGUI (GtkWidget * ParentWindow,
+        struct gui_t *gui);
     /* Create configuration/Option GUI */
     /* Return 0 on success, -1 otherwise */
 
 #ifdef __cplusplus
-}				/* extern "C" */
+}/* extern "C" */
 #endif
-/*
-$Log: config_gui.h,v $
-Revision 1.1.1.2  2004/11/01 00:22:46  rogerms
-*** empty log message ***
 
-Revision 1.1.1.1  2004/09/09 13:35:51  rogerms
-V1.0
-
-Revision 1.2  2004/08/28 09:52:17  RogerSeguin
-Added font selector
-
-Revision 1.1  2004/08/27 23:16:58  RogerSeguin
-Initial revision
-
-*/
-#endif				/* _config_gui_h */
+#endif/* _config_gui_h */

Modified: xfce4-genmon-plugin/trunk/panel-plugin/main.c
===================================================================
--- xfce4-genmon-plugin/trunk/panel-plugin/main.c	2006-10-10 09:38:18 UTC (rev 2097)
+++ xfce4-genmon-plugin/trunk/panel-plugin/main.c	2006-10-10 11:23:21 UTC (rev 2098)
@@ -1,7 +1,8 @@
 /*
  *  Generic Monitor plugin for the Xfce4 panel
+ *  Main file for the Genmon plugin
  *  Copyright (c) 2004 Roger Seguin <roger_seguin at msn.com>
- *  					<http://rmlx.dyndns.org>
+ *                                  <http://rmlx.dyndns.org>
  *  Copyright (c) 2006 Julien Devemy <jujucece at gmail.com>
  *  
  *  This library is free software; you can redistribute it and/or
@@ -43,15 +44,15 @@
 #include <errno.h>
 
 
-#define PLUGIN_NAME	"GenMon"
-#define BORDER          2
+#define PLUGIN_NAME    "GenMon"
+#define BORDER    2
 
 
 typedef GtkWidget *Widget_t;
 
 typedef struct param_t {
     /* Configurable parameters */
-    char            acCmd[128];	/* Commandline to spawn */
+    char            acCmd[128]; /* Commandline to spawn */
     int             fTitleDisplayed;
     char            acTitle[16];
     uint32_t        iPeriod_ms;
@@ -60,7 +61,7 @@
 
 typedef struct conf_t {
     Widget_t        wTopLevel;
-    struct gui_t    oGUI;	/* Configuration/option dialog */
+    struct gui_t    oGUI; /* Configuration/option dialog */
     struct param_t  oParam;
 } conf_t;
 
@@ -80,26 +81,25 @@
 
 typedef struct genmon_t {
     XfcePanelPlugin *plugin;
-    unsigned int    iTimerId;	/* Cyclic update */
+    unsigned int    iTimerId; /* Cyclic update */
     struct conf_t   oConf;
-    struct monitor_t
-                    oMonitor;
-    char            acValue[256];	/* Commandline resulting string */
+    struct monitor_t    oMonitor;
+    char            acValue[256]; /* Commandline resulting string */
 } genmon_t;
 
-	/**************************************************************/
+/**************************************************************/
 static void ExecOnClickCmd (Widget_t p_wSc, void *p_pvPlugin)
-	/* Execute the onClick Command */
+/* Execute the onClick Command */
 {
-  struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
-  struct monitor_t *poMonitor = &(poPlugin->oMonitor);
-  char result[256];
+    struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
+    struct monitor_t *poMonitor = &(poPlugin->oMonitor);
+    char result[256];
 
-  genmon_SpawnCmd (poMonitor->onClickCmd, result,
-      sizeof (poMonitor->onClickCmd), 0);
+    genmon_SpawnCmd (poMonitor->onClickCmd, result,
+        sizeof (poMonitor->onClickCmd), 0);
 }
 
-	/**************************************************************/
+/**************************************************************/
 
 static int DisplayCmdOutput (struct genmon_t *p_poPlugin)
  /* Launch the command, get its output and display it in the panel-docked
@@ -114,130 +114,129 @@
     char  *begin;
     char  *end;
     int   newVersion=0;
-    
+
     if (!s_poToolTips)
-      s_poToolTips = gtk_tooltips_new ();
+        s_poToolTips = gtk_tooltips_new ();
     status = genmon_SpawnCmd (poConf->acCmd, p_poPlugin->acValue,
-      sizeof (p_poPlugin->acValue), 1);
+        sizeof (p_poPlugin->acValue), 1);
     if (status == -1)
-      return (-1);
-    
+        return (-1);
+
     /* Test if the result is an Image or a Text */
     begin=strstr(p_poPlugin->acValue, "<img>");
     end=strstr(p_poPlugin->acValue, "</img>");
     if ((begin != NULL) && (end != NULL) && (begin < end))
     {
-      char  buf[256];
-      /* Get the image path */
-      strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
-      buf[end-begin-5*sizeof(char)]='\0';
-
-      gtk_image_set_from_file (GTK_IMAGE (poMonitor->wImage), buf);
-      gtk_image_set_from_file (GTK_IMAGE (poMonitor->wImgButton), buf);
-      
-      /* Test if the result has a clickable Image (button) */
-      begin=strstr(p_poPlugin->acValue, "<click>");
-      end=strstr(p_poPlugin->acValue, "</click>");
-      if ((begin != NULL) && (end != NULL) && (begin < end))
-      {
         char  buf[256];
-        /* Get the command path */
-        strncpy(buf, begin+7*sizeof(char), end-begin-7*sizeof(char));
-        buf[end-begin-7*sizeof(char)]='\0';
+        /* Get the image path */
+        strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
+        buf[end-begin-5*sizeof(char)]='\0';
 
-        strcpy(poMonitor->onClickCmd, buf);
-        
-        gtk_widget_show (poMonitor->wButton);
-        gtk_widget_show (poMonitor->wImgButton);
-        gtk_widget_hide (poMonitor->wImage);
-      }
-      else
-      {
-        gtk_widget_hide (poMonitor->wButton);
-        gtk_widget_hide (poMonitor->wImgButton);
-        gtk_widget_show (poMonitor->wImage);
-      }
+        gtk_image_set_from_file (GTK_IMAGE (poMonitor->wImage), buf);
+        gtk_image_set_from_file (GTK_IMAGE (poMonitor->wImgButton), buf);
 
-      newVersion=1;
+        /* Test if the result has a clickable Image (button) */
+        begin=strstr(p_poPlugin->acValue, "<click>");
+        end=strstr(p_poPlugin->acValue, "</click>");
+        if ((begin != NULL) && (end != NULL) && (begin < end))
+        {
+            char  buf[256];
+            /* Get the command path */
+            strncpy(buf, begin+7*sizeof(char), end-begin-7*sizeof(char));
+            buf[end-begin-7*sizeof(char)]='\0';
 
+            strcpy(poMonitor->onClickCmd, buf);
+
+            gtk_widget_show (poMonitor->wButton);
+            gtk_widget_show (poMonitor->wImgButton);
+            gtk_widget_hide (poMonitor->wImage);
+        }
+        else
+        {
+            gtk_widget_hide (poMonitor->wButton);
+            gtk_widget_hide (poMonitor->wImgButton);
+            gtk_widget_show (poMonitor->wImage);
+        }
+
+        newVersion=1;
+
     }
     else
-      gtk_widget_hide (poMonitor->wImage);
+        gtk_widget_hide (poMonitor->wImage);
 
-    
     /* Test if the result is a Text */
     begin=strstr(p_poPlugin->acValue, "<txt>");
     end=strstr(p_poPlugin->acValue, "</txt>");
     if ((begin != NULL) && (end != NULL) && (begin < end))
     {
-      char  buf[256];
-      /* Get the text */
-      strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
-      buf[end-begin-5*sizeof(char)]='\0';
-      gtk_label_set_text (GTK_LABEL (poMonitor->wValue), buf);
-      gtk_widget_show (poMonitor->wValue);
+        char  buf[256];
+        /* Get the text */
+        strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
+        buf[end-begin-5*sizeof(char)]='\0';
+        gtk_label_set_text (GTK_LABEL (poMonitor->wValue), buf);
+        gtk_widget_show (poMonitor->wValue);
 
-      newVersion=1;
+        newVersion=1;
 
     }
     else
-      gtk_widget_hide (poMonitor->wValue);
+        gtk_widget_hide (poMonitor->wValue);
 
     /* Test if the result is a Bar */
     begin=strstr(p_poPlugin->acValue, "<bar>");
     end=strstr(p_poPlugin->acValue, "</bar>");
     if ((begin != NULL) && (end != NULL) && (begin < end))
     {
-      char  buf[256];
-      int value;
-      /* Get the text */
-      strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
-      buf[end-begin-5*sizeof(char)]='\0';
-      value=atoi(buf);
-      gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(poMonitor->wBar), (float)value/100.0);
-      gtk_widget_show (poMonitor->wBar);
+        char  buf[256];
+        int value;
+        /* Get the text */
+        strncpy(buf, begin+5*sizeof(char), end-begin-5*sizeof(char));
+        buf[end-begin-5*sizeof(char)]='\0';
+        value=atoi(buf);
+        gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(poMonitor->wBar), (float)value/100.0);
+        gtk_widget_show (poMonitor->wBar);
 
-      newVersion=1;
+        newVersion=1;
 
     }
     else
-      gtk_widget_hide (poMonitor->wBar);
-    
+        gtk_widget_hide (poMonitor->wBar);
+
     if (newVersion == 0)
-    { 
-      gtk_widget_show (poMonitor->wValue);
-      gtk_label_set_text (GTK_LABEL (poMonitor->wValue),
-        p_poPlugin->acValue);
+    {
+        gtk_widget_show (poMonitor->wValue);
+        gtk_label_set_text (GTK_LABEL (poMonitor->wValue),
+            p_poPlugin->acValue);
     }
-    
+
     /* Test if a ToolTip is given */
     begin=strstr(p_poPlugin->acValue, "<tool>");
     end=strstr(p_poPlugin->acValue, "</tool>");
     if ((begin != NULL) && (end != NULL) && (begin < end))
     {
-      strncpy(acToolTips, begin+6, end-begin-6);
-      acToolTips[end-begin-6]='\0';
+        strncpy(acToolTips, begin+6, end-begin-6);
+        acToolTips[end-begin-6]='\0';
     }
     else
-      sprintf (acToolTips, "%s\n"
-        "----------------\n"
-        "%s\n"
-        "Period (s): %d", poConf->acTitle, poConf->acCmd,
-        poConf->iPeriod_ms / 1000);
+        sprintf (acToolTips, "%s\n"
+            "----------------\n"
+            "%s\n"
+            "Period (s): %d", poConf->acTitle, poConf->acCmd,
+            poConf->iPeriod_ms / 1000);
 
     gtk_tooltips_set_tip (s_poToolTips, GTK_WIDGET (poMonitor->wEventBox),
-      acToolTips, 0);
+        acToolTips, 0);
 
     return (0);
-   
-}				/* DisplayCmdOutput() */
 
-	/**************************************************************/
+}/* DisplayCmdOutput() */
 
+/**************************************************************/
+
 static gboolean SetTimer (void *p_pvPlugin)
-	/* Recurrently update the panel-docked monitor through a timer */
-  /* Warning : should not be called directly (except the 1st time) */
-  /* To avoid multiple timers */
+/* Recurrently update the panel-docked monitor through a timer */
+/* Warning : should not be called directly (except the 1st time) */
+/* To avoid multiple timers */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -247,23 +246,23 @@
     if (poPlugin->iTimerId == 0)
     {
         poPlugin->iTimerId = g_timeout_add (poConf->iPeriod_ms,
-	        			    (GSourceFunc) SetTimer, poPlugin);
+            (GSourceFunc) SetTimer, poPlugin);
         return FALSE;
     }
 
     return TRUE;
-}				/* SetTimer() */
+}/* SetTimer() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static genmon_t *genmon_create_control (XfcePanelPlugin *plugin)
-	/* Plugin API */
-	/* Create the plugin */
+/* Plugin API */
+/* Create the plugin */
 {
     struct genmon_t *poPlugin;
     struct param_t *poConf;
     struct monitor_t *poMonitor;
-	 int size = xfce_panel_plugin_get_size (plugin);
+    int size = xfce_panel_plugin_get_size (plugin);
 
     poPlugin = g_new (genmon_t, 1);
     memset (poPlugin, 0, sizeof (genmon_t));
@@ -287,54 +286,53 @@
 
     xfce_panel_plugin_add_action_widget (plugin, poMonitor->wEventBox);
     
-    if (xfce_panel_plugin_get_orientation (plugin) == 
-            GTK_ORIENTATION_HORIZONTAL)
-	poMonitor->wBox = gtk_hbox_new (FALSE, 0);
+    if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
+        poMonitor->wBox = gtk_hbox_new (FALSE, 0);
     else
-	poMonitor->wBox = gtk_vbox_new (FALSE, 0);
+        poMonitor->wBox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (poMonitor->wBox);
     gtk_container_set_border_width (GTK_CONTAINER
-				    (poMonitor->wBox), BORDER);
+        (poMonitor->wBox), BORDER);
     gtk_container_add (GTK_CONTAINER (poMonitor->wEventBox),
-		       poMonitor->wBox);
+        poMonitor->wBox);
 
     poMonitor->wTitle = gtk_label_new (poConf->acTitle);
     if (poConf->fTitleDisplayed)
-	gtk_widget_show (poMonitor->wTitle);
+        gtk_widget_show (poMonitor->wTitle);
     gtk_box_pack_start (GTK_BOX (poMonitor->wBox),
-			GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, 0);
 
     /* Create a Box to put image and text 
-	  * If panel size less < 25 place icon near the text
-	  */
-	 if (size < 25)
-	 	poMonitor->wImgBox = gtk_hbox_new (FALSE, 0);
-	 else
-	 	poMonitor->wImgBox = gtk_vbox_new (FALSE, 0);
+     * If panel size less < 25 place icon near the text
+     */
+    if (size < 25)
+        poMonitor->wImgBox = gtk_hbox_new (FALSE, 0);
+    else
+        poMonitor->wImgBox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (poMonitor->wImgBox);
     gtk_container_set_border_width (GTK_CONTAINER
-      (poMonitor->wImgBox), 0);
+        (poMonitor->wImgBox), 0);
     gtk_container_add (GTK_CONTAINER (poMonitor->wBox),
-      poMonitor->wImgBox);
- 
+        poMonitor->wImgBox);
+
     /* Add Image */   
     poMonitor->wImage = gtk_image_new ();
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wImage), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wImage), TRUE, FALSE, 0);
 
     /* Add Button */ 
     /*
-	  * xfce_create_panel_button() look better instead of gtk_button_new ()
-	  * poMonitor->wButton = gtk_button_new ();
-	 */
-	poMonitor->wButton = (Widget_t) xfce_create_panel_button ();
+     * xfce_create_panel_button() look better instead of gtk_button_new ()
+     * poMonitor->wButton = gtk_button_new ();
+     */
+    poMonitor->wButton = (Widget_t) xfce_create_panel_button ();
     gtk_widget_set_size_request (poMonitor->wButton, size, size);
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wButton), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wButton), TRUE, FALSE, 0);
 
     /* Add Image Button*/   
     poMonitor->wImgButton = gtk_image_new ();
-	 gtk_widget_set_size_request (poMonitor->wImgButton, size-1, size-1);
+    gtk_widget_set_size_request (poMonitor->wImgButton, size-1, size-1);
     gtk_container_add (GTK_CONTAINER (poMonitor->wButton), poMonitor->wImgButton);
     gtk_container_set_border_width (GTK_CONTAINER (poMonitor->wButton), 0);
 
@@ -342,34 +340,34 @@
     poMonitor->wValue = gtk_label_new ("");
     gtk_widget_show (poMonitor->wValue);
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wValue), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wValue), TRUE, FALSE, 0);
 
     /* Add Bar */   
     poMonitor->wBar = gtk_progress_bar_new();
     gtk_box_pack_start (GTK_BOX (poMonitor->wBox),
-      GTK_WIDGET (poMonitor->wBar), FALSE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wBar), FALSE, FALSE, 0);
     /*gtk_widget_show (poMonitor->wBar);*/
     if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
-      gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_BOTTOM_TO_TOP);
+        gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_BOTTOM_TO_TOP);
     else
-      gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_LEFT_TO_RIGHT);
+        gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_LEFT_TO_RIGHT);
 
     return poPlugin;
-}				/* genmon_create_control() */
+}/* genmon_create_control() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void genmon_free (XfcePanelPlugin *plugin, genmon_t *poPlugin)
-	/* Plugin API */
+/* Plugin API */
 {
     TRACE ("genmon_free()\n");
 
     if (poPlugin->iTimerId)
-	g_source_remove (poPlugin->iTimerId);
+        g_source_remove (poPlugin->iTimerId);
     g_free (poPlugin);
-}				/* genmon_free() */
+}/* genmon_free() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static int SetMonitorFont (void *p_pvPlugin)
 {
@@ -379,47 +377,47 @@
     const char     *pcFont = poConf->acFont;
     PangoFontDescription *poFont;
 
-    if (*pcFont == '(')		/* Default font */
-	return (1);
+    if (*pcFont == '(') /* Default font */
+        return (1);
     poFont = pango_font_description_from_string (poConf->acFont);
     if (!poFont)
-	return (-1);
+        return (-1);
     gtk_widget_modify_font (poMonitor->wTitle, poFont);
     gtk_widget_modify_font (poMonitor->wValue, poFont);
     return (0);
-}				/* SetMonitorFont() */
+}/* SetMonitorFont() */
 
-	/**************************************************************/
+/**************************************************************/
 
-	/* Configuration Keywords */
-#define CONF_USE_LABEL		"UseLabel"
-#define CONF_LABEL_TEXT		"Text"
-#define CONF_CMD		"Command"
-#define CONF_UPDATE_PERIOD	"UpdatePeriod"
-#define CONF_FONT		"Font"
+/* Configuration Keywords */
+#define CONF_USE_LABEL    "UseLabel"
+#define CONF_LABEL_TEXT    "Text"
+#define CONF_CMD    "Command"
+#define CONF_UPDATE_PERIOD    "UpdatePeriod"
+#define CONF_FONT    "Font"
 
-	/**************************************************************/
+/**************************************************************/
 
 static void genmon_read_config (XfcePanelPlugin *plugin, genmon_t *poPlugin)
-	/* Plugin API */
-	/* Executed when the panel is started - Read the configuration
-	   previously stored in xml file */
+/* Plugin API */
+/* Executed when the panel is started - Read the configuration
+   previously stored in xml file */
 {
     struct param_t *poConf = &(poPlugin->oConf.oParam);
     struct monitor_t *poMonitor = &(poPlugin->oMonitor);
     const char           *pc;
     char           *file;
     XfceRc         *rc;
-    
+
     if (!(file = xfce_panel_plugin_lookup_rc_file (plugin)))
         return;
-    
+
     rc = xfce_rc_simple_open (file, TRUE);
     g_free (file);
 
     if (!rc)
         return;
-    
+
     if ((pc = xfce_rc_read_entry (rc, (CONF_CMD), NULL))) {
         memset (poConf->acCmd, 0, sizeof (poConf->acCmd));
         strncpy (poConf->acCmd, pc, sizeof (poConf->acCmd) - 1);
@@ -447,13 +445,13 @@
     }
 
     xfce_rc_close (rc);
-}				/* genmon_read_config() */
+}/* genmon_read_config() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void genmon_write_config (XfcePanelPlugin *plugin, genmon_t *poPlugin)
-	/* Plugin API */
-	/* Write plugin configuration into xml file */
+/* Plugin API */
+/* Write plugin configuration into xml file */
 {
     struct param_t *poConf = &(poPlugin->oConf.oParam);
     XfceRc *rc;
@@ -481,13 +479,13 @@
     xfce_rc_write_entry (rc, CONF_FONT, poConf->acFont);
 
     xfce_rc_close (rc);
-}				/* genmon_write_config() */
+}/* genmon_write_config() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void SetCmd (Widget_t p_wTF, void *p_pvPlugin)
-	/* GUI callback setting the command to be spawn, whose output will 
-	   be displayed using the panel-docked monitor */
+/* GUI callback setting the command to be spawn, whose output will 
+   be displayed using the panel-docked monitor */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -495,12 +493,12 @@
 
     memset (poConf->acCmd, 0, sizeof (poConf->acCmd));
     strncpy (poConf->acCmd, pcCmd, sizeof (poConf->acCmd) - 1);
-}				/* SetCmd() */
+}/* SetCmd() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void ToggleTitle (Widget_t p_w, void *p_pvPlugin)
-	/* GUI callback turning on/off the monitor bar legend */
+/* GUI callback turning on/off the monitor bar legend */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -508,19 +506,19 @@
     struct monitor_t *poMonitor = &(poPlugin->oMonitor);
 
     poConf->fTitleDisplayed =
-	gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (p_w));
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (p_w));
     gtk_widget_set_sensitive (GTK_WIDGET (poGUI->wTF_Title),
-			      poConf->fTitleDisplayed);
+        poConf->fTitleDisplayed);
     if (poConf->fTitleDisplayed)
-	gtk_widget_show (GTK_WIDGET (poMonitor->wTitle));
+        gtk_widget_show (GTK_WIDGET (poMonitor->wTitle));
     else
-	gtk_widget_hide (GTK_WIDGET (poMonitor->wTitle));
-}				/* ToggleTitle() */
+        gtk_widget_hide (GTK_WIDGET (poMonitor->wTitle));
+}/* ToggleTitle() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void SetLabel (Widget_t p_wTF, void *p_pvPlugin)
-	/* GUI callback setting the legend of the monitor */
+/* GUI callback setting the legend of the monitor */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -530,12 +528,12 @@
     memset (poConf->acTitle, 0, sizeof (poConf->acTitle));
     strncpy (poConf->acTitle, acTitle, sizeof (poConf->acTitle) - 1);
     gtk_label_set_text (GTK_LABEL (poMonitor->wTitle), poConf->acTitle);
-}				/* SetLabel() */
+}/* SetLabel() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void SetPeriod (Widget_t p_wSc, void *p_pvPlugin)
-	/* Set the update period - To be used by the timer */
+/* Set the update period - To be used by the timer */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -544,12 +542,12 @@
     TRACE ("SetPeriod()\n");
     r = gtk_spin_button_get_value (GTK_SPIN_BUTTON (p_wSc));
     poConf->iPeriod_ms = (r * 1000);
-}				/* SetPeriod() */
+}/* SetPeriod() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void UpdateConf (void *p_pvPlugin)
-	/* Called back when the configuration/options window is closed */
+/* Called back when the configuration/options window is closed */
 {
     struct genmon_t *poPlugin = (genmon_t *) p_pvPlugin;
     struct conf_t  *poConf = &(poPlugin->oConf);
@@ -561,22 +559,22 @@
     SetMonitorFont (poPlugin);
     /* Force to regenerate a timer */
     poPlugin->iTimerId = 0;
-}				/* UpdateConf() */
+}/* UpdateConf() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void About (Widget_t w, void *unused)
-	/* Called back when the About button in clicked */
+/* Called back when the About button in clicked */
 {
     xfce_info (_("%s %s - Generic Monitor\n"
-	       "Cyclically spawns a script/program, captures its output "
-	       "and displays the resulting string in the panel\n\n"
-	       "(c) 2004 Roger Seguin <roger_seguin at msn.com>\n"
-	       "(c) 2006 Julien Devemy <jujucece at gmail.com>"),
-	       PACKAGE, VERSION);
-}				/* About() */
+        "Cyclically spawns a script/program, captures its output "
+        "and displays the resulting string in the panel\n\n"
+        "(c) 2004 Roger Seguin <roger_seguin at msn.com>\n"
+        "(c) 2006 Julien Devemy <jujucece at gmail.com>"),
+        PACKAGE, VERSION);
+}/* About() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void ChooseFont (Widget_t p_wPB, void *p_pvPlugin)
 {
@@ -588,26 +586,26 @@
 
     wDialog = gtk_font_selection_dialog_new (_("Font Selection"));
     gtk_window_set_transient_for (GTK_WINDOW (wDialog),
-				  GTK_WINDOW (poPlugin->oConf.wTopLevel));
-    if (*pcFont != '(')		/* Default font */
-	gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG
-						 (wDialog), pcFont);
+        GTK_WINDOW (poPlugin->oConf.wTopLevel));
+    if (*pcFont != '(') /* Default font */
+        gtk_font_selection_dialog_set_font_name (GTK_FONT_SELECTION_DIALOG
+            (wDialog), pcFont);
     iResponse = gtk_dialog_run (GTK_DIALOG (wDialog));
     if (iResponse == GTK_RESPONSE_OK) {
-	pcFont = gtk_font_selection_dialog_get_font_name
-	    (GTK_FONT_SELECTION_DIALOG (wDialog));
-	if (pcFont && (strlen (pcFont) < sizeof (poConf->acFont) - 1)) {
-	    strcpy (poConf->acFont, pcFont);
-	    gtk_button_set_label (GTK_BUTTON (p_wPB), poConf->acFont);
-	}
+        pcFont = gtk_font_selection_dialog_get_font_name
+            (GTK_FONT_SELECTION_DIALOG (wDialog));
+        if (pcFont && (strlen (pcFont) < sizeof (poConf->acFont) - 1)) {
+            strcpy (poConf->acFont, pcFont);
+            gtk_button_set_label (GTK_BUTTON (p_wPB), poConf->acFont);
+        }
     }
     gtk_widget_destroy (wDialog);
-}				/* ChooseFont() */
+}/* ChooseFont() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void genmon_dialog_response (GtkWidget *dlg, int response, 
-                                    genmon_t *genmon)
+    genmon_t *genmon)
 {
     UpdateConf (genmon);
     gtk_widget_destroy (dlg);
@@ -618,9 +616,9 @@
 }
 
 static void genmon_create_options (XfcePanelPlugin *plugin,
-                                   genmon_t *poPlugin)
-	/* Plugin API */
-	/* Create/pop up the configuration/options GUI */
+    genmon_t *poPlugin)
+/* Plugin API */
+/* Create/pop up the configuration/options GUI */
 {
     GtkWidget *dlg, *header, *vbox;
     struct param_t *poConf = &(poPlugin->oConf.oParam);
@@ -632,73 +630,73 @@
     xfce_panel_plugin_block_menu (plugin);
     
     dlg = gtk_dialog_new_with_buttons (_("Configuration"), 
-                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
-                GTK_DIALOG_DESTROY_WITH_PARENT |
-                GTK_DIALOG_NO_SEPARATOR,
-                GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-                NULL);
-    
+        GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
+        GTK_DIALOG_DESTROY_WITH_PARENT |
+        GTK_DIALOG_NO_SEPARATOR,
+        GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
+        NULL);
+
     g_signal_connect (dlg, "response", G_CALLBACK (genmon_dialog_response),
-                      poPlugin);
+        poPlugin);
 
     gtk_container_set_border_width (GTK_CONTAINER (dlg), 2);
-    
+
     header = xfce_create_header (NULL, _("Generic Monitor"));
     gtk_widget_set_size_request (GTK_BIN (header)->child, -1, 32);
     gtk_container_set_border_width (GTK_CONTAINER (header), BORDER - 2);
     gtk_widget_show (header);
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header,
-                        FALSE, TRUE, 0);
-    
+        FALSE, TRUE, 0);
+
     vbox = gtk_vbox_new(FALSE, BORDER);
     gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2);
     gtk_widget_show(vbox);
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox,
-                        TRUE, TRUE, 0);
-    
+    TRUE, TRUE, 0);
+
     poPlugin->oConf.wTopLevel = dlg;
 
     (void) genmon_CreateConfigGUI (GTK_WIDGET (vbox), poGUI);
 
     g_signal_connect (GTK_WIDGET (poGUI->wPB_About), "clicked",
-		      G_CALLBACK (About), 0);
+        G_CALLBACK (About), 0);
 
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (poGUI->wTB_Title),
-				  poConf->fTitleDisplayed);
+        poConf->fTitleDisplayed);
     gtk_widget_set_sensitive (GTK_WIDGET (poGUI->wTF_Title),
-			      poConf->fTitleDisplayed);
+        poConf->fTitleDisplayed);
     g_signal_connect (GTK_WIDGET (poGUI->wTB_Title), "toggled",
-		      G_CALLBACK (ToggleTitle), poPlugin);
+        G_CALLBACK (ToggleTitle), poPlugin);
 
     gtk_entry_set_text (GTK_ENTRY (poGUI->wTF_Cmd), poConf->acCmd);
     g_signal_connect (GTK_WIDGET (poGUI->wTF_Cmd), "activate",
-		      G_CALLBACK (SetCmd), poPlugin);
+        G_CALLBACK (SetCmd), poPlugin);
 
     gtk_entry_set_text (GTK_ENTRY (poGUI->wTF_Title), poConf->acTitle);
     g_signal_connect (GTK_WIDGET (poGUI->wTF_Title), "activate",
-		      G_CALLBACK (SetLabel), poPlugin);
+        G_CALLBACK (SetLabel), poPlugin);
 
     gtk_spin_button_set_value (GTK_SPIN_BUTTON (poGUI->wSc_Period),
-			       ((double) poConf->iPeriod_ms / 1000));
+        ((double) poConf->iPeriod_ms / 1000));
     g_signal_connect (GTK_WIDGET (poGUI->wSc_Period), "value_changed",
-		      G_CALLBACK (SetPeriod), poPlugin);
+        G_CALLBACK (SetPeriod), poPlugin);
 
-    if (*pcFont != '(')		/* Default font */
-	gtk_button_set_label (GTK_BUTTON (poGUI->wPB_Font),
-			      poConf->acFont);
+    if (*pcFont != '(') /* Default font */
+        gtk_button_set_label (GTK_BUTTON (poGUI->wPB_Font),
+        poConf->acFont);
     g_signal_connect (G_OBJECT (poGUI->wPB_Font), "clicked",
-		      G_CALLBACK (ChooseFont), poPlugin);
+        G_CALLBACK (ChooseFont), poPlugin);
 
     gtk_widget_show (dlg);
-}				/* genmon_create_options() */
+}/* genmon_create_options() */
 
-	/**************************************************************/
+/**************************************************************/
 
 static void genmon_set_orientation (XfcePanelPlugin *plugin, 
-                                    GtkOrientation p_iOrientation,
-                                    genmon_t *poPlugin)
-	/* Plugin API */
-	/* Invoked when the panel changes orientation */
+    GtkOrientation p_iOrientation,
+    genmon_t *poPlugin)
+/* Plugin API */
+/* Invoked when the panel changes orientation */
 {
     struct param_t *poConf = &(poPlugin->oConf.oParam);
     struct monitor_t *poMonitor = &(poPlugin->oMonitor);
@@ -706,40 +704,40 @@
     TRACE ("genmon_set_orientation()\n");
 
     gtk_container_remove (GTK_CONTAINER (poMonitor->wEventBox),
-			  GTK_WIDGET (poMonitor->wBox));
+        GTK_WIDGET (poMonitor->wBox));
     if (p_iOrientation == GTK_ORIENTATION_HORIZONTAL)
-	poMonitor->wBox = gtk_hbox_new (FALSE, 0);
+        poMonitor->wBox = gtk_hbox_new (FALSE, 0);
     else
-	poMonitor->wBox = gtk_vbox_new (FALSE, 0);
+        poMonitor->wBox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (poMonitor->wBox);
     gtk_container_set_border_width (GTK_CONTAINER
-				    (poMonitor->wBox), BORDER);
+        (poMonitor->wBox), BORDER);
     gtk_container_add (GTK_CONTAINER (poMonitor->wEventBox),
-		       poMonitor->wBox);
+        poMonitor->wBox);
 
     poMonitor->wTitle = gtk_label_new (poConf->acTitle);
     if (poConf->fTitleDisplayed)
-	gtk_widget_show (poMonitor->wTitle);
+        gtk_widget_show (poMonitor->wTitle);
     gtk_box_pack_start (GTK_BOX (poMonitor->wBox),
-			GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wTitle), FALSE, FALSE, 0);
 
     /* Create a VBox to put image and text */
     poMonitor->wImgBox = gtk_vbox_new (FALSE, 0);
     gtk_widget_show (poMonitor->wImgBox);
     gtk_container_set_border_width (GTK_CONTAINER
-      (poMonitor->wImgBox), 0);
+        (poMonitor->wImgBox), 0);
     gtk_container_add (GTK_CONTAINER (poMonitor->wBox),
-      poMonitor->wImgBox);
+        poMonitor->wImgBox);
  
     /* Add Image */   
     poMonitor->wImage = gtk_image_new ();
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wImage), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wImage), TRUE, FALSE, 0);
 
     /* Add Button */   
     poMonitor->wButton = gtk_button_new ();
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wButton), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wButton), TRUE, FALSE, 0);
 
     /* Add Image Button*/   
     poMonitor->wImgButton = gtk_image_new ();
@@ -750,48 +748,45 @@
     poMonitor->wValue = gtk_label_new ("");
     gtk_widget_show (poMonitor->wValue);
     gtk_box_pack_start (GTK_BOX (poMonitor->wImgBox),
-      GTK_WIDGET (poMonitor->wValue), TRUE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wValue), TRUE, FALSE, 0);
 
     /* Add Bar */   
     poMonitor->wBar = gtk_progress_bar_new();
     gtk_box_pack_start (GTK_BOX (poMonitor->wBox),
-      GTK_WIDGET (poMonitor->wBar), FALSE, FALSE, 0);
+        GTK_WIDGET (poMonitor->wBar), FALSE, FALSE, 0);
     /*gtk_widget_show (poMonitor->wBar);*/
     if (p_iOrientation == GTK_ORIENTATION_HORIZONTAL)
-      gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_BOTTOM_TO_TOP);
+        gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_BOTTOM_TO_TOP);
     else
-      gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_LEFT_TO_RIGHT);
-    
+        gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(poMonitor->wBar), GTK_PROGRESS_LEFT_TO_RIGHT);
+
     SetMonitorFont (poPlugin);
 
-}				/* genmon_set_orientation() */
+}/* genmon_set_orientation() */
 
-	/**************************************************************/
+/**************************************************************/
 static gboolean genmon_set_size (XfcePanelPlugin *plugin, int size, genmon_t *poPlugin)
-      /* Plugin API */
-      /* Set the size of the panel-docked monitor */
+/* Plugin API */
+/* Set the size of the panel-docked monitor */
 {
 
-  struct monitor_t *poMonitor = &(poPlugin->oMonitor);
+    struct monitor_t *poMonitor = &(poPlugin->oMonitor);
 
-  if (xfce_panel_plugin_get_orientation (plugin) ==
-    GTK_ORIENTATION_HORIZONTAL)
-  {
-    if (size>BORDER)
-      gtk_widget_set_size_request(GTK_WIDGET(poMonitor->wBar),
-        8, size-BORDER*2);
-  }
-  else
-  {
-    if (size>BORDER)
-      gtk_widget_set_size_request(GTK_WIDGET(poMonitor->wBar),
-        size-BORDER*2, 8);
-  }
+    if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
+    {
+        if (size>BORDER)
+            gtk_widget_set_size_request(GTK_WIDGET(poMonitor->wBar),8, size-BORDER*2);
+    }
+    else
+    {
+        if (size>BORDER)
+            gtk_widget_set_size_request(GTK_WIDGET(poMonitor->wBar), size-BORDER*2, 8);
+    }
 
-  return TRUE;
-}                       /* genmon_set_size() */
+    return TRUE;
+}/* genmon_set_size() */
 
-  /**************************************************************/
+/**************************************************************/
 
 static void genmon_construct (XfcePanelPlugin *plugin)
 {
@@ -810,45 +805,23 @@
     g_signal_connect (plugin, "free-data", G_CALLBACK (genmon_free), genmon);
 
     g_signal_connect (plugin, "save", G_CALLBACK (genmon_write_config), 
-                      genmon);
+        genmon);
 
     g_signal_connect (plugin, "orientation-changed", 
-                      G_CALLBACK (genmon_set_orientation), genmon);
+        G_CALLBACK (genmon_set_orientation), genmon);
 
     g_signal_connect (plugin, "size-changed", G_CALLBACK (genmon_set_size), genmon);
-  
+
     xfce_panel_plugin_menu_show_about (plugin);
     g_signal_connect (plugin, "about", G_CALLBACK (About), genmon);
 
     xfce_panel_plugin_menu_show_configure (plugin);
     g_signal_connect (plugin, "configure-plugin", 
-                      G_CALLBACK (genmon_create_options), genmon);
+        G_CALLBACK (genmon_create_options), genmon);
 
     g_signal_connect (G_OBJECT (genmon->oMonitor.wButton), "clicked",
-		      G_CALLBACK (ExecOnClickCmd), genmon);
+        G_CALLBACK (ExecOnClickCmd), genmon);
 }
 
 XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (genmon_construct)
 
-	/**************************************************************/
-/*
-$Log: main.c,v $
-Revision 1.1.1.2  2004/11/01 00:22:48  rogerms
-*** empty log message ***
-
-Revision 1.1.1.1  2004/09/09 13:35:53  rogerms
-V1.0
-
-Revision 1.4  2004/09/09 12:58:14  RogerSeguin
-Increased commandline resulting string maximum size from 16 characters to 32
-
-Revision 1.3  2004/08/31 20:27:48  RogerSeguin
-Reset font when changing panel orientation
-
-Revision 1.2  2004/08/28 09:58:19  RogerSeguin
-Added font selector
-
-Revision 1.1  2004/08/27 23:17:44  RogerSeguin
-Initial revision
-
-*/




More information about the Goodies-commits mailing list