summaryrefslogtreecommitdiff
blob: 66636b604f0e4d973a1f8e6ec2972d66c6a362c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From Fedora Core 6:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=204858 - battery applet polls every second, even on a server
http://cvs.fedora.redhat.com/viewcvs/*checkout*/rpms/gnome-applets/devel/gnome-applets-2.15.90-poll-less.patch?rev=1.1

--- gnome-applets-2.15.90/battstat/battstat_applet.c.poll-less	2006-09-01 13:39:48.000000000 -0400
+++ gnome-applets-2.15.90/battstat/battstat_applet.c	2006-09-01 13:42:15.000000000 -0400
@@ -1545,6 +1545,9 @@
   AtkObject *atk_widget;
   const char *err;
   int no_hal;
+  BatteryStatus info;
+  int timeout_value;
+
 
   if (DEBUG) g_print("main()\n");
 
@@ -1583,7 +1586,16 @@
   create_layout (battstat);
   setup_text_orientation( battstat );
 
-  battstat->pixtimer = gtk_timeout_add (1000, check_for_updates, battstat);
+  power_management_getinfo( &info );
+  /* if we're on ac power and no batter is present, we're probably not a laptop
+   * so lets set a higher timer value
+   */
+  if (info.on_ac_power && info.present==0) 
+	timeout_value=10000;
+  else
+        timeout_value=5000;
+
+  battstat->pixtimer = gtk_timeout_add (timeout_value, check_for_updates, battstat);
 
   panel_applet_setup_menu_from_file (PANEL_APPLET (battstat->applet), 
   			             DATADIR,