gksu-devel
[Top][All Lists]
Advanced

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

Re: gksu 1.1.0, new API


From: Filip Van Raemdonck
Subject: Re: gksu 1.1.0, new API
Date: Sat, 31 Jan 2004 14:28:14 +0100
User-agent: Mutt/1.3.28i

Heya,

On Sat, Jan 31, 2004 at 12:24:44PM +0100, Filip Van Raemdonck wrote:
> On Thu, Jan 29, 2004 at 01:46:35PM -0200, Gustavo Noronha Silva wrote:
> > 
> > The only serious
> > caveat in the implementation now is that libgksu does *not* init the
> > gtk library anywhere yet.
> 
> It probably should. Applications that use GTK+ themselves can then use
> gksu_init at the start; programs that don't can call it right before
> calling other gksu_* calls.

I just realized that gksu_init is really only needed just for calling
gtk_init in the new API, which does make it a bit superfluous to keep
around.
Furthermore, it requires two arguments but requires them _only_ to pass
on; it doesn't need them itselve. This is annoying, as this makes the
API slightly less clean for possible python bindings (and for any other
language which can perform implicit module initalization upon loading).

> > It used to do so through gksu_init, but now I want to do it when the
> > user actually runs something. This has to be seen, yet, and I believe
> > the library will have to do many tries to do that -- maybe one
> > gtk_check_init in each of: gksu_context_new, gksu_ask_password,
> > gksu_run and gksu_sudo_run.... that seems to be sucky, what do
> > you think?
<...>
> Hmm, can gtk_init be called multiple times with no side effects?

I just checked it's source code, it looks like it can.

Given that, I think it's safe to simply call gtk_init at the front of any
gksu function that needs it. Note that we can pass it dummy arguments
there; if gtk has already been initialized they'll be discarded and if it
hasn't - indicating a non-GTK+ app - we shouldn't be passing special
arguments to GTK+ anyway.

> > gchar* gksu_ask_password (GksuContext*);
> > gboolean gksu_run (GksuContext*, gchar*);
> > gboolean gksu_sudo_run (GksuContext*, gchar*);
> > void gksu_set_user (GksuContext*, gchar*);
> > const gchar* gksu_get_user (GksuContext*);
> 
> (just commenting on design, not functionality. I'll have to take a closer
> look first)
> Seems a bit awkward. Why aren't these methods on GksuContext instead of
> plain gksu functions, if they all require a context to begin with?

To answer myself, because GksuContext isn't a GObject to begin with.
I'll see how much work it is to implement that way.


Regards,

Filip

-- 
<Tv> AAAH!
* Tv stabs netscape
* Espy nets stabscape
* liiwi2 just removes netscape




reply via email to

[Prev in Thread] Current Thread [Next in Thread]