[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: branch: master updated (1.1.2.20070818-122-g0c2871d)
The branch, master has been updated
via 0c2871d04305a0fcaf3b6b45a1317a491594a3f4 (commit)
via 7a2ad70e9880b77957dd44d850ae85a08d615640 (commit)
via 5cb63878f258bc836a9908b329608268c38cf64c (commit)
via 7228144a2195734300776a868ee88ee648a93df8 (commit)
from 019d53dce27bdbbb9871510ce34bb995664290c2 (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/prototype.h | 1 -
gschem/src/gschem.c | 2 +-
gschem/src/i_basic.c | 4 +-
gschem/src/i_callbacks.c | 6 ++--
gschem/src/x_menus.c | 2 +-
gschem/src/x_window.c | 84 ++++++++++++++++++++-----------------------
libgeda/include/prototype.h | 2 +-
libgeda/src/s_clib.c | 74 +++++++++++++++++++++-----------------
8 files changed, 88 insertions(+), 87 deletions(-)
=================
Commit Messages
=================
commit 0c2871d04305a0fcaf3b6b45a1317a491594a3f4
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:18 2007 +0000
clib: Clarify naming for search cache
:100644 100644 ede03ef... 7f4665f... M libgeda/include/prototype.h
:100644 100644 bee7be8... aa1f336... M libgeda/src/s_clib.c
commit 7a2ad70e9880b77957dd44d850ae85a08d615640
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:18 2007 +0000
libgeda: Clean g_assert usage in s_clib.c
:100644 100644 28e2878... bee7be8... M libgeda/src/s_clib.c
commit 5cb63878f258bc836a9908b329608268c38cf64c
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:16 2007 +0000
gschem: Fix new page behaviour
Currently, gschem attempts to load "untitled-1.sch" from the cwd at
startup. This is clearly wrong -- gschem should present a blank page
regardless of whether there is a page available on disk (consider
behaviour for "untitled-N.sch", N>1).
This has the side effect of stopping gschem from trying to load backup
files for new pages (this is a good thing).
:100644 100644 77eda03... 4fbf87b... M gschem/include/prototype.h
:100644 100644 8188354... be96edf... M gschem/src/gschem.c
:100644 100644 10cbb59... 1c962cd... M gschem/src/i_callbacks.c
:100644 100644 de2645f... 598f15b... M gschem/src/x_window.c
commit 7228144a2195734300776a868ee88ee648a93df8
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 00:29:15 2007 +0000
gschem: Fix "failed to set sensitivity" log spam
A bad string in i_basic.c was making x_menus_sensitivity() spam error
messages to the log. Altered the log message to make it easier to fix
in the future.
Bug was introduced in commit 93199b2f50c31691722ed154fc42fd4c01a2dac5
by editing menu definitions in system-gschemrc without updating
i_basic.c.
:100644 100644 9a6a3c4... e8253d3... M gschem/src/i_basic.c
:100644 100644 2fd0ed3... 0c97ee9... M gschem/src/x_menus.c
=========
Changes
=========
commit 0c2871d04305a0fcaf3b6b45a1317a491594a3f4
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:18 2007 +0000
clib: Clarify naming for search cache
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index ede03ef..7f4665f 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -487,7 +487,7 @@ gchar *s_clib_symbol_get_filename (const CLibSymbol *symbol);
const CLibSource *s_clib_symbol_get_source (const CLibSymbol *symbol);
gchar *s_clib_symbol_get_data (const CLibSymbol *symbol);
GList *s_clib_search (const gchar *pattern, const CLibSearchMode mode);
-void s_clib_flush_cache ();
+void s_clib_flush_search_cache ();
const CLibSymbol *s_clib_get_symbol_by_name (const gchar *name);
gchar *s_clib_symbol_get_data_by_name (const gchar *name);
GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel);
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index bee7be8..aa1f336 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -205,7 +205,7 @@ struct _CLibSymbol {
static GList *clib_sources = NULL;
/*! Caches results of s_clib_search() */
-static GHashTable *clib_cache = NULL;
+static GHashTable *clib_search_cache = NULL;
/* Local static functions
* ======================
@@ -238,13 +238,13 @@ void s_clib_init ()
s_clib_free ();
}
- if (clib_cache != NULL) {
- s_clib_flush_cache();
+ if (clib_search_cache != NULL) {
+ s_clib_flush_search_cache();
} else {
- clib_cache = g_hash_table_new_full ((GHashFunc) g_str_hash,
- (GEqualFunc)g_str_equal,
- (GDestroyNotify) g_free,
- (GDestroyNotify) g_list_free);
+ clib_search_cache = g_hash_table_new_full ((GHashFunc) g_str_hash,
+ (GEqualFunc)g_str_equal,
+ (GDestroyNotify) g_free,
+ (GDestroyNotify) g_list_free);
}
}
@@ -571,7 +571,7 @@ static void refresh_directory (CLibSource *source)
source->symbols = g_list_sort (source->symbols,
(GCompareFunc) compare_symbol_name);
- s_clib_flush_cache();
+ s_clib_flush_search_cache();
}
/*! \brief Re-poll a library command for symbols.
@@ -633,7 +633,7 @@ static void refresh_command (CLibSource *source)
source->symbols = g_list_sort (source->symbols,
(GCompareFunc) compare_symbol_name);
- s_clib_flush_cache();
+ s_clib_flush_search_cache();
}
/*! \brief Re-poll a scheme procedure for symbols.
@@ -688,7 +688,7 @@ static void refresh_scm (CLibSource *source)
source->symbols = g_list_sort (source->symbols,
(GCompareFunc) compare_symbol_name);
- s_clib_flush_cache();
+ s_clib_flush_search_cache();
}
/*! \brief Rescan all available component libraries.
@@ -1153,7 +1153,7 @@ GList *s_clib_search (const gchar *pattern, const CLibSearchMode mode)
key = g_strdup_printf("%c%s", keytype, pattern);
/* Check to see if the query is already in the cache */
- result = (GList *) g_hash_table_lookup (clib_cache, key);
+ result = (GList *) g_hash_table_lookup (clib_search_cache, key);
if (result != NULL) {
g_free (key);
return g_list_copy (result);
@@ -1197,7 +1197,7 @@ GList *s_clib_search (const gchar *pattern, const CLibSearchMode mode)
g_pattern_spec_free (globpattern);
}
- g_hash_table_insert (clib_cache, key, g_list_copy (result));
+ g_hash_table_insert (clib_search_cache, key, g_list_copy (result));
/* __don't__ free key here, it's stored by the hash table! */
return result;
@@ -1220,12 +1220,12 @@ static gboolean remove_entry(gpointer key, gpointer val, gpointer data)
* You shouldn't ever need to call this, as all functions which
* invalidate the cache are supposed to make sure it's flushed.
*/
-void s_clib_flush_cache ()
+void s_clib_flush_search_cache ()
{
#if GLIB_CHECK_VERSION(2,12,0)
- g_hash_table_remove_all (clib_cache); /* Introduced in glib 2.12 */
+ g_hash_table_remove_all (clib_search_cache); /* Introduced in glib 2.12 */
#else
- g_hash_table_foreach_remove(clib_cache, remove_entry, NULL);
+ g_hash_table_foreach_remove(clib_search_cache, remove_entry, NULL);
#endif
}
commit 7a2ad70e9880b77957dd44d850ae85a08d615640
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:18 2007 +0000
libgeda: Clean g_assert usage in s_clib.c
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index 28e2878..bee7be8 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -387,7 +387,9 @@ static gchar *run_source_command (const gchar *command)
gint exit_status;
GError *e = NULL;
gboolean success = FALSE;
-
+
+ g_return_val_if_fail((command != NULL), NULL);
+
g_spawn_command_line_sync (command,
&standard_output,
&standard_error,
@@ -512,8 +514,8 @@ static void refresh_directory (CLibSource *source)
gboolean isfile;
GError *e = NULL;
- g_assert (source != NULL);
- g_assert (source->type == CLIB_DIR);
+ g_return_if_fail (source != NULL);
+ g_return_if_fail (source->type == CLIB_DIR);
/* Clear the current symbol list */
g_list_foreach (source->symbols, (GFunc) free_symbol, NULL);
@@ -587,8 +589,8 @@ static void refresh_command (CLibSource *source)
CLibSymbol *symbol;
gchar *name;
- g_assert (source != NULL);
- g_assert (source->type == CLIB_CMD);
+ g_return_if_fail (source != NULL);
+ g_return_if_fail (source->type == CLIB_CMD);
/* Clear the current symbol list */
g_list_foreach (source->symbols, (GFunc) free_symbol, NULL);
@@ -647,8 +649,8 @@ static void refresh_scm (CLibSource *source)
SCM symname;
CLibSymbol *symbol;
- g_assert (source != NULL);
- g_assert (source->type == CLIB_SCM);
+ g_return_if_fail (source != NULL);
+ g_return_if_fail (source->type == CLIB_SCM);
/* Clear the current symbol list */
g_list_foreach (source->symbols, (GFunc) free_symbol, NULL);
@@ -720,7 +722,9 @@ void s_clib_refresh ()
refresh_scm (source);
break;
default:
- g_assert_not_reached();
+ g_critical("s_clib_refresh: source %p has bad source type %i\n",
+ source, (gint) source->type);
+ break;
}
}
}
@@ -991,8 +995,8 @@ static gchar *get_data_directory (const CLibSymbol *symbol)
gchar *data = NULL;
GError *e = NULL;
- g_assert (symbol != NULL);
- g_assert (symbol->source->type == CLIB_DIR);
+ g_return_val_if_fail ((symbol != NULL), NULL);
+ g_return_val_if_fail ((symbol->source->type == CLIB_DIR), NULL);
filename = g_build_filename(symbol->source->directory,
symbol->name, NULL);
@@ -1024,8 +1028,8 @@ static gchar *get_data_command (const CLibSymbol *symbol)
gchar *command;
gchar *result;
- g_assert (symbol != NULL);
- g_assert (symbol->source->type == CLIB_CMD);
+ g_return_val_if_fail ((symbol != NULL), NULL);
+ g_return_val_if_fail ((symbol->source->type == CLIB_CMD), NULL);
command = g_strdup_printf ("%s %s", symbol->source->get_cmd,
symbol->name);
@@ -1051,8 +1055,8 @@ static gchar *get_data_scm (const CLibSymbol *symbol)
{
SCM symdata;
- g_assert (symbol != NULL);
- g_assert (symbol->source->type == CLIB_SCM);
+ g_return_val_if_fail ((symbol != NULL), NULL);
+ g_return_val_if_fail ((symbol->source->type == CLIB_SCM), NULL);
symdata = scm_call_1 (symbol->source->get_fn,
scm_from_locale_string (symbol->name));
@@ -1079,7 +1083,8 @@ static gchar *get_data_scm (const CLibSymbol *symbol)
*/
gchar *s_clib_symbol_get_data (const CLibSymbol *symbol)
{
- g_assert (symbol != NULL);
+ g_return_val_if_fail ((symbol != NULL), NULL);
+ g_return_val_if_fail ((symbol->source != NULL), NULL);
switch (symbol->source->type)
{
@@ -1090,7 +1095,9 @@ gchar *s_clib_symbol_get_data (const CLibSymbol *symbol)
case CLIB_SCM:
return get_data_scm (symbol);
default:
- g_assert_not_reached();
+ g_critical("s_clib_symbol_get_data: source %p has bad source type %i\n",
+ symbol->source, (gint) symbol->source->type);
+ return NULL;
}
}
@@ -1140,7 +1147,8 @@ GList *s_clib_search (const gchar *pattern, const CLibSearchMode mode)
keytype = 's';
break;
default:
- g_assert_not_reached();
+ g_critical ("s_clib_search: Bad search mode %i\n", mode);
+ return NULL;
}
key = g_strdup_printf("%c%s", keytype, pattern);
@@ -1307,7 +1315,7 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel)
CLibSymbol *sym = NULL;
const GList *p_iter;
- g_assert (toplevel != NULL);
+ g_return_val_if_fail ((toplevel != NULL), NULL);
for ( p_iter = geda_list_get_glist( toplevel->pages );
p_iter != NULL;
commit 5cb63878f258bc836a9908b329608268c38cf64c
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 01:29:16 2007 +0000
gschem: Fix new page behaviour
Currently, gschem attempts to load "untitled-1.sch" from the cwd at
startup. This is clearly wrong -- gschem should present a blank page
regardless of whether there is a page available on disk (consider
behaviour for "untitled-N.sch", N>1).
This has the side effect of stopping gschem from trying to load backup
files for new pages (this is a good thing).
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 77eda03..4fbf87b 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -844,7 +844,6 @@ void x_window_setup_draw_events(GSCHEM_TOPLEVEL *w_current);
void x_window_create_main(GSCHEM_TOPLEVEL *w_current);
void x_window_close(GSCHEM_TOPLEVEL *w_current);
void x_window_close_all(GSCHEM_TOPLEVEL *w_current);
-PAGE *x_window_open_untitled_page (GSCHEM_TOPLEVEL *w_current);
PAGE *x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename);
void x_window_set_current_page (GSCHEM_TOPLEVEL *w_current, PAGE *page);
gint x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filename);
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 8188354..be96edf 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -305,7 +305,7 @@ void main_prog(void *closure, int argc, char *argv[])
/* If no page has been loaded (wasn't specified in the command line.) */
/* Then create an untitled page */
if ( first_page ) {
- x_window_open_untitled_page( w_current );
+ x_window_open_page( w_current, NULL );
}
/* Update the window to show the current page */
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 10cbb59..1c962cd 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -188,7 +188,7 @@ DEFINE_I_CALLBACK(file_new)
exit_if_null (w_current);
/* create a new page */
- page = x_window_open_untitled_page (w_current);
+ page = x_window_open_page (w_current, NULL);
x_window_set_current_page (w_current, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
}
@@ -224,7 +224,7 @@ DEFINE_I_CALLBACK(file_new_window)
w_current->toplevel = s_toplevel_new ();
x_window_setup (w_current);
- page = x_window_open_untitled_page (w_current);
+ page = x_window_open_page (w_current, NULL);
x_window_set_current_page (w_current, page);
s_log_message (_("New Window created [%s]\n"), page->page_filename);
}
@@ -1743,7 +1743,7 @@ DEFINE_I_CALLBACK(page_new)
exit_if_null(w_current);
/* create a new page */
- page = x_window_open_untitled_page (w_current);
+ page = x_window_open_page (w_current, NULL);
x_window_set_current_page (w_current, page);
s_log_message (_("New page created [%s]\n"), page->page_filename);
}
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index de2645f..598f15b 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -744,42 +744,6 @@ void x_window_close_all(GSCHEM_TOPLEVEL *w_current)
g_list_free (list_copy);
}
-/*! \brief Opens a new untitled page.
- * \par Function Description
- * This function creates an empty, untitled page in <B>toplevel</B>.
- *
- * It returns a pointer on the new page.
- *
- * The new page becomes the current page of <B>toplevel</B>.
- *
- * The name of the untitled page is build from configuration data
- * ('untitled-name') and a counter for uniqueness.
- *
- * \param [in] toplevel The toplevel environment.
- * \returns A pointer on the new page.
- */
-PAGE*
-x_window_open_untitled_page (GSCHEM_TOPLEVEL *w_current)
-{
- TOPLEVEL *toplevel = w_current->toplevel;
- PAGE *page;
- gchar *cwd, *tmp, *filename;
-
- cwd = g_get_current_dir ();
- tmp = g_strdup_printf ("%s_%d.sch",
- toplevel->untitled_name,
- ++w_current->num_untitled);
-
- filename = g_build_filename (cwd, tmp, NULL);
- g_free (cwd);
- g_free (tmp);
-
- page = x_window_open_page (w_current, filename);
- g_free (filename);
-
- return page;
-}
-
/*! \brief Opens a new page from a file.
* \par Function Description
* This function opens the file whose name is <B>filename</B> in a
@@ -790,34 +754,63 @@ x_window_open_untitled_page (GSCHEM_TOPLEVEL *w_current)
* a pointer on the new page. Otherwise it returns a pointer on the
* existing page.
*
+ * If the filename passed is NULL, this function creates an empty,
+ * untitled page. The name of the untitled page is build from
+ * configuration data ('untitled-name') and a counter for uniqueness.
+ *
* The opened page becomes the current page of <B>toplevel</B>.
*
* \param [in] toplevel The toplevel environment.
- * \param [in] filename The name of the file to open.
+ * \param [in] filename The name of the file to open or NULL for a blank page.
* \returns A pointer on the new page.
+ *
+ * \bug This code should check to make sure any untitled filename
+ * does not conflict with a file on disk.
*/
PAGE*
x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename)
{
TOPLEVEL *toplevel = w_current->toplevel;
PAGE *old_current, *page;
+ gchar *fn;
g_return_val_if_fail (toplevel != NULL, NULL);
- g_return_val_if_fail (filename != NULL, NULL);
+
+ /* Generate untitled filename if none was specified */
+ if (filename == NULL) {
+ gchar *cwd, *tmp;
+ cwd = g_get_current_dir ();
+ tmp = g_strdup_printf ("%s_%d.sch",
+ toplevel->untitled_name,
+ ++w_current->num_untitled);
+ fn = g_build_filename (cwd, tmp, NULL);
+ g_free(cwd);
+ g_free(tmp);
+ } else {
+ fn = g_strdup (filename);
+ }
/* Return existing page if it is already loaded */
- page = s_page_search (toplevel, filename);
+ page = s_page_search (toplevel, fn);
if ( page != NULL )
return page;
old_current = toplevel->page_current;
- page = s_page_new (toplevel, filename);
+ page = s_page_new (toplevel, fn);
s_page_goto (toplevel, page);
- if (!quiet_mode)
- printf(_("Loading schematic [%s]\n"), filename);
+ /* Load from file if necessary, otherwise just print a message */
+ if (filename == NULL) {
+ if (!quiet_mode)
+ s_log_message (_("Loading schematic [%s]\n"), fn);
- f_open (toplevel, (gchar *) filename);
+ f_open (toplevel, (gchar *) fn);
+ recent_files_add (fn);
+ } else {
+ if (!quiet_mode)
+ s_log_message (_("New file [%s]\n"),
+ toplevel->page_current->page_filename);
+ }
if (scm_hook_empty_p (new_page_hook) == SCM_BOOL_F)
scm_run_hook (new_page_hook,
@@ -838,7 +831,8 @@ x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename)
* it will get done in x_window_set_current_page(...)
*/
x_pagesel_update (w_current); /* ??? */
- recent_files_add(filename);
+
+ g_free (fn);
return page;
}
@@ -1010,7 +1004,7 @@ x_window_close_page (GSCHEM_TOPLEVEL *w_current, PAGE *page)
/* Create a new page if there wasn't another to switch to */
if (new_current == NULL) {
- new_current = x_window_open_untitled_page (w_current);
+ new_current = x_window_open_page (w_current, NULL);
}
/* change to new_current and update display */
commit 7228144a2195734300776a868ee88ee648a93df8
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date: Thu Nov 29 00:29:15 2007 +0000
gschem: Fix "failed to set sensitivity" log spam
A bad string in i_basic.c was making x_menus_sensitivity() spam error
messages to the log. Altered the log message to make it easier to fix
in the future.
Bug was introduced in commit 93199b2f50c31691722ed154fc42fd4c01a2dac5
by editing menu definitions in system-gschemrc without updating
i_basic.c.
diff --git a/gschem/src/i_basic.c b/gschem/src/i_basic.c
index 9a6a3c4..e8253d3 100644
--- a/gschem/src/i_basic.c
+++ b/gschem/src/i_basic.c
@@ -413,7 +413,7 @@ void i_update_menus(GSCHEM_TOPLEVEL *w_current)
x_menus_sensitivity(w_current, "Buffer/Cut into 5", TRUE);
x_menus_sensitivity(w_current, "Hierarchy/Down Schematic", TRUE);
x_menus_sensitivity(w_current, "Hierarchy/Down Symbol", TRUE);
- x_menus_sensitivity(w_current, "Hierarchy/Documentation", TRUE);
+ x_menus_sensitivity(w_current, "Hierarchy/Documentation...", TRUE);
x_menus_sensitivity(w_current, "Attributes/Attach", TRUE);
x_menus_sensitivity(w_current, "Attributes/Detach", TRUE);
x_menus_sensitivity(w_current, "Attributes/Show Value", TRUE);
@@ -460,7 +460,7 @@ void i_update_menus(GSCHEM_TOPLEVEL *w_current)
x_menus_sensitivity(w_current, "Buffer/Cut into 5", FALSE);
x_menus_sensitivity(w_current, "Hierarchy/Down Schematic", FALSE);
x_menus_sensitivity(w_current, "Hierarchy/Down Symbol", FALSE);
- x_menus_sensitivity(w_current, "Hierarchy/Documentation", FALSE);
+ x_menus_sensitivity(w_current, "Hierarchy/Documentation...", FALSE);
x_menus_sensitivity(w_current, "Attributes/Attach", FALSE);
x_menus_sensitivity(w_current, "Attributes/Detach", FALSE);
x_menus_sensitivity(w_current, "Attributes/Show Value", FALSE);
diff --git a/gschem/src/x_menus.c b/gschem/src/x_menus.c
index 2fd0ed3..0c97ee9 100644
--- a/gschem/src/x_menus.c
+++ b/gschem/src/x_menus.c
@@ -330,7 +330,7 @@ void x_menus_sensitivity (GSCHEM_TOPLEVEL *w_current, const char *buf, int flag)
gtk_widget_set_sensitive(GTK_WIDGET(item), flag);
/* free(item); */ /* Why doesn't this need to be freed? */
} else {
- s_log_message(_("Tried to set the sensitivity on a non-existent menu item\n"));
+ s_log_message(_("Tried to set the sensitivity on non-existent menu item '%s'\n"), buf);
}
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs