On Wed, 2008-10-08 at 15:02 +0200, Werner Hoch wrote:
> Hi Peter C,
> As Peter B. wrote, maybe the o_complex_get_promotable function should
> just be a filter for an generic function that returns a list of
> toplevel attribute objects.
>
> Thus the change of the component dialog wouldn't be required.
I lost track already.. I thought we weren't looking specifically for
promotable attributes. Clearly, the component selector uses a different
filtering, so there is no need to re-use o_complex_get_promotable() for
the component selector, and no immediate need to touch that code.
I'm still not sure why you're putting filters on the display list of
attributes though... surely the whole point is to show what attributes a
symbols has, not just "some" of them.
The only filtering I can imagine being useful is a "negative" filter
action, so, for example, - if I picked out an attribute and had a
different way of previewing it (footprint=, or some documentation=
hyperlink for example), I wouldn't repeat it in the list).
We can't possibly list every attribute every user might want to display
in the list, so I think the default ought to be an unfiltered view.
Regarding code:
+ for (i=0; i < length; i++) {
+ SCM_ASSERT(scm_is_string(scm_list_ref(stringlist, scm_from_int(i))),
+ scm_list_ref(stringlist, scm_from_int(i)), SCM_ARG1,
+ "list element is not a string");
+ attr = g_strdup(SCM_STRING_CHARS(scm_list_ref(stringlist,
scm_from_int(i))));
+ list = g_list_append(list, attr);
+ }
The typical idiom (faster for long lists) is to use g_list_prepend()
then g_list_reverse() at the end. For the number of items here, it
probably doesn't really matter.
+ /* If the command is called multiple times, remove the old list and replace
it
+ with the new one */
+ for (iter = default_component_select_attrlist;
+ iter != NULL;
+ iter = g_list_next(iter))
+ g_free(iter->data);
+ g_list_free(default_component_select_attrlist);
You could do this easier:
g_list_foreach (default_component_select_attrlist, g_free, NULL);
g_list_free (default_component_select_attrlist);
*Relying on the fact that I can call a function with a shorter argument
signature, and it still works. The foreach callback function actually
has a userdata argument, but it doesn't matter if we specify g_free. You
might need to cast it to (GFunc) if the compiler warns though.
+ if (o_attrib_get_name_value(object->text->string, &name, &value)) {
+ if (g_str_has_prefix(name, listiter->data)
+ && strlen(name) == strlen(listiter->data)) {
strcmp(name, listiter->data) == 0 ?
+ }
+ else {
Indentation bug / typo.
Are you using stgit? It would be about perfect for rolling any desired
changes into these patches.
--
Peter Clifton
Electrical Engineering Division,
Engineering Department,
University of Cambridge,
9, JJ Thomson Avenue,
Cambridge
CB3 0FA
Tel: +44 (0)7729 980173 - (No signal in the lab!)
_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev