From 220a4e0a64aca0579f50e6e57d4eca848b3ac57f Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 9 Apr 2014 14:58:29 +0200 Subject: remove "battery recall" logic the database is outdated several years now and the whole interface is removed from current UPower release anyway, so let's get rid of it in m-p-m, too --- data/org.mate.power-manager.gschema.xml.in | 5 -- src/gpm-common.h | 1 - src/gpm-engine.c | 47 ------------- src/gpm-engine.h | 4 -- src/gpm-manager.c | 108 ----------------------------- 5 files changed, 165 deletions(-) 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 <_description>The number of seconds of inactivity to spin down the disks when on battery power. - - true - <_summary>If we should show the recalled battery warning for a broken battery - <_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. - true <_summary>If we should show the low capacity warning for a broken battery 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 }; @@ -760,42 +759,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: **/ @@ -829,7 +792,6 @@ gpm_engine_coldplug_idle_cb (GpmEngine *engine) for (i=0;ilen;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 */ @@ -1091,111 +1090,6 @@ gpm_manager_settings_changed_cb (GSettings *settings, const gchar *key, GpmManag gpm_manager_sync_policy_sleep (manager); } -/** - * 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, - "%s", 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: */ @@ -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", -- cgit v1.2.1