[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    Re: GIO API review
From:       Michael Natterer <mitch () imendio ! com>
Date:       2007-12-12 16:33:56
Message-ID: 47600D74.2000900 () imendio ! com
[Download RAW message or body]

Alexander Larsson wrote:
> On Tue, 2007-12-11 at 17:48 +0100, Michael Natterer wrote: 
>> G*Monitor:
>> ==========
>>
>> GFileMonitor      -> GIOMonitorFile
>> GDirectoryMonitor -> GIOMonitorDirectory
>>
>> Wouldn't it make sense to have a common (perhaps abstract) base class here,
>> or derive one from the other? The APIs are very similar at least.
> 
> They are very similar, but I'm not sure what advantage a common base
> class would have. Its not likely that you pass around an object that is
> either a file monitor or a directory monitor, so GMonitor would not be
> used anywhere.

Well the common base class would install the "changed" signal, it
would have cancel(), is_cancelles(), set_rate_limit() and emit_event()
APIs, they would share their properties, and they would share the code
instead of duplicating it.

GIOMonitor would simply be an abstract base class, and it doesn't
matter if you really need the polymorphy here (passing them around
around as Monitor instead of File or Directory monitor), the point
is that there is code duplication in two very similar classes,
that almost cries for a common base class.

ciao,
--mitch
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic