Re: Menu and /etc/X11/applnk - again



> > > Why doesn't the version of the panel in the CVS archive read
> > > /etc/X11/applnk like the one from the Red Hat distribution does?
> > >
> > > I've tried to change the code to support this, but I'm not able to
> > > figure out how. Is there a way to combine different directory structures
> > > into one menu in the first place?
> >
> >         I can't answer your question, but I can suggest a path where
> > you might find the answer. RH often patches the GNOME code to make it
> > do RH-specific things. These patches are part of the source RPMs. If
> > you want to find out what changes they've made, then try downloading
> > the RH source RPM (or copy it from your CD) and installing it. There
> > will be one or more tarballs and some patches.
>
> Good idea! I have now been able to build a panel that will read /etc/X11/applnk
> from the latest CVS sources by applying the changes from
> gnome-core-1.0.6-mergerhmenus.patch included in the RedHat SRPM for gnome-core
> 1.0.55. Some manual intervention was necessary, though, mainly because the menu
> code was split into several C files quite recently.
>
> An updated diff is included below, in case someone finds it useful.
>

Hmmm. I really wanted this to be a context-type diff so that it might be read directly by patch. A new version is
included here.

- Toralf

? panel/distdir
? panel/doc/distdir
? panel/doc/C/distdir
? panel/doc/C/figs/distdir
? panel/doc/tmpl/distdir
? panel/help/distdir
? panel/help/C/distdir
? panel/help/C/figs/distdir
? panel/help/C/figures/distdir
? panel/help/C/figures/figs/distdir
? panel/help/C/figures/newfigs/distdir
? panel/help/C/figures/newtest/distdir
? panel/help/C/figures/old/distdir
? panel/help/de/distdir
? panel/help/de/figures/distdir
? panel/help/it/distdir
? panel/help/it/figures/distdir
? panel/menu/distdir
Index: panel/menu-fentry.c
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu-fentry.c,v
retrieving revision 1.13
diff -c -r1.13 menu-fentry.c
*** panel/menu-fentry.c	2000/02/28 13:32:45	1.13
--- panel/menu-fentry.c	2000/04/28 10:33:45
***************
*** 28,33 ****
--- 28,95 ----
  static GMemChunk *file_chunk = NULL;
  static GMemChunk *dir_chunk = NULL;
  
+ typedef struct _OrderEntry OrderEntry;
+  
+ struct _OrderEntry {
+ 	char *name;
+  	char *location;
+ };
+ 
+ 
+ /* Form a pretty name from a pathname */
+ gchar *
+ make_fullname (gchar *pathname)
+ {
+ 	char *p;
+ 	char *itemname;
+ 	itemname = g_strdup(g_basename(pathname));
+ 	p = strrchr(itemname,'.');
+ 	if(p) *p = '\0';
+ 	return itemname;
+ }
+  
+ gint 
+ fr_compare (gconstpointer a, gconstpointer b)
+ {
+ 	const FileRec *fr_a = a;
+ 	const FileRec *fr_b = b;
+ 	char *name_a;
+  	char *name_b;
+ 	gint result;
+ 
+ 	if (fr_a->fullname)
+ 		name_a = fr_a->fullname;
+ 	else
+ 		name_a = make_fullname (fr_a->name);
+ 
+ 	if (fr_b->fullname)
+ 		name_b = fr_b->fullname;
+ 	else
+ 		name_b = make_fullname (fr_b->name);
+ 
+ 	result = g_strcasecmp (name_a, name_b);
+  
+ 	if (!fr_a->fullname)
+ 		g_free (name_a);
+ 	if (!fr_b->fullname)
+ 		g_free (name_b);
+ 	
+ 	return result;
+ }
+ 
+ 
+ static OrderEntry *
+ find_order_entry (GSList *list, gchar *name)
+ {
+ 	while (list) {
+ 		OrderEntry *entry = list->data;
+ 		if (strcmp (name, entry->name) == 0)
+ 			return entry;
+ 		list = list->next;
+ 	}
+ 	return NULL;
+ }
+ 
  void
  init_fr_chunks ()
  {
***************
*** 49,89 ****
  		return NULL;
  	}
  	while(fgets(buf,PATH_MAX+1,fp)!=NULL) {
  		char *p = strchr(buf,'\n');
  		if(p) *p = '\0';
! 		list = g_slist_prepend(list,g_strdup(buf));
  	}
  	fclose(fp);
  	g_free(fname);
  	return g_slist_reverse(list);
  }
  
  GSList *
! get_files_from_menudir(char *menudir)
  {
! 	struct dirent *dent;
! 	DIR *dir;
! 	GSList *out = NULL;
! 	GSList *pres = NULL;
! 	
! 	dir = opendir (menudir);
! 	if (dir == NULL)
! 		return NULL;
! 	
! 	pres = get_presorted_from(menudir);
! 	
! 	while((dent = readdir (dir)) != NULL) {
! 		/* Skip over dot files */
! 		if (dent->d_name [0] == '.')
! 			continue;
! 		if(!string_is_in_list(pres,dent->d_name))
! 			out = g_slist_prepend(out,g_strdup(dent->d_name));
  	}
  
! 	closedir(dir);
! 	return g_slist_concat(pres,g_slist_reverse(out));
  }
  
  char *
  get_applet_goad_id_from_dentry(GnomeDesktopEntry *ii)
  {
--- 111,312 ----
  		return NULL;
  	}
  	while(fgets(buf,PATH_MAX+1,fp)!=NULL) {
+ 	        OrderEntry *entry;
  		char *p = strchr(buf,'\n');
  		if(p) *p = '\0';
! 
!  		entry = g_new (OrderEntry, 1);
!  		entry->name = g_strdup(buf);
!  		entry->location = NULL;
!  		
! 		list = g_slist_prepend(list, entry);
  	}
  	fclose(fp);
  	g_free(fname);
  	return g_slist_reverse(list);
  }
  
+ /* Find the files in the given directory that are not in
+  * the presort list pres or extra_files, and fill in entry->location 
+  * fields in the pres list. The full names are prepended in reverse
+  * order to 'result', and basenames to extra_files.
+  */
+ static void
+ get_additional_files_from (char *menudir, GSList *pres,
+ 			   GSList **result, GSList **extra_files)
+   {
+ 	DIR *dir = NULL;
+   	struct dirent *dent;
+ 
+ 	/* Get the files from the GNOME directory */
+ 	if (menudir)
+ 		dir = opendir (menudir);
+   	
+ 	if (dir != NULL) {
+ 		while((dent = readdir (dir)) != NULL) {
+ 			OrderEntry *entry;
+ 			
+ 			/* Skip over dot files */
+ 			if (dent->d_name [0] == '.')
+ 				continue;
+ 			entry = find_order_entry(pres,dent->d_name);
+ 			if (entry) {
+ 				if (!entry->location)
+ 					entry->location = g_concat_dir_and_file (menudir, dent->d_name);
+ 			} else if (!string_is_in_list (*extra_files, dent->d_name)) {
+ 				*extra_files = g_slist_prepend(*extra_files, g_strdup (dent->d_name));
+ 				*result = g_slist_prepend (*result, g_concat_dir_and_file (menudir, dent->d_name));
+ 			}
+ 		}
+ 		closedir(dir);
+ 	}
+ }
+ 
+ /* Returns a list of all files in a given directory, omitting
+  * . files, and including files from the shadow directory
+  */
  GSList *
