Re: GTK+ Application class



Hi;

On Wed, 2006-10-25 at 16:07 +0200, Rodrigo Moya wrote:
>  
> > Not every application has the same needs; but many of them use the same
> > logic, or share the same structure.  Bindings for object oriented
> > programming languages already offer such a base class, abstracting some
> > of the GTK+ functions like gtk_init(), gtk_main() and gtk_main_quit(),
> > in order to fit them into an OOP approach.
> > 
> yes, a gtk_application_new() could do all that (gtk_init, gtk_main and,
> when destroyed, gtk_main_quit).

Maybe we could avoid gtk_init() (but we'd have to pass the args anyway
to GtkApplication) and gtk_main_quit() (just unref'ing the application
object would do) but gtk_main() would be still needed - maybe masked as
gtk_application_run().

> > There has been also a definite movement towards a set of abstractions
> > for desktop usage: the GtkSession API from Dan Winship, the
> > GdkScreensaver API from Rodrigo Moya, the network state abstraction I
> > proposed; all of these makes sense when handled by a single application
> > class.
> > 
> > Finally, the GtkUniqueApplication class makes little sense if we don't
> > provide non-unique application class.
> > 
> rather than GtkApplication/GtkUniqueApplication, I guess it would make
> more sense to have a "unique" property on the GtkApplication class.

It's possible, but I'm not sure it makes "more sense".  I think that a
single instance application is a corner case of application and I like
the idea of keeping the two classes separated; inheriting would make the
switch trivial: GtkUniqueApplication would do everything a
GtkApplication does, plus two methods:

  gtk_unique_application_is_running (GtkUniqueApplication *application)
  gtk_unique_application_send       (GtkUniqueApplication *application,
                                     GdkUniqueCommand      command,
                                     const gchar          *command_data);

Ciao,
 Emmanuele.


-- 
Emmanuele Bassi,  E: ebassi gmail com
W: http://www.emmanuelebassi.net
B: http://log.emmanuelebassi.net




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