82
* gpm_icon_policy_from_string:
82
gpm_tray_icon_mode_from_string (const gchar *str)
85
gpm_icon_policy_from_string (const gchar *policy)
85
88
return GPM_ICON_POLICY_NEVER;
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;
99
return GPM_ICON_POLICY_NEVER;
99
if (g_strcmp0 (policy, "never") == 0)
100
return GPM_ICON_POLICY_NEVER;
101
return GPM_ICON_POLICY_NEVER;
105
* gpm_icon_policy_to_string:
104
gpm_tray_icon_mode_to_string (GpmIconPolicy mode)
108
gpm_icon_policy_to_string (GpmIconPolicy policy)
106
if (mode == GPM_ICON_POLICY_ALWAYS) {
110
if (policy == GPM_ICON_POLICY_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)
112
} else if (mode == GPM_ICON_POLICY_CRITICAL) {
116
if (policy == GPM_ICON_POLICY_LOW)
118
if (policy == GPM_ICON_POLICY_CRITICAL)
113
119
return "critical";
114
} else if (mode == GPM_ICON_POLICY_NEVER) {
120
if (policy == GPM_ICON_POLICY_NEVER)
126
* gpm_action_policy_from_string:
129
gpm_action_policy_from_string (const gchar *policy)
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;
147
* gpm_action_policy_to_string:
150
gpm_action_policy_to_string (GpmActionPolicy policy)
152
if (policy == GPM_ACTION_POLICY_BLANK)
154
if (policy == GPM_ACTION_POLICY_SHUTDOWN)
156
if (policy == GPM_ACTION_POLICY_SUSPEND)
158
if (policy == GPM_ACTION_POLICY_HIBERNATE)
160
if (policy == GPM_ACTION_POLICY_INTERACTIVE)
161
return "interactive";