Re: Porting KDE3 NetworkManager to 0.9

2011-10-10 Thread Lamarque V. Souza
Em Monday 10 October 2011, Robert Xu escreveu:
> On Mon, Oct 10, 2011 at 20:02, Lamarque V. Souza  wrote:
> > You can also look at how we implemented it in Plasma NM (KDE 4.x):
> > git clone git://anongit.kde.org/networkmanagement (branch nm09)
> > This is our agent backends/NetworkManager/nmdbussecretagent.cpp.
> 
> Oh, thanks for this. I was looking for how KDE4 did it in hopes that I
> could maybe backport some stuff.
> 
> > We added a watcher for NetworkManager service, everytime NM appears on
> > DBus the watcher triggers the agent registration.
> 
> So, basically, it just idles in the panel waiting for NM?

Yes. The agent's constructor sets up the watcher and afterwards calls 
the slot reponsable for registering the agent. If NM is running the 
registration succeeds and that is it. If NM is not running the registration 
fails, but whenever NM appears on the system bus the slot is called again and 
it registers the agent. This scheme also works when NM restarts. If you call 
the registration slot only on knetworkmanager start the agent will stop 
working when NM restarts.
 
> > In Qt 4.x you create a QDBusInterface to NM's agent manager service and
> > just call ->connection().registerObject(NM_DBUS_PATH_SECRET_AGENT,
> > d->agent, QDBusConnection::ExportAllSlots). d->agent is the pointer to
> > our dbus adaptor object, which is a child of our agent and connects the
> > agent to the system bus.
> 
> *notes*
> 
> > Well, I have never programmed with qt3's dbus bindings :-/ I cannot help
> > with this part.
> 
> That's fine, I think I have a much better idea now.
> Thanks so much!

You are welcome.

-- 
Lamarque V. Souza
KDE's Network Management maintainer
http://planetkde.org/pt-br
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Porting KDE3 NetworkManager to 0.9

2011-10-10 Thread Robert Xu
On Mon, Oct 10, 2011 at 20:02, Lamarque V. Souza  wrote:
>
> You can also look at how we implemented it in Plasma NM (KDE 4.x):
> git clone git://anongit.kde.org/networkmanagement (branch nm09)
> This is our agent backends/NetworkManager/nmdbussecretagent.cpp.

Oh, thanks for this. I was looking for how KDE4 did it in hopes that I
could maybe backport some stuff.

>
>
> We added a watcher for NetworkManager service, everytime NM appears on DBus
> the watcher triggers the agent registration.
>

So, basically, it just idles in the panel waiting for NM?


>
> In Qt 4.x you create a QDBusInterface to NM's agent manager service and just
> call ->connection().registerObject(NM_DBUS_PATH_SECRET_AGENT, d->agent,
> QDBusConnection::ExportAllSlots). d->agent is the pointer to our dbus
> adaptor object, which is a child of our agent and connects the agent to the
> system bus.
>

*notes*

>
> Well, I have never programmed with qt3's dbus bindings :-/ I cannot help
> with this part.

That's fine, I think I have a much better idea now.
Thanks so much!

-- 
later daze. :: Robert Xu :: rxu.lincomlinux.org :: protocol.by/rxu
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Porting KDE3 NetworkManager to 0.9

2011-10-10 Thread Robert Xu
On Mon, Oct 10, 2011 at 17:48, Dan Williams  wrote:
> On Sat, 2011-10-08 at 14:15 -0400, Robert Xu wrote:
>> Hi all,
>>
>> Given the fact that I am relatively new at this stuff, forgive me if I
>> am asking very noobish questions...
>>
>> I am trying to figure out how to implement the Register/Unregister
>> functions and the SecretAgent interfaces.
>
> http://projects.gnome.org/NetworkManager/developers/api/09/ref-migrating.html
>
> has more information on the architecture changes in 0.9.  One big one is
> that the session applets (knetworkmanager, nm-applet, etc) no longer
> store whole connections; they only store secrets.  Thus they become
> secret agents instead of full settings storage services.  They no longer
> need to advertise a D-Bus service.
>
>> - Where would I implement Register/Unregister? When the program starts
>> up/closes down?
>
> Yes, whenever the thing that's going to respond to secrets requests (ie,
> the secret agent) starts up and shuts down.

So at program start/end...

>
>>     - (what c++ call do I make to do that? >>;)
>
> Probably the Qt D-Bus bindings, which I think is what the old KDE stuff used.
>
>> - For SecretAgent interfaces, KNetworkManager has a storage file that
>> handles this stuff. Should this all be depreciated for NM's new
>> handling?
>
> Not necessarily; you'd still need to store secrets somewhere, and the
> storage files are probably as good as any.  But you wont' need to store
> whole connections; just secrets.  So at a minimum you'll need to store
> the secret itself, the key name of the secret (ie 'psk' or 'password' or
> whatever), and the UUID of the connection the secret is for.

So the old storage backend just has to be modified to store secrets
instead of connections...

>
>>     - (again, how do you call the functions in c++? relatively new to
>> dbus calling in c++ >>;)
>
> Usually with Qt/KDE you'd use the Qt D-Bus bindings to do anything D-Bus
> related.  Unfortunately I don't know much about those, but others on
> this list (like Will Stephenson and Eckhart Woerner) know the Qt/KDE
> side of things.
>

Ok, thanks!



-- 
later daze. :: Robert Xu :: rxu.lincomlinux.org :: protocol.by/rxu
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Porting KDE3 NetworkManager to 0.9

