Re: menuitem activate



On Wed, May 23, 2007 at 12:38:58PM -0400, danielg Posting wrote:

I guess it'll be shorter to start from the beginning.  I'm messing around with
GimageView 0.2.27.

Last release 2.5 years ago?  No CVS commit in 2 years?
Sounds like a dead project to me.  I suggest not to waste
your efforts and to contribute to something alive instead.

I want it to auto-refresh the directory tree as new things
are added to the directory it starts from with the command line switches.

I can loop the reading of the directory all day, but if I do that the
refreshes take place before the program is ever drawn to the screen.  Not good.

I cannot do anything actively until after the program is drawn on the screen.

I can make the single click on the refresh button loop as often as I care to
do so.  Still, requires a click of the mouse.  How to eliminate that click.

I've put in a method (function?) that uses dnotify to print "something added"
and "something changed" in the starting xterm at the appropriate times.  Cool,
now I've got the automated part of notification done.

All I want it to do is refresh the directory side of the screen whenever
there's a change in the directories I've chosen.  There's already a refresh
directory method available.

I would love to call 
static void cb_refresh_dir_tree (DirView *dv, guint action, GtkWidget *menuitem)
directly, but I have no idea what the pointer to dv needs to be.  Well, what
does the call back call?

Now we are getting somewhere.

You have to find you what dv is, where is is constructed and
how to pass it where you set up the notify handler.

It could look like:

  dv = ... set up the dir view ...
  /* And here comes your part */
  setup_notify(dv, &refresh_me);

Where setup_notify() remembers dv, the function to call on
it, sets up the dnotify() notification (is dnotify() still
the preferred mechanism? I recall rumours of it being about
to be replaced from approx. 2 years ago) and does something
like

  g_signal_connect(dv, "destroy", G_CALLBACK(stop_notifying), NULL);

where stop_notifying() is a function to shut down
notification for dv and forget dv.  And refresh_me() just
does

static void
refresh_me(DirView *dv)
{
    cb_refresh_dir_tree(dv, NULL);
}

I don't know what the lifetime rules are for the directory
views or whether more of them can be present, but this
scheme can work quite generally.  You can employ a more
general callback mechanism, but this should be sufficient in
your case.

Yeti

--
http://gwyddion.net/



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