~ubuntu-branches/ubuntu/karmic/gnome-power-manager/karmic-updates

« back to all changes in this revision

Viewing changes to applets/brightness/gpm-common.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-29 16:48:33 UTC
  • mfrom: (2.1.42 upstream)
  • Revision ID: james.westby@ubuntu.com-20090729164833-vyi35necqjjbu0oj
Tags: 2.27.2+git20090729-0ubuntu1
* Upgrade to current git (d585c3a4e5) to clean up our patch forest, drop
  DeviceKit in favor of gudev, and get the porting to the new PolicyKit-1
  API.
* 03-system-policy.patch, 07-bugreport-shebang.patch,
  25_sparc_char_to_int.patch, 22_xfce_desktop_files.patch,
  23_numlock_hotkey.patch: Committed upstream, drop.
* 09_lid_always_blanks.patch: Finally drop this (was already disabled
  before).
* Drop 26-notifications.patch. It was disabled before (due to not applying
  any more), and upstream fixed it in a better way.
* Drop 14_inhibit_tool.patch: This functionality moved to gnome-session.
* Add patch tag headers to our remaining patches and re-enumerate them.
* Disable 21_idle_key_removal.patch: It is unclear whether this is still
  actually an issue in the new world where we just read -evdev events
  instead of ACPI events from hal, is pretty hackish, and it potentially
  leads to dropping valid events.
* Update dependencies:
  - Drop libpolkit-* (not necessary with PK 1.0).
  - Drop libdevkit-gobject-dev (DeviceKit is not used any more).
  - Bump devicekit-power dependencies to >= 010 (which provides the backend
    porting to PK 1.0).
  - Add libpanel-applet2-dev, now required for new version.
* 01-disable-quirks-reference.patch: Drop original code patch, replace with
  changed default gconf value.
* Disable 02-notify-osd-support.patch for now, upstream rewrote the
  notification system and the patch needs to be re-done. See LP #406396.
* 03-remove-discharging-notify.patch: Adapt to new upstream version.
* debian/rules: gnome-power-cmd.sh is no more, drop installation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        return timestring;
79
79
}
80
80
 
 
81
/**
 
82
 * gpm_icon_policy_from_string:
 
83
 **/
81
84
GpmIconPolicy
82
 
gpm_tray_icon_mode_from_string (const gchar *str)
 
85
gpm_icon_policy_from_string (const gchar *policy)
83
86
{
84
 
        if (str == NULL) {
 
87
        if (policy == NULL)
85
88
                return GPM_ICON_POLICY_NEVER;
86
 
        }
87
 
 
88
 
        if (strcmp (str, "always") == 0) {
 
89
        if (g_strcmp0 (policy, "always") == 0)
89
90
                return GPM_ICON_POLICY_ALWAYS;
90
 
        } else if (strcmp (str, "present") == 0) {
 
91
        if (g_strcmp0 (policy, "present") == 0)
91
92
                return GPM_ICON_POLICY_PRESENT;
92
 
        } else if (strcmp (str, "charge") == 0) {
 
93
        if (g_strcmp0 (policy, "charge") == 0)
93
94
                return GPM_ICON_POLICY_CHARGE;
94
 
        } else if (strcmp (str, "critical") == 0) {
 
95
        if (g_strcmp0 (policy, "low") == 0)
 
96
                return GPM_ICON_POLICY_LOW;
 
97
        if (g_strcmp0 (policy, "critical") == 0)
95
98
                return GPM_ICON_POLICY_CRITICAL;
96
 
        } else if (strcmp (str, "never") == 0) {
97
 
                return GPM_ICON_POLICY_NEVER;
98
 
        } else {
99
 
                return GPM_ICON_POLICY_NEVER;
100
 
        }
 
99
        if (g_strcmp0 (policy, "never") == 0)
 
100
                return GPM_ICON_POLICY_NEVER;
 
101
        return GPM_ICON_POLICY_NEVER;
101
102
}
102
103
 
 
104
/**
 
105
 * gpm_icon_policy_to_string:
 
106
 **/
103
107
const gchar *
104
 
gpm_tray_icon_mode_to_string (GpmIconPolicy mode)
 
108
gpm_icon_policy_to_string (GpmIconPolicy policy)
105
109
{
106
 
        if (mode == GPM_ICON_POLICY_ALWAYS) {
 
110
        if (policy == GPM_ICON_POLICY_ALWAYS)
107
111
                return "always";
108
 
        } else if (mode == GPM_ICON_POLICY_PRESENT) {
 
112
        if (policy == GPM_ICON_POLICY_PRESENT)
109
113
                return "present";
110
 
        } else if (mode == GPM_ICON_POLICY_CHARGE) {
 
114
        if (policy == GPM_ICON_POLICY_CHARGE)
111
115
                return "charge";
112
 
        } else if (mode == GPM_ICON_POLICY_CRITICAL) {
 
116
        if (policy == GPM_ICON_POLICY_LOW)
 
117
                return "low";
 
118
        if (policy == GPM_ICON_POLICY_CRITICAL)
113
119
                return "critical";
114
 
        } else if (mode == GPM_ICON_POLICY_NEVER) {
115
 
                return "never";
116
 
        } else {
117
 
                return "never";
118
 
        }
 
120
        if (policy == GPM_ICON_POLICY_NEVER)
 
121
                return "never";
 
122
        return "never";
 
123
}
 
124
 
 
125
/**
 
126
 * gpm_action_policy_from_string:
 
127
 **/
 
128
GpmActionPolicy
 
129
gpm_action_policy_from_string (const gchar *policy)
 
130
{
 
131
        if (policy == NULL)
 
132
                return GPM_ACTION_POLICY_NOTHING;
 
133
        if (g_strcmp0 (policy, "blank") == 0)
 
134
                return GPM_ACTION_POLICY_BLANK;
 
135
        if (g_strcmp0 (policy, "shutdown") == 0)
 
136
                return GPM_ACTION_POLICY_SHUTDOWN;
 
137
        if (g_strcmp0 (policy, "suspend") == 0)
 
138
                return GPM_ACTION_POLICY_SUSPEND;
 
139
        if (g_strcmp0 (policy, "hibernate") == 0)
 
140
                return GPM_ACTION_POLICY_HIBERNATE;
 
141
        if (g_strcmp0 (policy, "interactive") == 0)
 
142
                return GPM_ACTION_POLICY_INTERACTIVE;
 
143
        return GPM_ACTION_POLICY_NOTHING;
 
144
}
 
145
 
 
146
/**
 
147
 * gpm_action_policy_to_string:
 
148
 **/
 
149
const gchar *
 
150
gpm_action_policy_to_string (GpmActionPolicy policy)
 
151
{
 
152
        if (policy == GPM_ACTION_POLICY_BLANK)
 
153
                return "blank";
 
154
        if (policy == GPM_ACTION_POLICY_SHUTDOWN)
 
155
                return "shutdown";
 
156
        if (policy == GPM_ACTION_POLICY_SUSPEND)
 
157
                return "suspend";
 
158
        if (policy == GPM_ACTION_POLICY_HIBERNATE)
 
159
                return "hibernate";
 
160
        if (policy == GPM_ACTION_POLICY_INTERACTIVE)
 
161
                return "interactive";
 
162
        return "nothing";
119
163
}
120
164
 
121
165
/**