Re: GtkApplication and argc/arv



On Wed, Feb 23, 2011 at 12:15 PM, Wen-Yen Chuang <caleb calno com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Murray Cumming wrote:
>> 3. Will we recommend that all GTK+ applications generally use
>> GtkApplication?
>
> As far as I know, GtkApplication depends on dbus.
> You can not use GtkApplication without dbus.
> (Please correct me if I am wrong.)
> So, I think the answer is "No".
> I personal hates dbus and do not use it.

I think and hope this is besides the point, GtkApplication
should be portable for all the relevant GTK+ targets, otherwise
I made a big mistake making Glade a GtkApplication.

As far as I know, GtkApplication depends on GIO, which
should have some extension points for services on different
operating systems... using dbus on linux (not exactly sure
how this works currently in GIO but that's what I suspect
is going on).

In the worst case, if the GIO extension points needed for GtkApplication
are missing on a given system, then possibly your app loses
it's power to be single instance. In any case, using GtkApplication
does not mean you have a direct dependency on a library that
might not be installed and it's a severe GTK+ bug IMO if your app
stops working on win32 or osx just because you are using
GtkApplication.

>> 4. Do we believe that all (GTK+) applications should be
>> single-instance applications?
>
> Single-instance application is good, but not everything should be
> single-instance.
> So again, I think the answer is "No".

Not sure here either... on the one hand, many apps do not need
to be single instance... and on the other hand... for apps that do not
really need to be single instance apps; it does not hurt if they are
implemented as single instance apps.

However there are some advantages if all apps are GtkApplication:

  a.) Overall less memory consumption

        A single instance app that just creates a new window for every
time that
        it is invoked does not allocate memory for any copy-on-write data from
        the GTK+ library nor does it allocate any extra memory on the heap for
        the widget classes and the type system (this applies not only to GTK+
        but for any libraries that the said app might link against).

  b.) A small gain in application startup time

        Along the same lines as "a.)", an application might only have
to initialize
        some things once at startup time but not again for every consecutive
        invocation.

  c.) Another gain if every app was a GtkApplication is that we define a common
       api for launching programs... this opens up some new doors.

       This kind of initiative could eventually help for implementing
watchdogs and
       doing things like changing the current locale of an already
running application
       (I'm thinking of the IPhone's springboard here, still some
obvious gaps that
       need bridging in the meego platform).

Cheers,
           -Tristan


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