After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 455095 - Export battery info to gnome-power-manager
Export battery info to gnome-power-manager
Status: RESOLVED FIXED
Product: gnome-phone-manager
Classification: Other
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: none
none
Depends on:
Blocks: 455099
 
 
Reported: 2007-07-09 09:44 UTC by Bastien Nocera
Modified: 2007-07-11 09:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Bastien Nocera 2007-07-09 09:44:20 UTC
Exported D-Bus API:
i GetNumberBatteries()
i (percentage) b (on_ac) GetBatteryState(i)
signal(BatteryStateChanged)
signal(NumberBatteriesChanged)
Comment 1 Bastien Nocera 2007-07-09 09:48:54 UTC
Would need to send one last signal(BatteryStateChanged) when disconnecting.

So we'd change this to:
signal(BatteryStateChanged) (i, b)
Comment 2 Richard Hughes 2007-07-09 10:19:46 UTC
Dude, why not just send signal(NumberBatteriesChanged) (i) when disconnecting.

You'll also want to use:

signal(BatteryStateChanged) (i [index], i [percentage], b [on_ac])
signal(NumberBatteriesChanged) (i [number])

We need to know what battery has changed for BatteryStateChanged and so we don't have to do a GetNumberBatteries right after we receive NumberBatteriesChanged.
Comment 3 Bastien Nocera 2007-07-11 00:00:26 UTC
D-Bus interface added, although there's nothing actually emitting signals. Let me know if this is right.

2007-07-11  Bastien Nocera  <hadess@hadess.net>

        * configure.in: Add dbus dependency
        * libgsm/Makefile.am: Only bind the .la to libgnokii, rest will
        fall into place
        * libgsm/phonemgr-marshal.list: add marshaller for the D-Bus exported
        objects
        * src/Makefile.am:
        * src/main.c: (phonemgr_object_class_init), (phonemgr_object_init),
        (main):
        * src/org_gnome_phonemgr_Battery.xml: Add a D-Bus interface to send
        out signals when battery status changes
Comment 4 Bastien Nocera 2007-07-11 09:51:48 UTC
Fixed, the interface is in http://svn.gnome.org/viewcvs/phonemgr/trunk/src/org_gnome_phone_Manager.xml?view=markup

2007-07-11  Bastien Nocera  <hadess@hadess.net>

        * libgsm/glibgsmtest.c: (battery):
        * libgsm/phonemgr-listener.c: (phonemgr_listener_emit_battery),
        (phonemgr_listener_push):
        * libgsm/phonemgr-listener.h: Change the public API to use on_ac
        rather than on_battery to match gnome-power-manager's external API

        * src/app.h:
        * src/connection.c: (on_status), (on_battery),
        (initialise_connection):
        * src/main.c: (main):
        * src/phonemgr-object.c:
        (phonemgr_object_emit_number_batteries_changed),
        (phonemgr_object_emit_battery_state_changed):
        * src/phonemgr-object.h: Emit battery related signals on the D-Bus
        interface for gnome-power-manager's benefit (Closes: #455095)

2007-07-11  Bastien Nocera  <hadess@hadess.net>

        * src/app.h:
        * src/connection.c: (on_status), (free_connection),
        (initialise_connection): Remove an unneeded timeout
        id, use g_timeout_add_seconds() for our reconnector function

        * src/Makefile.am:
        * src/main.c: (main):
        * src/org_gnome_phone_Manager.xml:
        * src/org_gnome_phonemgr_Battery.xml:
        * src/phonemgr-object.c: (phonemgr_object_class_init),
        (phonemgr_object_emit_number_batteries_changed),
        (phonemgr_object_emit_battery_state_changed),
        (phonemgr_object_init):
        * src/phonemgr-object.h: Move the battery signal code to
        another file, rename to org.gnome.phone.Manager