summaryrefslogtreecommitdiff
path: root/mate-extra/mate-power-manager/files/mate-power-manager-1.8.0-r1-remove-battery-recall-logic.patch
blob: 6d462b937ce7c52845cacdf2b865a98f32e75893 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
diff --git a/data/org.mate.power-manager.gschema.xml.in b/data/org.mate.power-manager.gschema.xml.in
index adecce0..ca009b5 100644
--- a/data/org.mate.power-manager.gschema.xml.in
+++ b/data/org.mate.power-manager.gschema.xml.in
@@ -211,11 +211,6 @@
       <_summary>Seconds of inactivity to spin down when on battery</_summary>
       <_description>The number of seconds of inactivity to spin down the disks when on battery power.</_description>
     </key>
-    <key name="notify-perhaps-recall" type="b">
-      <default>true</default>
-      <_summary>If we should show the recalled battery warning for a broken battery</_summary>
-      <_description>If we should show the recalled battery warning for a broken battery. Set this to false only if you know your battery is okay.</_description>
-    </key>
     <key name="notify-low-capacity" type="b">
       <default>true</default>
       <_summary>If we should show the low capacity warning for a broken battery</_summary>
diff --git a/src/gpm-common.h b/src/gpm-common.h
index ef20f88..303bdd1 100644
--- a/src/gpm-common.h
+++ b/src/gpm-common.h
@@ -98,7 +98,6 @@ G_BEGIN_DECLS
 #define GPM_SETTINGS_SPINDOWN_TIMEOUT_BATT		"spindown-timeout-battery"
 
 /* notify */
-#define GPM_SETTINGS_NOTIFY_PERHAPS_RECALL		"notify-perhaps-recall"
 #define GPM_SETTINGS_NOTIFY_LOW_CAPACITY		"notify-low-capacity"
 #define GPM_SETTINGS_NOTIFY_DISCHARGING			"notify-discharging"
 #define GPM_SETTINGS_NOTIFY_FULLY_CHARGED		"notify-fully-charged"
diff --git a/src/gpm-engine.c b/src/gpm-engine.c
index 0f9d0c1..96a043e 100644
--- a/src/gpm-engine.c
+++ b/src/gpm-engine.c
@@ -72,7 +72,6 @@ enum {
 	CHARGE_ACTION,
 	DISCHARGING,
 	LOW_CAPACITY,
-	PERHAPS_RECALL,
 	LAST_SIGNAL
 };
 
@@ -761,42 +760,6 @@ gpm_engine_device_add (GpmEngine *engine, UpDevice *device)
 }
 
 /**
- * gpm_engine_check_recall:
- **/
-static gboolean
-gpm_engine_check_recall (GpmEngine *engine, UpDevice *device)
-{
-	UpDeviceKind kind;
-	gboolean recall_notice = FALSE;
-	gchar *recall_vendor = NULL;
-	gchar *recall_url = NULL;
-
-	/* get device properties */
-	g_object_get (device,
-		      "kind", &kind,
-		      "recall-notice", &recall_notice,
-		      "recall-vendor", &recall_vendor,
-		      "recall-url", &recall_url,
-		      NULL);
-
-	/* not battery */
-	if (kind != UP_DEVICE_KIND_BATTERY)
-		goto out;
-
-	/* no recall data */
-	if (!recall_notice)
-		goto out;
-
-	/* emit signal for manager */
-	egg_debug ("** EMIT: perhaps-recall");
-	g_signal_emit (engine, signals [PERHAPS_RECALL], 0, device, recall_vendor, recall_url);
-out:
-	g_free (recall_vendor);
-	g_free (recall_url);
-	return recall_notice;
-}
-
-/**
  * gpm_engine_coldplug_idle_cb:
  **/
 static gboolean
@@ -829,7 +792,6 @@ gpm_engine_coldplug_idle_cb (GpmEngine *engine)
 	for (i=0;i<array->len;i++) {
 		device = g_ptr_array_index (array, i);
 		gpm_engine_device_add (engine, device);
-		gpm_engine_check_recall (engine, device);
 	}
 out:
 	if (array != NULL)