2011-10-10 Thread Lamarque V. Souza
Em Monday 10 October 2011, Dan Williams escreveu:
> On Sat, 2011-10-08 at 14:15 -0400, Robert Xu wrote:
> > Hi all,
> > 
> > Given the fact that I am relatively new at this stuff, forgive me if I
> > am asking very noobish questions...
> > 
> > I am trying to figure out how to implement the Register/Unregister
> > functions and the SecretAgent interfaces.
> 
> http://projects.gnome.org/NetworkManager/developers/api/09/ref-migrating.ht
> ml
> 
> has more information on the architecture changes in 0.9.  One big one is
> that the session applets (knetworkmanager, nm-applet, etc) no longer
> store whole connections; they only store secrets.  Thus they become
> secret agents instead of full settings storage services.  They no longer
> need to advertise a D-Bus service.

You can also look at how we implemented it in Plasma NM (KDE 4.x):

git clone git://anongit.kde.org/networkmanagement (branch nm09)

This is our agent backends/NetworkManager/nmdbussecretagent.cpp. 
 
> > - Where would I implement Register/Unregister? When the program starts
> > up/closes down?
> 
> Yes, whenever the thing that's going to respond to secrets requests (ie,
> the secret agent) starts up and shuts down.

We added a watcher for NetworkManager service, everytime NM appears on 
DBus the watcher triggers the agent registration.
 
> > - (what c++ call do I make to do that? >>;)
> 
> Probably the Qt D-Bus bindings, which I think is what the old KDE stuff
> used.

In Qt 4.x you create a QDBusInterface to NM's agent manager service and 
just call ->connection().registerObject(NM_DBUS_PATH_SECRET_AGENT, d->agent, 
QDBusConnection::ExportAllSlots). d->agent is the pointer to our dbus adaptor 
object, which is a child of our agent and connects the agent to the system 
bus.

> > - For SecretAgent interfaces, KNetworkManager has a storage file that
> > handles this stuff. Should this all be depreciated for NM's new
> > handling?
> 
> Not necessarily; you'd still need to store secrets somewhere, and the
> storage files are probably as good as any.  But you wont' need to store
> whole connections; just secrets.  So at a minimum you'll need to store
> the secret itself, the key name of the secret (ie 'psk' or 'password' or
> whatever), and the UUID of the connection the secret is for.

In Plasma NM we allows to save secrets in kwallet or in plain text 
(text 
files). Kwallet is the default storage. This file implements our storage 
service: libs/service/secretstorage.cpp.

> > - (again, how do you call the functions in c++? relatively new to
> > 
> > dbus calling in c++ >>;)
> 
> Usually with Qt/KDE you'd use the Qt D-Bus bindings to do anything D-Bus
> related.  Unfortunately I don't know much about those, but others on
> this list (like Will Stephenson and Eckhart Woerner) know the Qt/KDE
> side of things.

Well, I have never programmed with qt3's dbus bindings :-/ I cannot 
help 
with this part.

-- 
Lamarque V. Souza
KDE's Network Management maintainer
http://planetkde.org/pt-br
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Porting KDE3 NetworkManager to 0.9

2011-10-10 Thread Dan Williams
On Sat, 2011-10-08 at 14:15 -0400, Robert Xu wrote:
> Hi all,
> 
> Given the fact that I am relatively new at this stuff, forgive me if I
> am asking very noobish questions...
> 
> I am trying to figure out how to implement the Register/Unregister
> functions and the SecretAgent interfaces.

http://projects.gnome.org/NetworkManager/developers/api/09/ref-migrating.html

has more information on the architecture changes in 0.9.  One big one is
that the session applets (knetworkmanager, nm-applet, etc) no longer
store whole connections; they only store secrets.  Thus they become
secret agents instead of full settings storage services.  They no longer
need to advertise a D-Bus service.

> - Where would I implement Register/Unregister? When the program starts
> up/closes down?

Yes, whenever the thing that's going to respond to secrets requests (ie,
the secret agent) starts up and shuts down.

> - (what c++ call do I make to do that? >>;)

Probably the Qt D-Bus bindings, which I think is what the old KDE stuff used.

> - For SecretAgent interfaces, KNetworkManager has a storage file that
> handles this stuff. Should this all be depreciated for NM's new
> handling?

Not necessarily; you'd still need to store secrets somewhere, and the
storage files are probably as good as any.  But you wont' need to store
whole connections; just secrets.  So at a minimum you'll need to store
the secret itself, the key name of the secret (ie 'psk' or 'password' or
whatever), and the UUID of the connection the secret is for.

> - (again, how do you call the functions in c++? relatively new to
> dbus calling in c++ >>;)

Usually with Qt/KDE you'd use the Qt D-Bus bindings to do anything D-Bus
related.  Unfortunately I don't know much about those, but others on
this list (like Will Stephenson and Eckhart Woerner) know the Qt/KDE
side of things.

Dan

___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Porting KDE3 NetworkManager to 0.9

2011-10-08 Thread Robert Xu
Hi all,

Given the fact that I am relatively new at this stuff, forgive me if I
am asking very noobish questions...

I am trying to figure out how to implement the Register/Unregister
functions and the SecretAgent interfaces.

- Where would I implement Register/Unregister? When the program starts
up/closes down?
- (what c++ call do I make to do that? >>;)

- For SecretAgent interfaces, KNetworkManager has a storage file that
handles this stuff. Should this all be depreciated for NM's new
handling?
- (again, how do you call the functions in c++? relatively new to
dbus calling in c++ >>;)


Thanks in advance.

-- 
later daze. :: Robert Xu
___
networkmanager-list mailing list
networkmanager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list