Index: gnome-packagekit-2.91.4/src/gpk-update-icon.c =================================================================== --- gnome-packagekit-2.91.4.orig/src/gpk-update-icon.c +++ gnome-packagekit-2.91.4/src/gpk-update-icon.c @@ -48,6 +48,78 @@ static GpkFirmware *firmware = NULL; static GpkHardware *hardware = NULL; static guint timer_id = 0; static gboolean timed_exit = FALSE; +static GSettings *settings = NULL; + +#define GPK_UPDATE_HARDWARE_SEND_ACTION "gpk-update-icon hardware info - send " +#define GPK_UPDATE_HARDWARE_DONT_PROMPT_ACTION "gpk-update-icon hardware info - don't ask again" + +static void +gpk_update_libnotify_cb (NotifyNotification *notification, gchar *action, gpointer data) +{ + if (g_strcmp0 (action, GPK_UPDATE_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", GPK_SETTINGS_HARDWARE_ASKED_TO_COLLECT); + g_settings_set_boolean (settings, GPK_SETTINGS_HARDWARE_ASKED_TO_COLLECT, TRUE); + } else if (g_strcmp0 (action, GPK_UPDATE_HARDWARE_DONT_PROMPT_ACTION) == 0) { + g_debug ("set %s to TRUE because user said no", GPK_SETTINGS_HARDWARE_ASKED_TO_COLLECT); + g_settings_set_boolean (settings, GPK_SETTINGS_HARDWARE_ASKED_TO_COLLECT, TRUE); + } else { + g_warning ("unknown action id: %s", action); + } + +} + +static gboolean +check_for_collect_hardware_information (gpointer 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 (settings, GPK_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.
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, GPK_UPDATE_HARDWARE_SEND_ACTION, + _("Send now"), gpk_update_libnotify_cb, NULL, NULL); + notify_notification_add_action (notification, GPK_UPDATE_HARDWARE_DONT_PROMPT_ACTION, + _("Do not show this again"), gpk_update_libnotify_cb, NULL, 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; +} /** * gpk_icon_timed_exit_cb: @@ -70,11 +142,14 @@ gpk_icon_startup_cb (GtkApplication *app watch = gpk_watch_new (); firmware = gpk_firmware_new (); hardware = gpk_hardware_new (); + settings = g_settings_new (GPK_SETTINGS_SCHEMA); /* Only timeout if we have specified iton the command line */ if (timed_exit) { timer_id = g_timeout_add_seconds (120, (GSourceFunc) gpk_icon_timed_exit_cb, application); g_source_set_name_by_id (timer_id, "[GpkUpdateIcon] timed exit"); + } else { + g_timeout_add_seconds (5 * 60, check_for_collect_hardware_information, NULL); } } Index: gnome-packagekit-2.91.4/data/org.gnome.packagekit.gschema.migrate =================================================================== --- gnome-packagekit-2.91.4.orig/data/org.gnome.packagekit.gschema.migrate +++ gnome-packagekit-2.91.4/data/org.gnome.packagekit.gschema.migrate @@ -45,4 +45,4 @@ dbus-default-interaction = /apps/gnome-p dbus-enforced-interaction = /apps/gnome-packagekit/dbus_enforced_interaction install-root = /apps/gnome-packagekit/install_root media-repo-filenames = /apps/gnome-packagekit/media_repo_filenames - +updater-asked-to-collect-hardware-information = /apps/gnome-packagekit/updater_asked_to_collect_hardware_information Index: gnome-packagekit-2.91.4/src/gpk-common.h =================================================================== --- gnome-packagekit-2.91.4.orig/src/gpk-common.h +++ gnome-packagekit-2.91.4/src/gpk-common.h @@ -53,6 +53,7 @@ G_BEGIN_DECLS #define GPK_SETTINGS_FREQUENCY_GET_UPDATES "frequency-get-updates" #define GPK_SETTINGS_FREQUENCY_GET_UPGRADES "frequency-get-upgrades" #define GPK_SETTINGS_FREQUENCY_REFRESH_CACHE "frequency-refresh-cache" +#define GPK_SETTINGS_HARDWARE_ASKED_TO_COLLECT "updater-asked-to-collect-hardware-information" #define GPK_SETTINGS_IGNORED_DBUS_REQUESTS "ignored-dbus-requests" #define GPK_SETTINGS_IGNORED_DEVICES "ignored-devices" #define GPK_SETTINGS_IGNORED_MESSAGES "ignored-messages"