genius r713 - in trunk: . src ve



Author: jirka
Date: Fri Feb 13 19:29:50 2009
New Revision: 713
URL: http://svn.gnome.org/viewvc/genius?rev=713&view=rev

Log:

Fri Feb 13 13:29:35 2009  Jiri (George) Lebl <jirka 5z com>

	* ve/ve-misc.c, ve/ve-misc.h, ve/ve-gnome.c, ve/ve-nongnome.c,
	  ve/ve-config.c:  remove ve_find_prog_in_path and
	  ve_i18n_get_language_list, those have analogs in glib now
	  ve_is_prog_in_path now doesn't take the extra path argument,
	  gdm needed that somewhere and ve is only for genius now.

	* src/graphing.c: use ve_is_prog_in_path in the new way

	* configure.in: require glib 2.6.0 as well



Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/src/gnome-genius.c
   trunk/src/graphing.c
   trunk/ve/ve-config.c
   trunk/ve/ve-gnome.c
   trunk/ve/ve-misc.c
   trunk/ve/ve-misc.h
   trunk/ve/ve-nongnome.c

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Fri Feb 13 19:29:50 2009
@@ -16,7 +16,7 @@
 LIBGNOMEUI_REQUIRED=2.0.0
 LIBGNOME_REQUIRED=2.0.0
 GTK_REQUIRED=2.6.0
-GLIB_REQUIRED=2.0.0
+GLIB_REQUIRED=2.6.0
 GTKSOURCEVIEW_REQUIRED=0.3.0
 GTKSOURCEVIEW2_REQUIRED=2.0.2
 

Modified: trunk/src/gnome-genius.c
==============================================================================
--- trunk/src/gnome-genius.c	(original)
+++ trunk/src/gnome-genius.c	Fri Feb 13 19:29:50 2009
@@ -1328,16 +1328,17 @@
 	char *xdgopen;
 	char *uri;
 	char *file = NULL;
-	const GList *li;
+	const char * const* langs;
+	int i;
+
+	langs = g_get_language_names ();
 
