Sorry for the delay in response.

Tim Wunder <[EMAIL PROTECTED]> writes:
> Ugh... I appreciate your responding to my plea for help, but I really need 
> more basic and fundamental help than that. Assume I know /nothing/ about C 
> programming, and especially gtk+ programming. 

I hope that you didn't find all this too discouraging, and if you did, you'll
feel motivated to try again.


> I did some messing around to see if I could grok even a little of what you 
> told me (and what I read). Without much success, as indicated by:
> dialog-sx-since-last-run.c:981: warning: ISO C90 forbids mixed declarations 
> and code
> dialog-sx-since-last-run.c:982: warning: passing argument 1 
> of 'gtk_tree_model_filter_set_visible_func' from incompatible pointe
>
> I did this: 
> _gnc_slr_filter(GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
> {
>     // just playing around with a function call
>     gboolean SX_filter = 1;
>     return !SX_filter;
> }
>
> and then...
> //        gtk_tree_view_expand_all(dialog->instance_view);
>         GtkTreeModel *filtered_model = 
> gtk_tree_model_filter_new(GTK_TREE_MODEL(dialog->editing_model), NULL);
>         
> gtk_tree_model_filter_set_visible_func(filtered_model,_gnc_slr_filter, 
> NULL, NULL);
>
> I'm sure what I've done isn't even close to what's supposed to be done, but 
> I'm old, so choose your clue bat with care. ;)  Don't I need to pass 
> variables when calling functions or something?

When you use a function pointer like this, you're not actually calling the
function ... you're just passing the pointer to the function for something
else (the GtkTreeModel, in this case) to invoke.  When it does eventually
call the function, it do need to pass arguments ... and it's going to pass
exactly the parameters that are expected of functions that fit the
"visible_func" signature.


> Also, how do I query the model (?) to determine its state (autocreate, 
> to-create, reminder, etc...)?

The filter function only has access to its parameters; its "model" param is
generically a GtkTreeModel, but you (and the code) can assume it's actually a
GncSxSlrTreeModelAdapter.  This class has the GncSxInstanceModel that it's
adapting as the field "instances".

From a GtkIter one can get a GtkPath, which has specific indices; these
indices can then be used as list indices into the GncSxInstanceModel (and its
contained objects), to get the specific GncSxInstance that the GtkIter for a
row in the tree model corresponds to.

There is a convenience method in this file to do just those steps, taking the
model and an iter and translating it into the instance :)

    GncSxInstance*
    gnc_sx_slr_model_get_instance(GncSxSlrTreeModelAdapter *model, GtkTreeIter 
*iter)


Once you have the relevant GncSxInstance*, the creation state is in the
fields:

    GncSxInstanceState orig_state;
    GncSxInstanceState state;

...on the GncSxInstance class/struct
(see src/app-util/gnc-sx-instance-model.h:98).

-- 
...jsled
http://asynchronous.org/ - a=jsled; b=asynchronous.org; echo [EMAIL PROTECTED]

Attachment: pgpllxl7jqJJ6.pgp
Description: PGP signature

_______________________________________________
gnucash-devel mailing list
gnucash-devel@gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel

Reply via email to