! get_files_from_menudir(char *menudir, gint *n_sorted)
  {
! 	GSList *out;
! 	GSList *extras;
! 	GSList *tmp_out;
! 	GSList *pres;
! 	GSList *pres2;
! 	GSList *tmp_list;
! 	char *maindir;
! 	char *shadowdir;
! 
! 	shadow_menudir (menudir, &maindir, &shadowdir);
!   	
! 	/* Form an order list from the two directories .order files
! 	 */
! 	if (shadowdir) {
! 		pres = get_presorted_from(shadowdir);
! 		pres2 = get_presorted_from(maindir);
! 
! 		tmp_list = pres2;
! 		while (tmp_list) {
! 			OrderEntry *entry = tmp_list->data;
! 			
! 			if (!find_order_entry(pres, entry->name))
! 				pres = g_slist_append (pres, entry);
! 			else {
! 				g_free (entry->name);
! 				g_free (entry);
! 			}
! 			tmp_list = tmp_list->next;
! 		}
! 		g_slist_free (pres2);
! 		
! 	} else {
! 		pres = get_presorted_from(maindir);
  	}
+ 
+ 	/* Add unordered files
+ 	 */
+ 	out = NULL;
+ 	extras = NULL;
+ 	if (shadowdir)
+ 		get_additional_files_from (shadowdir, pres, &out, &extras);
+ 	get_additional_files_from (maindir, pres, &out, &extras);
+ 	g_slist_foreach (extras, (GFunc)g_free, NULL);
+ 	g_slist_free (extras);
+ 
+ 	out = g_slist_reverse (out);
+ 
+ 	/* Add the files in the order list
+ 	 */
+ 	tmp_out = NULL;
+ 	tmp_list = pres;
+ 	while (tmp_list) {
+ 		OrderEntry *entry = tmp_list->data;
+ 
+ 		if (entry->location)
+ 			tmp_out = g_slist_prepend (tmp_out, entry->location);
+ 		g_free (entry->name);
+ 		g_free (entry);
+ 
+ 		tmp_list = tmp_list->next;
+ 	}
+ 	g_slist_free (pres);
+ 
+ 	if (n_sorted)
+ 		*n_sorted = g_slist_length (tmp_out);
+ 	out = g_slist_concat (g_slist_reverse (tmp_out), out);
+   	
+ 	if (shadowdir && shadowdir != menudir)
+ 		g_free (shadowdir);
+ 	if (maindir && maindir != menudir)
+ 		g_free (maindir);
  
! 	return out;
  }
  