@@ -846,7 +808,6 @@ gpm_engine_device_added_cb (UpClient *client, UpDevice *device, GpmEngine *engin
 {
 	/* add to list */
 	g_ptr_array_add (engine->priv->array, g_object_ref (device));
-	gpm_engine_check_recall (engine, device);
 
 	gpm_engine_recalculate_state (engine);
 }
@@ -1134,14 +1095,6 @@ gpm_engine_class_init (GpmEngineClass *klass)
 			      G_STRUCT_OFFSET (GpmEngineClass, low_capacity),
 			      NULL, NULL, g_cclosure_marshal_VOID__POINTER,
 			      G_TYPE_NONE, 1, G_TYPE_POINTER);
-	signals [PERHAPS_RECALL] =
-		g_signal_new ("perhaps-recall",
-			      G_TYPE_FROM_CLASS (object_class),
-			      G_SIGNAL_RUN_LAST,
-			      G_STRUCT_OFFSET (GpmEngineClass, perhaps_recall),
-			      NULL, NULL, gpm_marshal_VOID__POINTER_STRING_STRING,
-			      G_TYPE_NONE,
-			      3, G_TYPE_POINTER, G_TYPE_STRING, G_TYPE_STRING);
 	signals [FULLY_CHARGED] =
 		g_signal_new ("fully-charged",
 			      G_TYPE_FROM_CLASS (object_class),
diff --git a/src/gpm-engine.h b/src/gpm-engine.h
index be1ccd6..43f8956 100644
--- a/src/gpm-engine.h
+++ b/src/gpm-engine.h
@@ -49,10 +49,6 @@ typedef struct
 						 gchar		*icon);
 	void		(* summary_changed)	(GpmEngine	*engine,
 						 gchar		*status);
