~gnome-power-manager-team/gnome-power/ubuntu-packaging-2.22

« back to all changes in this revision

Viewing changes to debian/patches/13_critical_action_timer.patch

  • Committer: Ted Gould
  • Date: 2008-05-02 06:00:23 UTC
  • Revision ID: ted@canonical.com-20080502060023-x9af0xgm7nd7ka70
2.22.1-1ubuntu5~ppa6

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
diff -ur gnome-power-manager-2.22.1/src/gpm-cell-array.c gnome-power-manager-ted/src/gpm-cell-array.c
2
2
--- gnome-power-manager-2.22.1/src/gpm-cell-array.c     2008-03-12 13:35:52.000000000 -0700
3
 
+++ gnome-power-manager-ted/src/gpm-cell-array.c        2008-05-01 21:22:12.000000000 -0700
 
3
+++ gnome-power-manager-ted/src/gpm-cell-array.c        2008-05-01 22:59:19.000000000 -0700
4
4
@@ -508,6 +508,39 @@
5
5
 }
6
6
 
50
50
 
51
51
        unit = &(cell_array->priv->unit);
52
52
 
53
 
@@ -570,6 +605,26 @@
 
53
@@ -570,6 +605,19 @@
54
54
                                gpm_cell_array_emit_system_action (cell_array, warnings_state);
55
55
                        }
56
56
                }
58
58
+               /* If we're at one percent, and the time still hasn't expired, we
59
59
+                  set up a timer to signal us at the right time. */
60
60
+               if (unit->percentage < 2 && warnings_state == GPM_WARNINGS_CRITICAL) {
61
 
+                       gpm_conf_get_bool (cell_array->priv->conf, GPM_CONF_USE_TIME_POLICY, &use_time_primary);
62
 
+                       if (use_time_primary == TRUE) {
63
 
+                               gpm_conf_get_uint(cell_array->priv->conf, GPM_CONF_THRESH_TIME_ACTION, &timeout);
64
 
+                               gpm_debug("Threshold action: %d", timeout);
65
 
+                               gpm_debug("Discharge Time: %d", unit->time_discharge);
66
 
+                               /* A little backwards, but no need for another variable */
67
 
+                               timeout = unit->time_discharge - timeout;
68
 
+                               
69
 
+                               if (timeout > 0) {
70
 
+                                       g_timeout_add_seconds (timeout, (GSourceFunc)gpm_cell_array_critical_timer_cb, cell_array);
71
 
+                               }
72
 
+
73
 
+                               /* put here just so we can see the value of timeout if something odd is happening */
74
 
+                               gpm_debug("Setting a timer function for critical action %d seconds.", timeout);
 
61
+                       timeout = gpm_cell_array_get_time_until_action(cell_array);
 
62
+                       
 
63
+                       if (timeout > 0) {
 
64
+                               g_timeout_add_seconds (timeout, (GSourceFunc)gpm_cell_array_critical_timer_cb, cell_array);
75
65
+                       }
 
66
+
 
67
+                       /* put here just so we can see the value of timeout if something odd is happening */
 
68
+                       gpm_debug("Setting a timer function for critical action %d seconds.", timeout);
76
69
+               }
77
70
        }
78
71
 }