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

gEDA-cvs: CVS update: g_rc.c



  User: peterb  
  Date: 07/05/28 03:46:11

  Modified:    .        g_rc.c s_clib.c
  Log:
  Provide better names for component sources.
  
  
  
  Full pathnames aren't very user-friendly in the component
  
  browser, and sometimes the name you want for your
  
  component source isn't the same as the directory name. This
  
  patch provides an infrastructure for better source naming,
  
  while falling back to the "classic" behaviour if necessary.
  
  
  
  
  Revision  Changes    Path
  1.3                  eda/geda/gaf/libgeda/src/g_rc.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: g_rc.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/g_rc.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- g_rc.c	15 Jul 2006 17:00:51 -0000	1.2
  +++ g_rc.c	28 May 2007 07:46:11 -0000	1.3
  @@ -365,7 +365,7 @@
     }
   
     if (g_path_is_absolute (string)) {
  -    s_clib_add_directory (string);
  +    s_clib_add_directory (string, NULL);
     } else {
       gchar *cwd = g_get_current_dir ();
       gchar *temp;
  @@ -373,7 +373,7 @@
       u_basic_strip_trailing(cwd, G_DIR_SEPARATOR);
   #endif
       temp = g_strconcat (cwd, G_DIR_SEPARATOR_S, string, NULL);
  -    s_clib_add_directory (temp);
  +    s_clib_add_directory (temp, NULL);
       g_free(temp);
       g_free(cwd);
     }
  @@ -436,7 +436,7 @@
   
         if (g_file_test (fullpath, G_FILE_TEST_IS_DIR)) {
           if (g_path_is_absolute (fullpath)) {
  -          s_clib_add_directory (fullpath);
  +          s_clib_add_directory (fullpath, NULL);
           } else {
             gchar *cwd = g_get_current_dir ();
             gchar *temp;
  @@ -447,7 +447,7 @@
                                 G_DIR_SEPARATOR_S,
                                 fullpath,
                                 NULL);
  -          s_clib_add_directory (temp);
  +          s_clib_add_directory (temp, NULL);
             g_free(temp);
             g_free(cwd);
           }
  
  
  
  1.21                 eda/geda/gaf/libgeda/src/s_clib.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_clib.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/s_clib.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -b -r1.20 -r1.21
  --- s_clib.c	28 May 2007 07:37:49 -0000	1.20
  +++ s_clib.c	28 May 2007 07:46:11 -0000	1.21
  @@ -169,6 +169,8 @@
     enum CLibSourceType type;
     /*! Path to directory or name of executable */
     gchar *path_cmd;
  +  /*! Name of source */
  +  gchar *name;
     /*! Available symbols (CLibSymbol) */
     GList *symbols;
   };
  @@ -247,6 +249,10 @@
         g_free (source->path_cmd);
         source->path_cmd = NULL;
       }
  +    if (source->name != NULL) {
  +      g_free (source->name);
  +      source->name = NULL;
  +    }
       if (source->symbols != NULL) {
         g_list_foreach (source->symbols, (GFunc) free_symbol, NULL);
         g_list_free (source->symbols);
  @@ -575,12 +581,16 @@
    *  \par Function Description
    *  Adds a directory containing symbol files to the library.  Only
    *  files ending with #SYM_FILENAME_FILTER are considered to be symbol
  - *  files.
  + *  files.  A \a name may be specified for the source; if \a name is
  + *  \b NULL, the basename of the directory as returned by
  + *  g_path_get_basename() is used.
    *
    *  \param directory The path of the directory to add (UTF8).
  + *  \param name      A descriptive name for the directory.
    *  \return The #CLibSource associated with the directory.
    */
  -const CLibSource *s_clib_add_directory (const gchar *directory)
  +const CLibSource *s_clib_add_directory (const gchar *directory, 
  +					const gchar *name)
   {
     CLibSource *source;
   
  @@ -595,6 +605,12 @@
     source->type = CLIB_DIR;
     source->path_cmd = g_strdup (directory);
     
  +  if (name == NULL) {
  +    source->name = g_path_get_basename (directory);
  +  } else {
  +    source->name = g_strdup(name);
  +  }
  +
     refresh_directory (source);
   
     /* Sources added later get scanned earlier */
  @@ -605,15 +621,18 @@
   
   /*! \brief Add a symbol-generating command to the library
    *  \par Function Description
  - *  Adds a command which can generate symbols to the library.
  - *  See page \ref libcmds for more information on library commands.
  + *  Adds a command which can generate symbols to the library.  See
  + *  page \ref libcmds for more information on library commands.  A \a
  + *  name may be specified for the source; if \a name is \b NULL, the
  + *  command is used as the name.
    *
    *  \param command The executable to run, resolved using the \b PATH
    *                 environment variable.
  - *
  + *  \param name    A descriptive name for the command.
    *  \return The CLibSource associated with the command.
    */
  -const CLibSource *s_clib_add_command (const gchar *command)
  +const CLibSource *s_clib_add_command (const gchar *command,
  +				      const gchar *name)
   {
     CLibSource *source;
     
  @@ -628,6 +647,12 @@
     source->type = CLIB_CMD;
     source->path_cmd = g_strdup (command);
   
  +  if (name == NULL) {
  +    source->name = g_strdup (command);
  +  } else {
  +    source->name = g_strdup (name);
  +  }
  +
     refresh_command (source);
   
     /* Sources added later get scanned earlier */
  @@ -650,7 +675,7 @@
   const gchar *s_clib_source_get_name (const CLibSource *source)
   {
     if (source == NULL) return NULL;
  -  return source->path_cmd;
  +  return source->name;
   }
   
   /*! \brief Get a list of symbols available from a given source.
  
  
  


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