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

gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-95-gcfefe89)



The branch, master has been updated
       via  cfefe89a2b974b9aaa7ff13cb054565c11045b34 (commit)
       via  16a171a9e37c2234d83fb3c6800370be2dd50ed0 (commit)
       via  57815bd72e62999193641f301af9184c0d524cf6 (commit)
       via  19f5e9965dc12818b0d4f2771b020989065a83fb (commit)
       via  46eda8a55b9197f7a24d5b04ff94cedc1abc74fe (commit)
       via  0fe03039f1eda8b1c2aab1701948532513e920fe (commit)
      from  7522ef33777ed3f6cec8dbe8b16620657c3edcce (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/gschem_struct.h |    2 +
 gschem/include/i_vars.h        |    1 +
 gschem/include/prototype.h     |    1 +
 gschem/src/gschem.c            |   15 ++++-
 gschem/src/gschem_toplevel.c   |    2 +
 gschem/src/i_vars.c            |   24 +++++++
 gschem/src/x_print.c           |    6 +-
 libgeda/include/i_vars_priv.h  |    2 -
 libgeda/include/prototype.h    |    2 +-
 libgeda/include/struct.h       |    3 -
 libgeda/src/f_basic.c          |  138 +++++++++++++++++++++------------------
 libgeda/src/i_vars.c           |    6 +--
 libgeda/src/s_toplevel.c       |    3 -
 13 files changed, 121 insertions(+), 84 deletions(-)


=================
 Commit Messages
=================

commit cfefe89a2b974b9aaa7ff13cb054565c11045b34
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 19:42:06 2008 +0100

    libgeda: Make follow_symlinks() actually use its GError.

:100644 100644 d314395... 6143ada... M	libgeda/src/f_basic.c

commit 16a171a9e37c2234d83fb3c6800370be2dd50ed0
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 17:14:44 2008 +0100

    libgeda: Make sure GError properly freed in f_open_flags().
    
    There was a corner case where a GError used internally to
    f_open_flags() wasn't getting freed correctly.

:100644 100644 ab9013c... d314395... M	libgeda/src/f_basic.c

commit 57815bd72e62999193641f301af9184c0d524cf6
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:30:35 2008 +0100

    Print command is a gschem setting.
    
    Move print command from TOPLEVEL to GSCHEM_TOPLEVEL, and move static
    defaults too.

:100644 100644 c238d7e... d82fe40... M	gschem/include/gschem_struct.h
:100644 100644 35bc68c... 661103e... M	gschem/include/i_vars.h
:100644 100644 c05c933... 8d0a0ba... M	gschem/src/gschem_toplevel.c
:100644 100644 f5a3c9c... 1fab055... M	gschem/src/i_vars.c
:100644 100644 750d2f0... 7523ebd... M	gschem/src/x_print.c
:100644 100644 043eba5... 7ffee13... M	libgeda/include/i_vars_priv.h
:100644 100644 999a5a7... 6f16d0e... M	libgeda/include/struct.h
:100644 100644 87a3906... 3fd93e6... M	libgeda/src/i_vars.c
:100644 100644 8c85b93... 34ae892... M	libgeda/src/s_toplevel.c

commit 19f5e9965dc12818b0d4f2771b020989065a83fb
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:30:35 2008 +0100

    gschem: Add infrastructure for string options.
    
    There are still some gschem settings in libgeda just because they take
    string values. This patch makes it possible to boot them out.

:100644 100644 2a65402... d7ddece... M	gschem/include/prototype.h
:100644 100644 f37d708... 047b9b6... M	gschem/src/gschem.c
:100644 100644 a8d95f5... f5a3c9c... M	gschem/src/i_vars.c

commit 46eda8a55b9197f7a24d5b04ff94cedc1abc74fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:06:03 2008 +0100

    Name i_vars_... functions consistently.
    
    Apps should use i_vars_blah(), libgeda uses i_vars_libgeda_blah().

:100644 100644 c606409... f37d708... M	gschem/src/gschem.c
:100644 100644 b6a7927... 74ba621... M	libgeda/include/prototype.h
:100644 100644 b79649d... 87a3906... M	libgeda/src/i_vars.c

commit 0fe03039f1eda8b1c2aab1701948532513e920fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 22:38:44 2008 +0100

    gschem: Don't use default_scheme_directory.
    
    gschem uses default_scheme_directory to find gschem.scm. It doesn't
    need to, because libgeda should have already set the Guile load path
    correctly by this point.

:100644 100644 2ae8d51... c606409... M	gschem/src/gschem.c

=========
 Changes
=========

commit cfefe89a2b974b9aaa7ff13cb054565c11045b34
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 19:42:06 2008 +0100

    libgeda: Make follow_symlinks() actually use its GError.

diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index d314395..6143ada 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -580,24 +580,34 @@ gchar *f_normalize_filename (const gchar *name, GError **error)
  *  \par Function Description
  *  Does readlink() recursively until we find a real filename.
  *
- *  \param [in] filename  The filename to search for.
- *  \param [out]   error  Unused, set to NULL
- *  \return The path to real file on success, NULL otherwise.
+ *  \param [in]     filename  The filename to search for.
+ *  \param [in,out] err       #GError structure for error reporting,
+ *                            or NULL to disable error reporting.
+ *  \return The newly-allocated path to real file on success, NULL
+ *          otherwise.
  *
- *  \note Taken from gedit's source code.
+ *  \note Originally taken from gedit's source code.
  */
-char *follow_symlinks (const gchar *filename, GError **error)
+char *follow_symlinks (const gchar *filename, GError **err)
 {
-  gchar *followed_filename;
-  gint link_count;
-  
-  g_return_val_if_fail (filename != NULL, NULL);
-  
-  g_return_val_if_fail (strlen (filename) + 1 <= MAXPATHLEN, NULL);
-  
+  gchar *followed_filename = NULL;
+  gint link_count = 0;
+  GError *tmp_err = NULL;
+
+  if (filename == NULL) {
+    g_set_error (err, G_FILE_ERROR, G_FILE_ERROR_INVAL,
+                 g_strerror (EINVAL));
+    return NULL;
+  }
+
+  if (strlen (filename) + 1 > MAXPATHLEN) {
+    g_set_error (err, G_FILE_ERROR, G_FILE_ERROR_NAMETOOLONG,
+                 g_strerror (ENAMETOOLONG));
+    return NULL;
+  }
+
   followed_filename = g_strdup (filename);
-  link_count = 0;
-  
+
 #ifdef __MINGW32__
   /* MinGW does not have symlinks */
   return followed_filename;
@@ -605,65 +615,64 @@ char *follow_symlinks (const gchar *filename, GError **error)
 
   while (link_count < MAX_LINK_LEVEL) {
     struct stat st;
-    
-    if (lstat (followed_filename, &st) != 0)
+    gchar *linkname = NULL;
+
+    if (lstat (followed_filename, &st) != 0) {
       /* We could not access the file, so perhaps it does not
        * exist.  Return this as a real name so that we can
        * attempt to create the file.
        */
       return followed_filename;
-    
-    if (S_ISLNK (st.st_mode)) {
-      gint len;
-      gchar linkname[MAXPATHLEN];
-      
-      link_count++;
-      
-      len = readlink (followed_filename, linkname, MAXPATHLEN - 1);
-      
-      if (len == -1) {
-	s_log_message(_("Could not read symbolic link information for %s"), followed_filename);
-	g_free (followed_filename);
-	return NULL;
-      }
-      
-      linkname[len] = '\0';
-      
-      /* If the linkname is not an absolute path name, append
-       * it to the directory name of the followed filename.  E.g.
-       * we may have /foo/bar/baz.lnk -> eek.txt, which really
-       * is /foo/bar/eek.txt.
-       */
-      
-      if (linkname[0] != G_DIR_SEPARATOR) {
-	gchar *slashpos;
-	gchar *tmp;
-	
-	slashpos = strrchr (followed_filename, G_DIR_SEPARATOR);
-	
-	if (slashpos)
-	  *slashpos = '\0';
-	else {
-	  tmp = g_strconcat ("./", followed_filename, NULL);
-	  g_free (followed_filename);
-	  followed_filename = tmp;
-	}
-	
-	tmp = g_build_filename (followed_filename, linkname, NULL);
-	g_free (followed_filename);
-	followed_filename = tmp;
-      } else {
-	g_free (followed_filename);
-	followed_filename = g_strdup (linkname);
-      }
-    } else
+    }
+
+    if (!S_ISLNK (st.st_mode)) {
+      /* It's not a link, so we've found what we're looking for! */
       return followed_filename;
+    }
+
+    link_count++;
+
+    linkname = g_file_read_link (followed_filename, &tmp_err);
+
+    if (linkname == NULL) {
+      g_propagate_error(err, tmp_err);
+      g_free (followed_filename);
+      return NULL;
+    }
+
+    /* If the linkname is not an absolute path name, append
+     * it to the directory name of the followed filename.  E.g.
+     * we may have /foo/bar/baz.lnk -> eek.txt, which really
+     * is /foo/bar/eek.txt.
+     */
+
+    if (!g_path_is_absolute(linkname)) {
+      gchar *slashpos = strrchr (followed_filename, G_DIR_SEPARATOR);
+      gchar *tmp = NULL;
+
+      /*! \bug The old version of this code *appeared* to turn
+       * absolute paths into relative ones for no good reason, so I
+       * changed it and tested it. If it is now broken, it's my
+       * fault. -- PTBB */
+      if (slashpos) {
+        *slashpos = '\0';
+      }
+
+      tmp = g_build_filename (followed_filename, linkname, NULL);
+      g_free (followed_filename);
+      g_free (linkname);
+      followed_filename = tmp;
+    } else {
+      g_free (followed_filename);
+      followed_filename = linkname;
+    }
   }
 
   /* Too many symlinks */
-  
-  s_log_message(_("The file has too many symbolic links."));
-  
+  g_set_error (err, G_FILE_ERROR, G_FILE_ERROR_LOOP,
+               _("%s: %s"), g_strerror (EMLINK), followed_filename);
+  g_free (followed_filename);
   return NULL;
+
 #endif /* __MINGW32__ */
 }

commit 16a171a9e37c2234d83fb3c6800370be2dd50ed0
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 17:14:44 2008 +0100

    libgeda: Make sure GError properly freed in f_open_flags().
    
    There was a corner case where a GError used internally to
    f_open_flags() wasn't getting freed correctly.

diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index ab9013c..d314395 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -209,6 +209,7 @@ int f_open_flags(TOPLEVEL *toplevel, const gchar *filename,
     g_set_error (err, G_FILE_ERROR, tmp_err->code,
                  _("Cannot find file %s: %s"),
                  filename, g_strerror (tmp_err->code));
+    g_error_free(tmp_err);
     return 0;
   }
 

commit 57815bd72e62999193641f301af9184c0d524cf6
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:30:35 2008 +0100

    Print command is a gschem setting.
    
    Move print command from TOPLEVEL to GSCHEM_TOPLEVEL, and move static
    defaults too.

diff --git a/gschem/include/gschem_struct.h b/gschem/include/gschem_struct.h
index c238d7e..d82fe40 100644
--- a/gschem/include/gschem_struct.h
+++ b/gschem/include/gschem_struct.h
@@ -201,5 +201,7 @@ struct st_gschem_toplevel {
   int select_slack_pixels; /* Number of pixels around an object we can still select it with */
   int zoom_gain;          /* Percentage increase in size for a zoom-in operation */
   int scrollpan_steps;    /* Number of scroll pan events required to traverse the viewed area */
+
+  char *print_command;    /* The command to send postscript to when printing */
 };
 
diff --git a/gschem/include/i_vars.h b/gschem/include/i_vars.h
index 35bc68c..661103e 100644
--- a/gschem/include/i_vars.h
+++ b/gschem/include/i_vars.h
@@ -4,6 +4,7 @@ extern int default_text_color;
 extern int default_text_size;
 extern int default_text_caps;
 extern float default_postscript_font_scale;
+extern gchar *default_print_command;
 extern int default_attribute_color;
 extern int default_detachattr_color;
 extern int default_net_color;
diff --git a/gschem/src/gschem_toplevel.c b/gschem/src/gschem_toplevel.c
index c05c933..8d0a0ba 100644
--- a/gschem/src/gschem_toplevel.c
+++ b/gschem/src/gschem_toplevel.c
@@ -209,5 +209,7 @@ GSCHEM_TOPLEVEL *gschem_toplevel_new ()
   w_current->zoom_gain = 20;
   w_current->scrollpan_steps = 8;
 
+  w_current->print_command = NULL;
+
   return w_current;
 }
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index f5a3c9c..1fab055 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -37,6 +37,9 @@
                              (default_ ## name) : (str));               \
 }
 