-	void		(* perhaps_recall)	(GpmEngine	*engine,
-						 UpDevice	*device,
-						 const gchar	*oem_vendor,
-						 const gchar	*website);
 	void		(* low_capacity)	(GpmEngine	*engine,
 						 UpDevice	*device);
 	void		(* charge_low)		(GpmEngine	*engine,
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 6ca9dea..c4d0530 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -68,7 +68,6 @@
 static void     gpm_manager_finalize	(GObject	 *object);
 
 #define GPM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GPM_TYPE_MANAGER, GpmManagerPrivate))
-#define GPM_MANAGER_RECALL_DELAY		30 /* seconds */
 #define GPM_MANAGER_NOTIFY_TIMEOUT_NEVER	0 /* ms */
 #define GPM_MANAGER_NOTIFY_TIMEOUT_SHORT	10 * 1000 /* ms */
 #define GPM_MANAGER_NOTIFY_TIMEOUT_LONG		30 * 1000 /* ms */
@@ -1092,111 +1091,6 @@ gpm_manager_settings_changed_cb (GSettings *settings, const gchar *key, GpmManag
 }
 
 /**
- * gpm_manager_perhaps_recall_response_cb:
- */
-static void
-gpm_manager_perhaps_recall_response_cb (GtkDialog *dialog, gint response_id, GpmManager *manager)
-{
-	GdkScreen *screen;
-	GtkWidget *dialog_error;
-	GError *error = NULL;
-	gboolean ret;
-	const gchar *website;
-
-	/* don't show this again */
-	if (response_id == GTK_RESPONSE_CANCEL) {
-		g_settings_set_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_PERHAPS_RECALL, FALSE);
-		goto out;
-	}
-
-	/* visit recall website */
-	if (response_id == GTK_RESPONSE_OK) {
-		screen = gdk_screen_get_default();
-		website = (const gchar *) g_object_get_data (G_OBJECT (manager), "recall-oem-website");
-		ret = gtk_show_uri (screen, website, gtk_get_current_event_time (), &error);
-		if (!ret) {
-			dialog_error = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
-							       "Failed to show url %s", error->message);
-			gtk_dialog_run (GTK_DIALOG (dialog_error));
-			g_error_free (error);
-		}
-		goto out;
-	}
-out:
-	gtk_widget_destroy (GTK_WIDGET (dialog));
-	return;
-}
-
-/**
- * gpm_manager_perhaps_recall_delay_cb:
- */
-static gboolean
-gpm_manager_perhaps_recall_delay_cb (GpmManager *manager)
-{
-	const gchar *oem_vendor;
-	gchar *title = NULL;
-	gchar *message = NULL;
-	GtkWidget *dialog;
-
-	oem_vendor = (const gchar *) g_object_get_data (G_OBJECT (manager), "recall-oem-vendor");
-
-	/* TRANSLATORS: the battery may be recalled by it's vendor */
-	title = g_strdup_printf ("%s: %s", GPM_NAME, _("Battery may be recalled"));
-	message = g_strdup_printf (_("A battery in your computer may have been "
-				     "recalled by %s and you may be at risk.\n\n"
-				     "For more information visit the battery recall website."), oem_vendor);
-	dialog = gtk_message_dialog_new_with_markup (NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
-						     GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE,
-						     "<span size='larger'><b>%s</b></span>", title);
-
-	gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog), "%s", message);
-
-	/* TRANSLATORS: button text, visit the manufacturers recall website */
-	gtk_dialog_add_button (GTK_DIALOG (dialog), _("Visit recall website"), GTK_RESPONSE_OK);
-
-	/* TRANSLATORS: button text, do not show this bubble again */
-	gtk_dialog_add_button (GTK_DIALOG (dialog), _("Do not show me this again"), GTK_RESPONSE_CANCEL);
-
-	/* wait async for response */
-	gtk_widget_show (dialog);
-	g_signal_connect (dialog, "response", G_CALLBACK (gpm_manager_perhaps_recall_response_cb), manager);
-
-	g_free (title);
-	g_free (message);
-
-	/* never repeat */
-	return FALSE;
-}
-
-/**
- * gpm_manager_engine_perhaps_recall_cb:
- */
-static void
-gpm_manager_engine_perhaps_recall_cb (GpmEngine *engine, UpDevice *device, gchar *oem_vendor, gchar *website, GpmManager *manager)
-{
-	gboolean ret;
-
-	/* don't show when running under GDM */
-	if (g_getenv ("RUNNING_UNDER_GDM") != NULL) {
-		egg_debug ("running under gdm, so no notification");
-		return;
-	}
-
-	/* already shown, and dismissed */
-	ret = g_settings_get_boolean (manager->priv->settings, GPM_SETTINGS_NOTIFY_PERHAPS_RECALL);
-	if (!ret) {
-		egg_debug ("Gsettings prevents notification: %s", GPM_SETTINGS_NOTIFY_PERHAPS_RECALL);
-		return;
-	}
-
-	g_object_set_data_full (G_OBJECT (manager), "recall-oem-vendor", (gpointer) g_strdup (oem_vendor), (GDestroyNotify) g_free);
-	g_object_set_data_full (G_OBJECT (manager), "recall-oem-website", (gpointer) g_strdup (website), (GDestroyNotify) g_free);
-
-	/* delay by a few seconds so the panel can load */
-	g_timeout_add_seconds (GPM_MANAGER_RECALL_DELAY, (GSourceFunc) gpm_manager_perhaps_recall_delay_cb, manager);
-}
-
-/**
  * gpm_manager_engine_icon_changed_cb:
  */
 static void
@@ -2023,8 +1917,6 @@ gpm_manager_init (GpmManager *manager)
 	gpm_manager_sync_policy_sleep (manager);
 
 	manager->priv->engine = gpm_engine_new ();
-	g_signal_connect (manager->priv->engine, "perhaps-recall",
-			  G_CALLBACK (gpm_manager_engine_perhaps_recall_cb), manager);
 	g_signal_connect (manager->priv->engine, "low-capacity",
 			  G_CALLBACK (gpm_manager_engine_low_capacity_cb), manager);
 	g_signal_connect (manager->priv->engine, "icon-changed",