It's not the original data that I can't hold onto, it's the user-changed data 
I'm loosing.  I have the original at my disposal freely.  It's not in a 
database, but it's in a very, very, very gimungous shared memory segment with 
lookup functions, and just like in a database, these are arrays of structures 
within structures, giving me the same mechanism as a parent-child relationship.

I can do the equivalent of a rollback here.  In fact, if I do nothing, that's 
the default.  The problem is, I have a flag that tells me the user changed 
something.  I may not know what, but I know that they changed something.  I'm 
just trying to tell them they're about to loose their changes because they 
forgot to save.  If it were one or two values, no great loss.  But among the 
hundreds of values, I think the user would cuss like a sailor.  I know I would. 
 Even if I knew I was to blame, I'd think twice before I came back to this 
software since I know there's a better (safer) implementation.  If you've ever 
read "Why Software Sucks", I'm trying to reduce the suckage here.

The worst part is, the documentation on the change-value signal of the range 
object sounds like just what I need when you set the return value to TRUE.  
Only it doesn't work.  Being quite a noob, I'm sure I'm doing something wrong, 
but I can't seem to find a clue anywhere.

> -----Original Message-----
> From: David Nečas [mailto:y...@physics.muni.cz] 
> Sent: Monday, August 10, 2009 3:12 PM
> To: Boggess Rod
> Cc: Gtk app list
> Subject: Re: Can't quite get my head around this, can anyone help?
> 
> On Mon, Aug 10, 2009 at 02:52:56PM -0400, Boggess Rod wrote:
> > BTDT.  Won't work because by then, the user-value I'm trying not to 
> > loose would already be lost.
> 
> It would not if you kept the original value elsewhere as suggested.
> 
> > I would have thought this was a somewhat popular function, 
> especially 
> > when processing records from a database.  But I don't seem to know 
> > what to search for.  I can seem to find one single example anywhere 
> > that makes use of the change-value signal.
> 
> Databases have commit/rollback mechanisms so you usually 
> don't need to implement your own in Gtk+.  Even if they don't 
> they can always serve as the `elsehwere' that contains the 
> original value.
> 
> The 'change-value' signal is not what you need.  The signal 
> is something few people need that's why you cannot find examples...
> 
> 1) You have the original value because you had it when the 
> dialog was created.  You just need to keep it somewhere.  The 
> simplest method is to work on a copy of the dialog model (in 
> MVC sense), leaving the original intact.
> 
> 2) When the user moves the slider, it should really move (so, 
> no 'change-value').  Signal 'value-changed' is emitted and 
> you change the value in the dialog model working copy.
> 
> 3) If the user accepts the changes replace the original model 
> with the values from the working copy.  If he does not just 
> discard it.
> 
> Yeti
> 
> 
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to