+/* Absolute default used when default_... strings are NULL */
+#define DEFAULT_PRINT_COMMAND "lpr"
+
 int   default_graphic_color = GRAPHIC_COLOR;
 int   default_text_color = TEXT_COLOR;
 int   default_text_size = 10;
@@ -80,6 +83,7 @@ int   default_stroke_color = STROKE_COLOR;
 int   default_paper_width = 11000; /* letter size */
 int   default_paper_height = 85000;
 int   default_scrollbars_flag = TRUE;
+char *default_print_command = NULL;
 int   default_print_orientation = LANDSCAPE;
 int   default_image_color = FALSE;
 int   default_image_width = 800;
@@ -214,6 +218,8 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
   w_current->log_window      = default_log_window;
   w_current->log_window_type = default_log_window_type;
 
+  INIT_STR(w_current, print_command, DEFAULT_PRINT_COMMAND);
+
   toplevel->print_output_type      = default_print_output_type;
   toplevel->print_output_capstyle  = default_print_output_capstyle;
   toplevel->print_orientation      = default_print_orientation;
@@ -282,4 +288,5 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
  */
 void i_vars_freenames()
 {
+  g_free(default_print_command);
 }
diff --git a/gschem/src/x_print.c b/gschem/src/x_print.c
index 750d2f0..7523ebd 100644
--- a/gschem/src/x_print.c
+++ b/gschem/src/x_print.c
@@ -655,7 +655,7 @@ void
 x_print_setup (GSCHEM_TOPLEVEL *w_current, char *filename)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  gchar * command = toplevel->print_command;