-	for (li = ve_i18n_get_language_list ("LC_MESSAGES");
-	     li != NULL;
-	     li = li->next) {
+	for (i = 0; langs[i] != NULL; i++) {
 		file = g_build_filename (genius_datadir,
 					 "gnome",
 					 "help",
 					 "genius",
-					 li->data,
+					 langs[i],
 					 "genius.xml",
 					 NULL);
 		if (access (file, R_OK) == 0) {

Modified: trunk/src/graphing.c
==============================================================================
--- trunk/src/graphing.c	(original)
+++ trunk/src/graphing.c	Fri Feb 13 19:29:50 2009
@@ -749,8 +749,7 @@
 	gtk_widget_set_sensitive (graph_window, TRUE);
 
 	file_to_write = s;
-	if (eps && ve_is_prog_in_path ("ps2epsi",
-				       g_getenv ("PATH"))) {
+	if (eps && ve_is_prog_in_path ("ps2epsi")) {
 		fd = g_mkstemp (tmpfile);
 		/* FIXME: tell about errors ?*/
 		if (fd >= 0) {

Modified: trunk/ve/ve-config.c
==============================================================================
--- trunk/ve/ve-config.c	(original)
+++ trunk/ve/ve-config.c	Fri Feb 13 19:29:50 2009
@@ -581,11 +581,12 @@
 ve_config_get_translated_string (VeConfig *config,
 				 const char *key)
 {
-	const GList *li;
 	char *dkey;
 	char *def;
 	VeLine *line = NULL;
 	char *ret;
+	const char * const* langs;
+	int i;
 
 	g_return_val_if_fail (config != NULL, NULL);
 	g_return_val_if_fail (key != NULL, NULL);
@@ -597,10 +598,9 @@
 		def++;
 	}
 
-	for (li = ve_i18n_get_language_list ("LC_MESSAGES");
-	     li != NULL;
-	     li = li->next) {
-		char *full = g_strdup_printf ("%s[%s]", dkey, (char *)li->data);
+	langs = g_get_language_names ();
+	for (i = 0; langs[i] != NULL; i++) {
+		char *full = g_strdup_printf ("%s[%s]", dkey, langs[i]);
 		line = g_hash_table_lookup (config->line_ht, full);
 		g_free (full);
 		if (line != NULL)

Modified: trunk/ve/ve-gnome.c
==============================================================================
--- trunk/ve/ve-gnome.c	(original)
+++ trunk/ve/ve-gnome.c	Fri Feb 13 19:29:50 2009
@@ -93,40 +93,3 @@
 
 	return NULL;
 }
-
-/**
- * ve_i18n_get_language_list:
- * @ignored: Not used anymore (Historically: Name of category to look
- *                 up, e.g. %"LC_MESSAGES").
- * 
- * Computes a list of applicable locale names, which can be used to e.g.
- * construct locale-dependent filenames or search paths. The returned list is
- * sorted from most desirable to least desirable and always contains the
- * default locale "C".
- * 
- * Return value: the list of languages, this list should not be freed as it is
- * owned by ve.
- **/
-const GList *
-ve_i18n_get_language_list (const gchar *category_name)
-{
-	static GStaticRecMutex lang_list_lock = G_STATIC_REC_MUTEX_INIT;
-	static GList *list = NULL;
-	const char * const* langs;
-	int i;
-
-	g_static_rec_mutex_lock (&lang_list_lock);
-
-	if (list == NULL) {
-		langs = g_get_language_names ();
-		for (i = 0; langs[i] != NULL; i++) {
-			list = g_list_prepend (list, g_strdup(langs[i]));
-		}
-
-		list = g_list_reverse (list);
-	}
-
-	g_static_rec_mutex_unlock (&lang_list_lock);
-
-	return list;
-}

Modified: trunk/ve/ve-misc.c
==============================================================================
--- trunk/ve/ve-misc.c	(original)
+++ trunk/ve/ve-misc.c	Fri Feb 13 19:29:50 2009
@@ -342,32 +342,10 @@
 	return ret;
 }
 
-char *
-ve_find_prog_in_path (const char *prog, const char *path)
-{
-	char **vec;
-	int i;
-
-	if (ve_string_empty (prog) || ve_string_empty (path))
-		return NULL;
-
-	vec = g_strsplit (path, ":", -1);
-	for (i = 0; vec != NULL && vec[i] != NULL; i++) {
-		char *full = g_build_filename (vec[i], prog, NULL);
-		/* Do not use X_OK, we may be looking for things
-		   that are not executables */
-		if (access (full, F_OK) == 0) {
-			return full;
-		}
-		g_free (full);
-	}
-	return NULL;
-}
-
 gboolean
-ve_is_prog_in_path (const char *prog, const char *path)
+ve_is_prog_in_path (const char *prog)
 {
-	char *full = ve_find_prog_in_path (prog, path);
+	char *full = g_find_program_in_path (prog);
 	if (full != NULL) {
 		g_free (full);
 		return TRUE;

Modified: trunk/ve/ve-misc.h
==============================================================================
--- trunk/ve/ve-misc.h	(original)
+++ trunk/ve/ve-misc.h	Fri Feb 13 19:29:50 2009
@@ -80,12 +80,7 @@
 /* Testing for existance of a certain locale */
 gboolean ve_locale_exists (const char *loc);
 
-/* just like gnome_i18n_get_language_list (in fact if you link to
-   gnome it uses that */
-const GList * ve_i18n_get_language_list (const gchar *category_name);
-
-char * ve_find_prog_in_path (const char *prog, const char *path);
-gboolean ve_is_prog_in_path (const char *prog, const char *path);
+gboolean ve_is_prog_in_path (const char *prog);
 
 char *ve_shell_quote_filename (const char *name);
 

Modified: trunk/ve/ve-nongnome.c
==============================================================================
--- trunk/ve/ve-nongnome.c	(original)
+++ trunk/ve/ve-nongnome.c	Fri Feb 13 19:29:50 2009
@@ -294,89 +294,3 @@
   return NULL;
 }
 
-
-static GHashTable *category_table= NULL;
-
-/**
- * ve_i18n_get_language_list:
- * @category_name: Name of category to look up, e.g. %"LC_MESSAGES".
- * 
- * This computes a list of language strings that the user wants.  It searches in
- * the standard environment variables to find the list, which is sorted in order
- * from most desirable to least desirable.  The `C' locale is appended to the
- * list if it does not already appear (other routines depend on this
- * behaviour). If @category_name is %NULL, then %LC_ALL is assumed.
- *
- * This function and all the related above code stolen from libgnome and thus
- * copyrighted as:
- *  Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
- *  All rights reserved.
- * 
- * Return value: the list of languages, this list should not be freed as it is
- * owned by vicious-extensions
- **/
-const GList *
-ve_i18n_get_language_list (const gchar *category_name)
-{
-  GList *list;
-
-  if (!category_name)
-    category_name= "LC_ALL";
-
-  if (category_table)
-    {
-      list= g_hash_table_lookup (category_table, (const gpointer) category_name);
-    }
-  else
-    {
-      category_table= g_hash_table_new (g_str_hash, g_str_equal);
-      list= NULL;
-    }
-
-  if (!list)
-    {
-      gint c_locale_defined= FALSE;
-  
-      const gchar *category_value;
-      gchar *category_memory, *orig_category_memory;
-
-      category_value = guess_category_value (category_name);
-      if (! category_value)
-	category_value = "C";
-      orig_category_memory = category_memory =
-	g_malloc (strlen (category_value)+1);
-      
-      while (category_value[0] != '\0')
-	{
-	  while (category_value[0] != '\0' && category_value[0] == ':')
-	    ++category_value;
-	  
-	  if (category_value[0] != '\0')
-	    {
-	      char *cp= category_memory;
-	      
-	      while (category_value[0] != '\0' && category_value[0] != ':')
-		*category_memory++= *category_value++;
-	      
-	      category_memory[0]= '\0'; 
-	      category_memory++;
-	      
-	      cp = unalias_lang(cp);
-	      
-	      if (strcmp (cp, "C") == 0)
-		c_locale_defined= TRUE;
-	      
-	      list= g_list_concat (list, compute_locale_variants (cp));
-	    }
-	}
-
-      g_free (orig_category_memory);
-      
-      if (!c_locale_defined)
-	list= g_list_append (list, "C");
-
-      g_hash_table_insert (category_table, (gpointer) category_name, list);
-    }
-  
-  return list;
-}



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