gnome-settings-daemon/gnome-packagekit-fate302445.patch
Marcus Rueckert 224deb0f47 Accepting request 77402 from home:gary_lin:branches:GNOME:Factory
- Rebase gnome-settings-daemon-system-proxy-configuration.diff and
  gnome-settings-daemon-bnc462640-mute-action.patch and enable the
  the call to autoreconf.
- Add gnome-settings-daemon-stop-reload-proxy-settings.patch to
  stop the g-s-d packagekit plugin, to pop up the authentication
  for reloading the proxy settings (bnc#689592#c1 for bnc#538353)
- Rebase gnome-packagekit-fate302445.patch and migrate to gsettings

OBS-URL: https://build.opensuse.org/request/show/77402
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-settings-daemon?expand=0&rev=97
2011-08-17 21:47:03 +00:00

134 lines
6.5 KiB
Diff

diff --git a/data/gnome-settings-daemon.convert b/data/gnome-settings-daemon.convert
index 9ecc65f..5a6efbc 100644
--- a/data/gnome-settings-daemon.convert
+++ b/data/gnome-settings-daemon.convert
@@ -93,6 +93,9 @@ priority = /apps/gnome_settings_daemon/plugins/smartcard/priority
active = /apps/gnome_settings_daemon/plugins/sound/active
priority = /apps/gnome_settings_daemon/plugins/sound/priority
+[org.gnome.settings-daemon.plugins.updates]
+asked-to-collect-hardware-info = /apps/gnome-packagekit/updater_asked_to_collect_hardware_information
+
[org.gnome.settings-daemon.plugins.xrandr]
active = /apps/gnome_settings_daemon/plugins/xrandr/active
default-configuration-file = /apps/gnome_settings_daemon/xrandr/default_configuration_file
diff --git a/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
index c09096a..67081e2 100644
--- a/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
+++ b/data/org.gnome.settings-daemon.plugins.updates.gschema.xml.in.in
@@ -120,5 +120,10 @@
<_summary>The filenames on removable media that designate it a software source.</_summary>
<_description>When removable media is inserted, it is checked to see if it contains any important filenames in the root directory. If the filename matches, then an updates check is performed. This allows post-install disks to be used to update running systems.</_description>
</key>
+ <key name="asked-to-collect-hardware-info" type="b">
+ <default>false</default>
+ <_summary>Whether the hardware information collection is asked</_summary>
+ <_description>Whether the hardware information collection is asked</_description>
+ </key>
</schema>
</schemalist>
diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c
index 5c193e9..b1abcc5 100644
--- a/plugins/updates/gsd-updates-manager.c
+++ b/plugins/updates/gsd-updates-manager.c
@@ -35,6 +35,10 @@
#include "gsd-updates-common.h"
#include "gnome-settings-profile.h"
+#define GSD_UPDATES_HARDWARE_SEND_ACTION "gsd-updates hardware info - send "
+#define GSD_UPDATES_HARDWARE_DONT_PROMPT_ACTION "gsd-updates hardware info - don't ask again"
+#define GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT "asked-to-collect-hardware-info"
+
#define GSD_UPDATES_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_UPDATES_MANAGER, GsdUpdatesManagerPrivate))
#define MAX_FAILED_GET_UPDATES 10 /* the maximum number of tries */
@@ -1308,6 +1312,79 @@ on_bus_gotten (GObject *source_object,
NULL);
}
+static void
+gsd_updates_libnotify_cb (NotifyNotification *notification,
+ gchar *action,
+ gpointer data)
+{
+ GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (data);
+
+ if (g_strcmp0 (action, GSD_UPDATES_HARDWARE_SEND_ACTION ) == 0) {
+ gboolean retval = g_spawn_command_line_async ("/usr/bin/smoltGui", NULL);
+ if (!retval) {
+ g_debug ("Failure launching smoltGui");
+ }
+ g_debug ("set %s to TRUE because done", GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT);
+ g_settings_set_boolean (manager->priv->settings_gsd, GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT, TRUE);
+ } else if (g_strcmp0 (action, GSD_UPDATES_HARDWARE_DONT_PROMPT_ACTION) == 0) {
+ g_debug ("set %s to TRUE because user said no", GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT);
+ g_settings_set_boolean (manager->priv->settings_gsd, GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT, TRUE);
+ } else {
+ g_warning ("unknown action id: %s", action);
+ }
+
+}
+
+static gboolean
+check_for_collect_hardware_information (gpointer *data)
+{
+ GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (data);
+ gboolean asked_to_collect = FALSE;
+
+ NotifyNotification *notification;
+ GError *error = NULL;
+ gchar *body, *summary;
+ //gchar *body2;
+ gboolean ret;
+
+ asked_to_collect = g_settings_get_boolean (manager->priv->settings_gsd, GSD_SETTINGS_HARDWARE_ASKED_TO_COLLECT);
+
+ if (asked_to_collect) {
+ g_debug ("don't collect hardware info because already done");
+ return FALSE;
+ }
+
+ if (! g_file_test ("/var/run/smolt_do_opensuse_run", G_FILE_TEST_EXISTS)) {
+ g_debug ("don't collect hardware info yet until smolt is updated - BNC#450105");
+ return TRUE;
+ }
+ if (! g_file_test ("/usr/bin/smoltGui", G_FILE_TEST_EXISTS)) {
+ g_debug ("don't collect hardware info because smoltGui is not installed");
+ return FALSE;
+ }
+
+ summary = g_strdup_printf ("%s", _("openSUSE Updater"));
+ //body = g_strdup_printf ("%s", _("Driver development is prioritized based on hardware popularity.<br>Please send your system profile to influence this work."));
+ body = g_strdup_printf ("%s", _("Driver development is prioritized based on hardware popularity. Please send your system profile to influence this work."));
+ //body2 = g_markup_escape_text (body, -1);
+ notification = notify_notification_new (summary, body, "help-browser");
+ notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER);
+ notify_notification_set_urgency (notification, NOTIFY_URGENCY_LOW);
+ notify_notification_add_action (notification, GSD_UPDATES_HARDWARE_SEND_ACTION,
+ _("Send now"), gsd_updates_libnotify_cb, (gpointer)manager, NULL);
+ notify_notification_add_action (notification, GSD_UPDATES_HARDWARE_DONT_PROMPT_ACTION,
+ _("Do not show this again"), gsd_updates_libnotify_cb, (gpointer)manager, NULL);
+ ret = notify_notification_show (notification, &error);
+ if (!ret) {
+ g_warning ("error: %s", error->message);
+ g_error_free (error);
+ }
+
+ g_free (summary);
+ g_free (body);
+ return FALSE;
+}
+
gboolean
gsd_updates_manager_start (GsdUpdatesManager *manager,
GError **error)
@@ -1406,6 +1483,8 @@ gsd_updates_manager_start (GsdUpdatesManager *manager,
(GAsyncReadyCallback) on_bus_gotten,
manager);
+ g_timeout_add_seconds (5 * 60, check_for_collect_hardware_information, manager);
+
/* success */
ret = TRUE;
g_debug ("Started updates manager");