+  gchar * command = w_current->print_command;
   gint orient = toplevel->print_orientation;
   gint type = toplevel->print_output_type;
   gint paperidx, x, y, result;
@@ -743,8 +743,8 @@ x_print_setup (GSCHEM_TOPLEVEL *w_current, char *filename)
 	  destination = command;
 	  result = f_print_command (toplevel, command);
 	  
-	  g_free (toplevel->print_command);
-	  toplevel->print_command = g_strdup (command);
+	  g_free (w_current->print_command);
+	  w_current->print_command = g_strdup (command);
 	}
       else
 	{
diff --git a/libgeda/include/i_vars_priv.h b/libgeda/include/i_vars_priv.h
index 043eba5..7ffee13 100644
--- a/libgeda/include/i_vars_priv.h
+++ b/libgeda/include/i_vars_priv.h
@@ -12,8 +12,6 @@ extern char *default_postscript_prolog;
 
 extern char *default_always_promote_attributes;
 
-extern char *default_print_command;
-
 extern int default_attribute_promotion;
 extern int default_promote_invisible;
 extern int default_keep_invisible;
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 999a5a7..6f16d0e 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -509,9 +509,6 @@ struct st_toplevel {
   /* List of attributes to always promote */
   char *always_promote_attributes;
 
-  /* The command to send postscript to when printing */
-  char *print_command;
-
   /* gnetlist specific */
   int net_naming_priority;
   int hierarchy_traversal;
diff --git a/libgeda/src/i_vars.c b/libgeda/src/i_vars.c
index 87a3906..3fd93e6 100644
--- a/libgeda/src/i_vars.c
+++ b/libgeda/src/i_vars.c
@@ -45,7 +45,6 @@
 #define DEFAULT_BUS_RIPPER_SYMNAME "busripper-1.sym"
 #define DEFAULT_POSTSCRIPT_PROLOG  "prolog.ps"
 #define DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES ""
-#define DEFAULT_PRINT_COMMAND "lpr"
 
 int   default_init_right = WIDTH_C;
 int   default_init_bottom = HEIGHT_C;
@@ -57,7 +56,6 @@ char *default_bitmap_directory = NULL;
 char *default_bus_ripper_symname = NULL;
 char *default_postscript_prolog = NULL;
 char *default_always_promote_attributes = NULL;
-char *default_print_command = NULL;
 
 int   default_attribute_promotion = TRUE;
 int   default_promote_invisible = FALSE;
@@ -89,7 +87,6 @@ void i_vars_libgeda_set(TOPLEVEL *toplevel)
   INIT_STR(toplevel, bus_ripper_symname, DEFAULT_BUS_RIPPER_SYMNAME);
   INIT_STR(toplevel, postscript_prolog,  DEFAULT_POSTSCRIPT_PROLOG);
   INIT_STR(toplevel, always_promote_attributes, DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
-  INIT_STR(toplevel, print_command, DEFAULT_PRINT_COMMAND);
 
 }
 
@@ -109,5 +106,4 @@ void i_vars_libgeda_freenames()
   g_free(default_bus_ripper_symname);
   g_free(default_postscript_prolog);
   g_free(default_always_promote_attributes);
-  g_free(default_print_command);
 }
diff --git a/libgeda/src/s_toplevel.c b/libgeda/src/s_toplevel.c
index 8c85b93..34ae892 100644
--- a/libgeda/src/s_toplevel.c
+++ b/libgeda/src/s_toplevel.c
@@ -135,8 +135,6 @@ TOPLEVEL *s_toplevel_new (void)
 
   toplevel->always_promote_attributes = NULL;
 
-  toplevel->print_command = NULL;
-
   toplevel->net_naming_priority = 0;
   toplevel->hierarchy_traversal = 0;
   toplevel->hierarchy_uref_mangle = 0;
@@ -178,7 +176,6 @@ void s_toplevel_delete (TOPLEVEL *toplevel)
   g_free (toplevel->scheme_directory);
   g_free (toplevel->bitmap_directory);
   g_free (toplevel->bus_ripper_symname);
-  g_free (toplevel->print_command);
   
   /* free all fonts */
   /* if you close a window, then you free the font set... */

commit 19f5e9965dc12818b0d4f2771b020989065a83fb
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:30:35 2008 +0100

    gschem: Add infrastructure for string options.
    
    There are still some gschem settings in libgeda just because they take
    string values. This patch makes it possible to boot them out.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 2a65402..d7ddece 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -455,6 +455,7 @@ void i_callback_options_show_coord_window(gpointer data, guint callback_action,
 gboolean i_callback_close_wm(GtkWidget *widget, GdkEvent *event, gpointer data);
 /* i_vars.c */
 void i_vars_set(GSCHEM_TOPLEVEL *w_current);
+void i_vars_freenames();
 /* o_arc.c */
 void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
 void o_arc_draw_solid(GdkWindow *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint x, gint y, gint radius, gint angle1, gint angle2, gint arc_width, gint length, gint space);
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index f37d708..047b9b6 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -105,6 +105,7 @@ void gschem_quit(void)
   o_undo_cleanup();
   /* s_stroke_free(); no longer needed */
 
+  i_vars_freenames();
   i_vars_libgeda_freenames();
 
   /* x_window_free_head(); can't do this since it causes a
diff --git a/gschem/src/i_vars.c b/gschem/src/i_vars.c
index a8d95f5..f5a3c9c 100644
--- a/gschem/src/i_vars.c
+++ b/gschem/src/i_vars.c
@@ -30,6 +30,13 @@
 #include <dmalloc.h>
 #endif
 
+/*! \def INIT_STR(w, name, str) */
+#define INIT_STR(w, name, str) {                                        \
+        g_free((w)->name);                                              \
+        (w)->name = g_strdup(((default_ ## name) != NULL) ?             \
+                             (default_ ## name) : (str));               \
+}
+
 int   default_graphic_color = GRAPHIC_COLOR;
 int   default_text_color = TEXT_COLOR;
 int   default_text_size = 10;
@@ -266,3 +273,13 @@ void i_vars_set(GSCHEM_TOPLEVEL *w_current)
 
   toplevel->auto_save_interval = default_auto_save_interval;
 }
+
+
+/*! \brief Free default names
+ *  \par Function Description
+ *  This function will free all of the default variables for gschem.
+ *
+ */
+void i_vars_freenames()
+{
+}

commit 46eda8a55b9197f7a24d5b04ff94cedc1abc74fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 23:06:03 2008 +0100

    Name i_vars_... functions consistently.
    
    Apps should use i_vars_blah(), libgeda uses i_vars_libgeda_blah().

diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index c606409..f37d708 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -105,7 +105,7 @@ void gschem_quit(void)
   o_undo_cleanup();
   /* s_stroke_free(); no longer needed */
 
-  i_vars_freenames();
+  i_vars_libgeda_freenames();
 
   /* x_window_free_head(); can't do this since it causes a
    * condition in which window_head->... is still being refered
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index b6a7927..74ba621 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -58,7 +58,7 @@ gboolean g_get_data_from_page_smob(SCM object_smob, TOPLEVEL **toplevel,
 
 /* i_vars.c */
 void i_vars_libgeda_set(TOPLEVEL *toplevel);
-void i_vars_freenames();
+void i_vars_libgeda_freenames();
 
 /* gdk-pixbuf-hacks.c */
 GdkPixbuf *gdk_pixbuf_rotate (GdkPixbuf *pixbuf, guint angle);
diff --git a/libgeda/src/i_vars.c b/libgeda/src/i_vars.c
index b79649d..87a3906 100644
--- a/libgeda/src/i_vars.c
+++ b/libgeda/src/i_vars.c
@@ -99,7 +99,7 @@ void i_vars_libgeda_set(TOPLEVEL *toplevel)
  *  This function will free all of the default variables for libgeda.
  *
  */
-void i_vars_freenames()
+void i_vars_libgeda_freenames()
 {
   g_free(default_series_name);
   g_free(default_untitled_name);

commit 0fe03039f1eda8b1c2aab1701948532513e920fe
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Wed Aug 13 22:38:44 2008 +0100

    gschem: Don't use default_scheme_directory.
    
    gschem uses default_scheme_directory to find gschem.scm. It doesn't
    need to, because libgeda should have already set the Guile load path
    correctly by this point.

diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 2ae8d51..c606409 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -136,6 +136,7 @@ void main_prog(void *closure, int argc, char *argv[])
   char *geda_data = NULL;
   char *filename;
   gboolean save_grid;
+  SCM scm_tmp;
 
 #ifdef HAVE_GTHREAD
   /* Gschem isn't threaded, but some of GTK's file chooser
@@ -226,8 +227,14 @@ void main_prog(void *closure, int argc, char *argv[])
   /* Now read in RC files. */
   g_rc_parse_gtkrc();
   g_rc_parse(w_current->toplevel, "gschemrc", rc_filename);
-  
-  input_str = g_build_filename (default_scheme_directory, "gschem.scm", NULL);
+
+  /* By this point, libgeda should have setup the Guile load path, so
+   * we can take advantage of that.  */
+  scm_tmp = scm_sys_search_load_path (scm_from_locale_string ("gschem.scm"));
+  if (scm_is_false (scm_tmp)) {
+    s_log_message (_("Couldn't find init scm file [%s]\n"), "gschem.scm");
+  }
+  input_str = scm_to_locale_string (scm_tmp);
   if (g_read_file(input_str) != -1) {
     s_log_message(_("Read init scm file [%s]\n"), input_str);
   } else {
@@ -236,7 +243,8 @@ void main_prog(void *closure, int argc, char *argv[])
     s_log_message(_("Failed to read init scm file [%s]\n"),
                   input_str);
   }
-  g_free(input_str);
+  free (input_str); /* M'allocated by scm_to_locale_string() */
+  scm_remember_upto_here_1 (scm_tmp);
 
   /* Load recent files list. This must be done
    * before calling x_window_setup(). */




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs