Hi Jirka,

Thank you very much. I got the signal in another program. there is
g_signal_emit of signal called "signal-quality" in modemmanager, and this
signal is received as SignalQuality in another program. However, I feel it
is confusing to make the signal name different in the same program without
any definition, except that in the creating of new signal for the object,
mapping the order of signal array into the introspection of the xml signals.
I think it's not robust and not very clear and may need further improvement.

thanks a lot for many helps.

Xiaohong


On Fri, Oct 29, 2010 at 5:17 AM, Jirka Klimes <[email protected]> wrote:

> On Thursday 28 of October 2010 01:30:40 hong sheng wrote:
> > Hi Daniel,
> >
> > Thank you very much. I have some more questions.
> >
> > If I used g_signal_connect at the same program for g_signal_emit, for
> > example, in modemmanager, I can receive that signal because I know the
> > right object for the signal to connect.
> >
> > However, in a different program, how can I get the right GObject to
> connect
> > the signal?
> >
> You can't use pure Glib signals as inter-process communication (IPC). They
> are
> limited for one process only. For communication between two processes you
> need
> some IPC means, like D-Bus.
> Nevertheless, D-Bus signals can be used to "extend" glib signals. Thus
> g_signal_emit() will in turn issue "SignalQuality" signal on D-Bus. And
> this
> signal is received by the other process and converted to "local" glib
> signal.
>
> >
> > For example, in the open source modemmanager, there is a function called
> "
> > g_signal_emit (self, signals[SIGNAL_QUALITY], 0, quality)", where object:
> > self is a modemclass.  If I write my own applet, how can I set
> > "g_signal_connect" with right Object of Modem? I mean how can I get the
> > right object pointer of Modem for the signal to be connected?
> >
> > In addition, I found in the openSource applet, there is a function to
> > connect signal"SignalQuality" as follows:
> >
> >         dbus_g_proxy_add_signal (info->cdma_proxy, "SignalQuality",
> > G_TYPE_UINT, G_TYPE_INVALID);
> >         dbus_g_proxy_connect_signal (info->cdma_proxy, "SignalQuality",
> >                                      G_CALLBACK
> > (signal_quality_changed_cb), info, NULL);
> >
> > But I didn't find a place to emit this signal("SignalQuality") either in
> > modemmanager or in the networkmanager. Something missed in modemmanager
> or
> > networkmanager?
> >
> This is the client part of the whole picture.  dbus_g_proxy_add_signal()
> specify the signal we are interested in and dbus_g_proxy_connect_signal()
> install the handlers that will be called upon signal reception. So, when
> ModemManager emits SIGNAL_QUALITY, "SignalQuality" D-Bus signal is emitted
> (in
> addition to local glib signal). The D-Bus signal is received by the applet
> and
> via dbus-glib converted to local glib signal. This causes
> signal_quality_changed_cb() handler to be called.
>
> http://dbus.freedesktop.org/doc/dbus-glib/dbus-glib-DBusGProxy.html#dbus-g-
> proxy-add-signal<http://dbus.freedesktop.org/doc/dbus-glib/dbus-glib-DBusGProxy.html#dbus-g-%0Aproxy-add-signal>
>
> Jirka
>
_______________________________________________
networkmanager-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to