Re: [sabayon] What happens when a profile is saved?



On Fri, 2005-03-11 at 09:38 +0000, Mark McLoughlin wrote:
> Hi John,
> 	Yeah, you've got it all right. Delegates don't have a sync_changes()
> method because the Panel delegate didn't need it, basically.
> 
> 	I'll fix that now.

	Okay, I've committed this:

---
2005-03-11  Mark McLoughlin  <markmc redhat com>

        * lib/userprofile.py:
        (SourceDelegate.sync_changes),
        (SourceDelegate.apply): add stubs for these delegate
        methods.
        (UserProfile.apply): invoke sync_changes() on each
        of the delegates after invoking it on the source.

        * lib/sources/mozillasource.py:
        (MozillaDelegate.sync_changes),
        (MozillaDelegate.commit_change),
        (MozillaDelegate.apply): add empty stubs.

        * lib/sources/paneldelegate.py:
        (PanelDelegate.sync_changes): add empty stub.

---

	This is the way I'd imagine it working for the mozilla delegate:

  + commit_change() would queue the change up for saving, noting 
    whether it should be saved as mandatory or default

  + sync_changes() would create two files - .mozilla/prefs-default.js
    and .mozilla/prefs-mandatory.js - and save all the queued changes 
    there, along with the existing contents of those files.

    e.g. I'd imagine the delegate is constructed it would extract and
    parse both those files, saving the contents in separate dicts. When
    you commit a change, you just add it to one of those dicts and when
    you sync the changes, you just save the dicts back to the files and
    call storage.add() on them again.

  + apply() would extact both of the files, merge the contents of 
    prefs-mandatory.js unconditionally into the the user's prefs.js and 
    only merge settings from prefs-default.js which don't already exist
    in prefs.js.

Cheers,
Mark.




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