PATCH for help-browser



Hi!

Attached you can find a patch for the GNOME help-browser (latest CVS
version from HEAD branch).
What it does is the following:
Currently in toc:ghelp only packges are listed that put a index.html file
into their subdir.
Some apps like gnumeric and gnomecal do have helpfiles but not a
index.html.
I modified toc2-ghelp.c that generates the entries to also read the
topic.dat file and extract the first helpfile name.
My extension is basically a cut and paste from toc2-ghelp.c and the
gnome-app-helper.c files.

Hope you like it.

... Or shoud we force the apps to install a index.html file?


Cheers, Martin.

   _ _   _   _ ___            _            _  _
  | V | /_\ |_) | ||\ |  |_| /_\\    /|  |(_'/  |_|
  |   |(   )| \ | || \|  | |(   )\/\/ |_ | _)\_ | |
 http://freddy.rz.fh-mannheim.de/~hawlisch/index.html
       mailto:hawlisch@roxi.rz.fh-mannheim.de

Index: toc2-ghelp.c
===================================================================
RCS file: /cvs/gnome/gnome-core/help-browser/toc2-ghelp.c,v
retrieving revision 1.7
diff -c -r1.7 toc2-ghelp.c
*** toc2-ghelp.c	1999/03/01 18:31:17	1.7
--- toc2-ghelp.c	1999/08/31 20:30:00
***************
*** 6,11 ****
--- 6,12 ----
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <string.h>
+ #include <ctype.h>
  
  #include <glib.h>
  
***************
*** 58,63 ****
--- 59,94 ----
  
  		    temp= temp->next;
  		  }
+ 		
+ 		if (!temp) {	/* No index.html was found	*/
+ 		  temp = lang_list;
+ 		  while (temp)	/*  try topic.dat instead	*/
+ 		  {
+ 		    lang= (gchar*) temp->data;
+ 			snprintf (filename, sizeof(filename),
+ 					  "%s/%s/%s/topic.dat",
+ 					  conf->path, dirp->d_name, lang);
+ 		    if (stat (filename, &buf) == 0)	/* If topic.dat exists	*/
+ 		    {
+ 			  FILE *file;
+ 			  gchar b[1024], *s;
+ 
+ 			  if( file = fopen (filename, "rt")) {
+ 				fgets (b, sizeof (b), file);	/* read topic.dat	*/
+ 				fclose( file);
+ 				for (s = b; *s && !isspace (*s); s++);
+ 				*s++ = '\0';	/* and extract the first help file name	*/
+ 				snprintf (filename, sizeof(filename),
+ 						  "%s/%s/%s/%s",
+ 						  conf->path, dirp->d_name, lang, b);
+ 				if (stat (filename, &buf) == 0)
+ 				 break;	/* found! :-)	*/
+ 			 }
+ 		    }
+ 
+ 		    temp= temp->next;
+ 		  }
+ 		}
  
  		if (temp)
  		  {


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