From: James L. <jrl...@co...> - 2006-01-28 22:39:42
|
Hi Jorg, As I was trying to integrate my new prefs backend into gtkpod for testing, I noticed that a lot of the prefs_set functions have to do special tasks (like checking the validity of a value, notifying a thread of a changed value, and some other stuff) That led me to wonder how I should handle these cases in the new backend. I thought about doing these kinds of things before calling the new set functions, but I really don't like that idea, because then we'd have to repeat code a lot. Instead, I thought about using a callback system. We could have a callback that looks something like this: gboolean prefs_callback(const gchar *key, const gchar *value); that would return TRUE to allow the value to be changed, and FALSE otherwise. We could have these callbacks set when we initialize default values. What do you think? James |
From: Jorg S. <Jor...@gm...> - 2006-02-01 13:42:38
|
Hi James, yes, I know that some of the prefs functions do some crazy stuff... I'm not sure it's a good idea to keep on doing this. E.g., when initializing the display, we should check for these values and take actions. Also, if some other functions have to be called in response to a prefs change, maybe the function changing the prefs should take care of this... That would be much cleaner. Range changes could be done in the prefs-reading function. So for now, just leave these functions alone until we have established the new prefs system. Step by step, I would say. Cheers, JCS. On Sat, Jan 28, 2006 at 02:02:18PM -0800, James Liggett wrote: > Hi Jorg, > As I was trying to integrate my new prefs backend into gtkpod for > testing, I noticed that a lot of the prefs_set functions have to do > special tasks (like checking the validity of a value, notifying a thread > of a changed value, and some other stuff) That led me to wonder how I > should handle these cases in the new backend. I thought about doing > these kinds of things before calling the new set functions, but I really > don't like that idea, because then we'd have to repeat code a lot. > Instead, I thought about using a callback system. We could have a > callback that looks something like this: > > gboolean prefs_callback(const gchar *key, const gchar *value); > > that would return TRUE to allow the value to be changed, and FALSE > otherwise. We could have these callbacks set when we initialize default > values. What do you think? > > James |
From: James L. <jrl...@co...> - 2006-02-03 03:32:48
|
On Wed, 2006-02-01 at 22:42 +0900, Jorg Schuler wrote: > Hi James, > > yes, I know that some of the prefs functions do some crazy stuff... > > I'm not sure it's a good idea to keep on doing this. You're probably right in most cases, but we'd probably have to look at each one individually and decide which ones really need all the special stuff, and which ones don't. But that could take a lot of time. > > E.g., when initializing the display, we should check for these values and > take actions. > > Also, if some other functions have to be called in response to a prefs > change, maybe the function changing the prefs should take care of this... > That would be much cleaner. Yeah it would...But what about cases where prefs get changed in more than one place? Also, the way I handle temp prefs would mean we'd have to do all of this stuff when we apply the prefs, and that would get nasty. It would be much better if the backend could do this automatically. > > Range changes could be done in the prefs-reading function. Maybe, but I'm not too keen on that idea at the moment. The way things are now, those functions are uniform and clean, and would never have to be modified, and I think we should do our best to keep it that way. If we're not careful here, I can see things getting awkward pretty quick. ;-) > > So for now, just leave these functions alone until we have established the > new prefs system. Step by step, I would say. That sounds ok for now. I will work around it for the moment over the weekend, but I'm trying to get over the flu right now so I'm kinda playing it by ear and seeing how I feel. I'm getting better though, so I'll see what I can do. And another thing: I'm thinking I'm going to need some help with all the transitions and such. Do you think you could help me out with this? Thanks! :) James |
From: Jorg S. <Jor...@gm...> - 2006-02-04 02:34:00
|
> > So for now, just leave these functions alone until we have established the > > new prefs system. Step by step, I would say. > That sounds ok for now. I will work around it for the moment over the > weekend, but I'm trying to get over the flu right now so I'm kinda > playing it by ear and seeing how I feel. I'm getting better though, so > I'll see what I can do. And another thing: I'm thinking I'm going to > need some help with all the transitions and such. Do you think you could > help me out with this? Thanks! :) You are probably right with all the other things you say (after all, you thought about it much more than I). Let's simply see which functions really are left at the end. Automatic callbacks on changes sound interesting -- let's see if it's necessary. Cheers, JCS. |