Changeset 3272
- Timestamp:
- 10/25/07 18:57:18 (6 years ago)
- Location:
- trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-battery
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
src/openmoko-panel-battery.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-battery/ChangeLog
r2897 r3272 1 2007-09-02 Michael Lauer <mickey@openmoko.org> 1 2007-10-25 Thomas Wood <thomas@openedhand.com> 2 3 * src/openmoko-panel-battery.c: (timeout), 4 (mb_panel_applet_create): Only update the display if the battery status 5 has changed 6 7 2007-09-02 Michael Lauer <mickey@openmoko.org> 2 8 3 9 * src/openmoko-battery-plugin.c: -
trunk/src/target/OM-2007.2/panel-plugins/openmoko-panel-battery/src/openmoko-panel-battery.c
r2897 r3272 1 /* vim: set sts=4 sw=4 expandtab: */ 1 2 /* openmoko-panel-battery.c 2 3 * … … 20 21 */ 21 22 23 22 24 #include <libmokopanelui2/moko-panel-applet.h> 23 25 … … 30 32 #define JUICE_PIXMAPS 6 31 33 32 #define DEBUG_THIS_FILE33 34 34 typedef struct { 35 35 MokoPanelApplet* mokoapplet; … … 37 37 } BatteryApplet; 38 38 39 /* applets cannot be unloaded yet */ 40 #if 0 39 41 static void 40 42 battery_applet_free (BatteryApplet *applet) … … 43 45 g_slice_free (BatteryApplet, applet); 44 46 } 47 #endif 45 48 46 49 /* Called every 5 minutes */ … … 48 51 timeout (BatteryApplet *applet) 49 52 { 50 // g_debug( "openmoko-panel-battery::timeout" ); 53 char* icon; 54 static int last_status = -255; /* the status last time we checked */ 51 55 52 56 apm_info info; … … 55 59 apm_read (&info); 56 60 57 char* icon; 61 /* don't do any update if status is the same as the last time */ 62 if (last_status == info.battery_status) 63 { 64 return TRUE; 65 } 58 66 59 67 //FIXME Can we actually find out, when the battery is full? 60 68 61 // g_debug( "-- info.battery_status = %0xd", info.battery_status ); 62 // g_debug( "-- info.battery_percentage = %0xd", info.battery_percentage ); 69 last_status = info.battery_status; 63 70 64 71 if ( info.battery_status == BATTERY_STATUS_ABSENT || … … 83 90 } 84 91 85 //FIXME Check whether we actually need to update92 moko_panel_applet_set_icon( applet->mokoapplet, icon ); 86 93 87 moko_panel_applet_set_icon( applet->mokoapplet, icon );88 94 return TRUE; 89 95 } … … 98 104 t = time( NULL ); 99 105 local_time = localtime(&t); 100 #ifndef DEBUG_THIS_FILE 101 applet->timeout_id = g_timeout_add( 60 * 1000 * 5, (GSourceFunc) timeout, applet); 106 107 //FIXME Add source watching for charger insertion event on /dev/input/event1 108 109 /* should use g_timeout_add_seconds() here to save power, but it is only 110 * available in glib >= 2.14 111 */ 112 applet->timeout_id = g_timeout_add ( 10 * 1000, (GSourceFunc) timeout, applet); 102 113 timeout(applet); 103 //FIXME Add source watching for charger insertion event on /dev/input/event1 104 #else 105 applet->timeout_id = g_timeout_add( 10 * 1000, (GSourceFunc) timeout, applet); 106 #endif 114 107 115 moko_panel_applet_set_icon( mokoapplet, PKGDATADIR "/Battery_00.png" ); 108 116 gtk_widget_show_all( GTK_WIDGET(mokoapplet) );
Note: See TracChangeset
for help on using the changeset viewer.