+ /* Get the modification time for a menu directory, taking
+  * into account shadowing. Returns FALSE if neither the
+  * directory nor it's shadow exists.
+  */
+ static gboolean
+ get_menudir_modtime(char *menudir, time_t *result)
+ {
+ 	char *shadowdir;
+ 	char *maindir;
+ 	struct stat s;
+ 	gboolean found = FALSE;
+ 
+ 	shadow_menudir (menudir, &maindir, &shadowdir);
+ 
+ 	if (stat (maindir, &s) != -1) {
+ 		found = TRUE;
+ 		*result = s.st_mtime;
+ 	}
+ 
+ 	if (shadowdir && stat (shadowdir, &s) != -1) {
+ 		if (!found) {
+ 			found = TRUE;
+ 			*result = s.st_mtime;
+ 		} else
+ 			*result = MAX (*result, s.st_mtime);
+   	}
+   
+ 	if (shadowdir && shadowdir != menudir)
+ 		g_free (shadowdir);
+ 	if (maindir && maindir != menudir)
+ 		g_free (maindir);
+ 
+ 	return found;
+ }
+ 
+ /* Locate the .directory entry for the given menu directory */
+ gchar *
+ get_menudir_dot_directory(char *menudir)
+ {
+ 	gchar *fname = g_concat_dir_and_file(menudir, ".directory");
+ 	gchar *mainfile, *shadow;
+ 
+ 	shadow_menudir (fname, &mainfile, &shadow);
+ 
+ 	if (shadow && g_file_exists (shadow)) {
+ 		if (mainfile)
+ 			g_free (mainfile);
+ 		return shadow;
+ 	}
+ 
+ 	if (g_file_exists (mainfile)) {
+ 		if (shadow)
+ 			g_free (shadow);
+ 		return mainfile;
+ 	}
+ 	
+ 	if (mainfile)
+ 		g_free (mainfile);
+ 	if (shadow)
+ 		g_free (shadow);
+ 	
+ 	return NULL;
+ }
+ 
  char *
  get_applet_goad_id_from_dentry(GnomeDesktopEntry *ii)
  {
***************
*** 154,165 ****
  static void
  fr_fill_dir(FileRec *fr, int sublevels)
  {
! 	GSList *flist;
  	struct stat s;
  	DirRec *dr = (DirRec *)fr;
  	FileRec *ffr;
  	time_t curtime = time(NULL);
! 	
  	g_return_if_fail(dr->recs==NULL);
  	g_return_if_fail(fr!=NULL);
  	g_return_if_fail(fr->name!=NULL);
--- 377,389 ----
  static void
  fr_fill_dir(FileRec *fr, int sublevels)
  {
! 	GSList *flist, *unsorted;
  	struct stat s;
  	DirRec *dr = (DirRec *)fr;
  	FileRec *ffr;
  	time_t curtime = time(NULL);
! 	gint index, n_sorted;
! 
  	g_return_if_fail(dr->recs==NULL);
  	g_return_if_fail(fr!=NULL);
  	g_return_if_fail(fr->name!=NULL);
***************
*** 173,210 ****
  	ffr->last_stat = curtime;
  	dr->recs = g_slist_prepend(dr->recs,ffr);
  
! 	flist = get_files_from_menudir(fr->name);
  	while(flist) {
! 		char *name = g_concat_dir_and_file(fr->name,flist->data);
  		GSList *tmp = flist;
- 		g_free(flist->data);
  		flist = flist->next;
  		g_slist_free_1(tmp);
- 		
- 		if (stat (name, &s) == -1) {
- 			g_free(name);
- 			continue;
- 		}
  
  		if (S_ISDIR (s.st_mode)) {
  			ffr = fr_read_dir(NULL,name,&s,sublevels-1);
- 			g_free(name);
- 			if(ffr)
- 				dr->recs = g_slist_prepend(dr->recs,ffr);
  		} else {
  			GnomeDesktopEntry *dentry;
  			char *p = strrchr(name,'.');
  			if (!p || (strcmp(p, ".desktop") != 0 &&
! 				   strcmp(p, ".kdelnk") != 0)) {
! 				g_free(name);
! 				continue;
! 			}
! 
  			dentry = gnome_desktop_entry_load(name);
  			if(dentry) {
  				ffr = g_chunk_new0 (FileRec, file_chunk);
  				ffr->type = FILE_REC_FILE;
  				ffr->name = name;
  				ffr->mtime = s.st_mtime;
  				ffr->last_stat = curtime;
  				ffr->parent = dr;
--- 397,430 ----
  	ffr->last_stat = curtime;
  	dr->recs = g_slist_prepend(dr->recs,ffr);
  
! 	flist = get_files_from_menudir(fr->name, &n_sorted);
! 	unsorted = NULL;
! 	index = 0;	
  	while(flist) {
! 		char *name = flist->data;
  		GSList *tmp = flist;
  		flist = flist->next;
  		g_slist_free_1(tmp);
  
+ 		ffr = NULL;	
+   		
+ 		if (stat (name, &s) == -1)
+ 			goto next;
+ 
  		if (S_ISDIR (s.st_mode)) {
  			ffr = fr_read_dir(NULL,name,&s,sublevels-1);
  		} else {
  			GnomeDesktopEntry *dentry;
  			char *p = strrchr(name,'.');
  			if (!p || (strcmp(p, ".desktop") != 0 &&
! 				   strcmp(p, ".kdelnk") != 0))
! 				goto next;
  			dentry = gnome_desktop_entry_load(name);
  			if(dentry) {
  				ffr = g_chunk_new0 (FileRec, file_chunk);
  				ffr->type = FILE_REC_FILE;
  				ffr->name = name;
+ 				name = NULL;
  				ffr->mtime = s.st_mtime;
  				ffr->last_stat = curtime;
  				ffr->parent = dr;
***************
*** 215,227 ****
  				ffr->goad_id =
  					get_applet_goad_id_from_dentry(dentry);
  				gnome_desktop_entry_free(dentry);
! 
! 				dr->recs = g_slist_prepend(dr->recs,ffr);
! 			} else
! 				g_free(name);
  		}
! 	}
! 	dr->recs = g_slist_reverse(dr->recs);
  }
  
  FileRec *
--- 435,460 ----
  				ffr->goad_id =
  					get_applet_goad_id_from_dentry(dentry);
  				gnome_desktop_entry_free(dentry);
! 			}
  		}
! 	next:
! 		if (ffr) {
! 			if (index >= n_sorted)
! 				unsorted = g_slist_prepend (unsorted, ffr);
! 			else
!   				dr->recs = g_slist_prepend(dr->recs,ffr);
! 
! 			index++;
! 		} else {
! 			if (index < n_sorted)
! 				n_sorted--;
!   		}
! 
! 		if (name)
! 			g_free(name);
!   	}
! 	dr->recs = g_slist_concat (g_slist_reverse (dr->recs),
! 				   g_slist_sort (unsorted, fr_compare));
  }
  
  FileRec *
***************
*** 245,256 ****
  
  	if(fr->last_stat < curtime-1) {
  		if(!dstat) {
! 			if (stat (mdir, &s) == -1) {
  				fr_free(fr, TRUE);
  				return NULL;
  			}
  
! 			fr->mtime = s.st_mtime;
  		} else
  			fr->mtime = dstat->st_mtime;
  		fr->last_stat = curtime;
--- 478,490 ----
  
  	if(fr->last_stat < curtime-1) {
  		if(!dstat) {
! 			time_t mtime;
! 			if (!get_menudir_modtime(mdir, &mtime)) {
  				fr_free(fr, TRUE);
  				return NULL;
  			}
  
! 			fr->mtime = mtime;
  		} else
  			fr->mtime = dstat->st_mtime;
  		fr->last_stat = curtime;
***************
*** 261,269 ****
  	fr->name = g_strdup(mdir);
  
  	s.st_mtime = 0;
! 	fname = g_concat_dir_and_file(mdir,".directory");
  	if (dr->dentrylast_stat >= curtime-1 ||
! 	    stat (fname, &s) != -1) {
  		GnomeDesktopEntry *dentry;
  		dentry = gnome_desktop_entry_load(fname);
  		if(dentry) {
--- 495,503 ----
  	fr->name = g_strdup(mdir);
  
  	s.st_mtime = 0;
! 	fname =  get_menudir_dot_directory(mdir);
  	if (dr->dentrylast_stat >= curtime-1 ||
! 	    (fname && stat (fname, &s) != -1)) {
  		GnomeDesktopEntry *dentry;
  		dentry = gnome_desktop_entry_load(fname);
  		if(dentry) {
***************
*** 285,291 ****
  			dr->dentrylast_stat = curtime;
  		dr->dentrymtime = s.st_mtime;
  	}
! 	g_free(fname);
  	
  	dir_list = g_slist_prepend(dir_list, fr);
  	
--- 519,526 ----
  			dr->dentrylast_stat = curtime;
  		dr->dentrymtime = s.st_mtime;
  	}
! 	if (fname)
! 		g_free(fname);
  	
  	dir_list = g_slist_prepend(dir_list, fr);
  	
***************
*** 329,342 ****
  	} else {
  		int reread = FALSE;
  		int any_change = FALSE;
- 		struct stat ds;
  		GSList *li;
  		if (fr->last_stat < curtime-1) {
! 			if(stat(fr->name,&ds)==-1) {
  				fr_free(fr,TRUE);
  				return NULL;
  			}
! 			if(ds.st_mtime != fr->mtime)
  				reread = TRUE;
  		}
  		for(li = dr->recs; !reread && li!=NULL; li=g_slist_next(li)) {
--- 564,577 ----
  	} else {
  		int reread = FALSE;
  		int any_change = FALSE;
  		GSList *li;
  		if (fr->last_stat < curtime-1) {
! 			time_t mtime;
! 			if (!get_menudir_modtime(fr->name, &mtime)) {
  				fr_free(fr,TRUE);
  				return NULL;
  			}
! 			if(mtime != fr->mtime)
  				reread = TRUE;
  		}
  		for(li = dr->recs; !reread && li!=NULL; li=g_slist_next(li)) {
***************
*** 349,357 ****
  			switch(ffr->type) {
  			case FILE_REC_DIR:
  				ddr = (DirRec *)ffr;
! 				p = g_concat_dir_and_file(ffr->name,
! 							  ".directory");
! 				if (ddr->dentrylast_stat >= curtime-1) {
  					g_free (p);
  					break;
  				}
--- 584,591 ----
  			switch(ffr->type) {
  			case FILE_REC_DIR:
  				ddr = (DirRec *)ffr;
! 				p = get_menudir_dot_directory(ffr->name);
! 				if(p && stat(p,&s)==-1) {
  					g_free (p);
  					break;
  				}
***************
*** 369,376 ****
  					break;
  				}
  				if(ddr->dentrymtime != s.st_mtime) {
! 					GnomeDesktopEntry *dentry;
! 					dentry = gnome_desktop_entry_load(p);
  					if(dentry) {
  						g_free(ffr->icon);
  						ffr->icon = dentry->icon;
--- 603,612 ----
  					break;
  				}
  				if(ddr->dentrymtime != s.st_mtime) {
! 					GnomeDesktopEntry *dentry = NULL;
! 					if (p)
! 						dentry = gnome_desktop_entry_load(p);
! 
  					if(dentry) {
  						g_free(ffr->icon);
  						ffr->icon = dentry->icon;
Index: panel/menu-fentry.h
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu-fentry.h,v
retrieving revision 1.3
diff -c -r1.3 menu-fentry.h
*** panel/menu-fentry.h	2000/02/28 13:32:45	1.3
--- panel/menu-fentry.h	2000/04/28 10:33:45
***************
*** 47,53 ****
  
  char * get_applet_goad_id_from_dentry(GnomeDesktopEntry *ii);
  
! GSList * get_files_from_menudir(char *menudir);
  
  FileRec * fr_read_dir(DirRec *dr, const char *mdir, struct stat *dstat, int sublevels);
  FileRec * fr_replace(FileRec *fr);
--- 47,56 ----
  
  char * get_applet_goad_id_from_dentry(GnomeDesktopEntry *ii);
  
! GSList * get_files_from_menudir(char *menudir, gint *n_sorted);
! gchar * get_menudir_dot_directory(char *menudir);
! gint fr_compare (gconstpointer a, gconstpointer b);
! gchar * make_fullname (gchar *pathname);
  
  FileRec * fr_read_dir(DirRec *dr, const char *mdir, struct stat *dstat, int sublevels);
  FileRec * fr_replace(FileRec *fr);
Index: panel/menu-properties.c
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu-properties.c,v
retrieving revision 1.13
diff -c -r1.13 menu-properties.c
*** panel/menu-properties.c	2000/04/03 23:03:29	1.13
--- panel/menu-properties.c	2000/04/28 10:33:45
***************
*** 67,77 ****
  		pixmap_name = gnome_unconditional_pixmap_file("gnome-logo-icon-transparent.png");
  	} else {
  		char *dentry_name;
! 		GnomeDesktopEntry *item_info;
  
! 		dentry_name = g_concat_dir_and_file (menudir,
! 						     ".directory");
! 		item_info = gnome_desktop_entry_load (dentry_name);
  		g_free (dentry_name);
  
  		if(item_info && item_info->icon)
--- 67,77 ----
  		pixmap_name = gnome_unconditional_pixmap_file("gnome-logo-icon-transparent.png");
  	} else {
  		char *dentry_name;
! 		GnomeDesktopEntry *item_info = NULL;
  
!  		dentry_name = get_menudir_dot_directory (menudir);
!  		if (dentry_name)
!  			item_info = gnome_desktop_entry_load (dentry_name);
  		g_free (dentry_name);
  
  		if(item_info && item_info->icon)
Index: panel/menu-rh.c
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu-rh.c,v
retrieving revision 1.4
diff -c -r1.4 menu-rh.c
*** panel/menu-rh.c	1999/11/29 01:00:21	1.4
--- panel/menu-rh.c	2000/04/28 10:33:45
***************
*** 27,32 ****
--- 27,60 ----
  static time_t rhuserdir_mtime = 0;
  
  void
+ shadow_menudir(char *dir, char **menudir, char **shadowdir)
+ {
+ 	static char *appsdir = NULL;
+ 	static guint appsdir_len = 0;
+ 	static guint shadowdir_len = 0;
+ 	
+ 	if (!appsdir) {
+ 		appsdir = gnome_datadir_file("gnome/apps");
+ 		appsdir_len = strlen (appsdir);
+ 		shadowdir_len = strlen (REDHAT_SHADOW_DIR);
+ 	}
+ 
+ 	if (strncmp (appsdir, dir, appsdir_len) == 0) {
+ 		*menudir = dir;
+ 		*shadowdir = g_strconcat (REDHAT_SHADOW_DIR, dir + appsdir_len, NULL);
+ 	} else if (strncmp (REDHAT_SHADOW_DIR, dir, shadowdir_len) == 0) {
+ 	        *menudir = g_strconcat (appsdir, dir + shadowdir_len, NULL);
+ 		*shadowdir = dir;
+ 	} else {
+ 		*menudir = dir;
+ 		*shadowdir = NULL;
+ 	}
+ }
+ 
+ 
+ 
+ 
+ void
  rh_submenu_to_display(GtkWidget *menuw, GtkMenuItem *menuitem)
  {
  	struct stat s;
***************
*** 309,314 ****
--- 337,343 ----
  	}
  	if(fp) fclose(fp);
  }
+ 
  
  
  void
Index: panel/menu-rh.h
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu-rh.h,v
retrieving revision 1.1
diff -c -r1.1 menu-rh.h
*** panel/menu-rh.h	1999/09/02 01:00:24	1.1
--- panel/menu-rh.h	2000/04/28 10:33:45
***************
*** 5,12 ****
--- 5,15 ----
  
  void create_rh_menu(int dofork);
  void rh_submenu_to_display(GtkWidget *menuw, GtkMenuItem *menuitem);
+ void shadow_menudir(char *dir, char **menudir, char **shadowdir);
  
  #define REDHAT_MENUDIR "/etc/X11/wmconfig"
+ /* The directory which we shadow the apps/ for Red Hat */
+ #define REDHAT_SHADOW_DIR "/etc/X11/applnk"
  
  END_GNOME_DECLS
  
Index: panel/menu.c
===================================================================
RCS file: /cvs/gnome/gnome-core/panel/menu.c,v
retrieving revision 1.307
diff -c -r1.307 menu.c
*** panel/menu.c	2000/04/20 06:24:18	1.307
--- panel/menu.c	2000/04/28 10:33:49
***************
*** 71,76 ****
--- 71,79 ----
  /* list of TearoffMenu s */
  static GSList *tearoffs = NULL;
  
+ 
+   
+ 
  /*to be called on startup to load in some of the directories,
    this makes the startup a little bit slower, and take up slightly
    more ram, but it also speeds up later operation*/
***************
*** 733,739 ****
  	AppletInfo *info;
  	Drawer *drawer;
  	PanelWidget *newpanel;
! 	GnomeDesktopEntry *item_info;
  	char *dentry_name;
  	char *subdir_name;
  	char *pixmap_name;
--- 736,742 ----
  	AppletInfo *info;
  	Drawer *drawer;
  	PanelWidget *newpanel;
! 	GnomeDesktopEntry *item_info = NULL;
  	char *dentry_name;
  	char *subdir_name;
  	char *pixmap_name;
***************
*** 744,752 ****
  	if(!g_file_exists(dirname))
  		return;
  
! 	dentry_name = g_concat_dir_and_file (dirname,
! 					     ".directory");
! 	item_info = gnome_desktop_entry_load (dentry_name);
  	g_free (dentry_name);
  
  	if(!name)
--- 747,755 ----
  	if(!g_file_exists(dirname))
  		return;
  
! 	dentry_name = get_menudir_dot_directory(".directory");
! 	if (dentry_name)
! 		item_info = gnome_desktop_entry_load (dentry_name);
  	g_free (dentry_name);
  
  	if(!name)
***************
*** 771,783 ****
  	g_assert(drawer);
  	newpanel = PANEL_WIDGET(BASEP_WIDGET(drawer->drawer)->panel);
  	
! 	list = get_files_from_menudir(dirname);
  	for(li = list; li!= NULL; li = g_slist_next(li)) {
  		struct stat s;
  		GnomeDesktopEntry *dentry;
  
  		g_free (filename);
! 		filename = g_concat_dir_and_file(dirname, li->data);
  
  		g_free (li->data);
  
--- 774,786 ----
  	g_assert(drawer);
  	newpanel = PANEL_WIDGET(BASEP_WIDGET(drawer->drawer)->panel);
  	
! 	list = get_files_from_menudir(dirname, NULL);
  	for(li = list; li!= NULL; li = g_slist_next(li)) {
  		struct stat s;
  		GnomeDesktopEntry *dentry;
  
  		g_free (filename);
! 		filename = li->data;
  
  		g_free (li->data);
  
***************
*** 2084,2093 ****
  	if(fr->fullname) {
  		itemname = g_strdup(fr->fullname);
  	} else {
! 		char *p;
! 		itemname = g_strdup(g_basename(fr->name));
! 		p = strrchr(itemname, '.');
! 		if(p) *p = '\0';
  	}
  
  	if(fr->type == FILE_REC_DIR) {
--- 2087,2093 ----
  	if(fr->fullname) {
  		itemname = g_strdup(fr->fullname);
  	} else {
! 		itemname = make_fullname (fr->name);
  	}
  
  	if(fr->type == FILE_REC_DIR) {


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