diff --git a/gnome-settings-daemon.spec b/gnome-settings-daemon.spec index 28dcf98..ad7cacb 100644 --- a/gnome-settings-daemon.spec +++ b/gnome-settings-daemon.spec @@ -6,7 +6,7 @@ Name: gnome-settings-daemon Version: 3.10.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The daemon sharing settings from GNOME to GTK+/KDE applications Group: System Environment/Daemons @@ -17,6 +17,9 @@ Source: http://download.gnome.org/sources/%{name}/3.10/%{name}-%{version # disable wacom for ppc/ppc64 (used on RHEL) Patch0: %{name}-3.5.4-ppc-no-wacom.patch +# already upstreamed fixes to the updates plugin +Patch1: master-updates.patch + BuildRequires: gtk3-devel >= 3.7.8 BuildRequires: gnome-desktop3-devel >= %{gnome_desktop_version} BuildRequires: xorg-x11-proto-devel libXxf86misc-devel @@ -86,6 +89,7 @@ The %{name}-updates package contains the updates plugin for %{name} %setup -q %if 0%{?rhel} %patch0 -p1 -b .ppc-no-wacom +%patch1 -p1 -b .updates-fixes %endif autoreconf -i -f @@ -272,6 +276,10 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || : %{_datadir}/glib-2.0/schemas/org.gnome.settings-daemon.plugins.updates.gschema.xml %changelog +* Fri Oct 11 2013 Richard Hughes - 3.10.0-2 +- Grab a patch from upstream to fix the multiple notifications about updates. +- Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1009132 + * Tue Sep 24 2013 Kalev Lember - 3.10.0-1 - Update to 3.10.0 diff --git a/master-updates.patch b/master-updates.patch new file mode 100644 index 0000000..b281bf7 --- /dev/null +++ b/master-updates.patch @@ -0,0 +1,292 @@ +diff --git a/plugins/updates/gsd-updates-manager.c b/plugins/updates/gsd-updates-manager.c +index 3aff29a..901840e 100644 +--- a/plugins/updates/gsd-updates-manager.c ++++ b/plugins/updates/gsd-updates-manager.c +@@ -66,13 +66,11 @@ struct GsdUpdatesManagerPrivate + GVolumeMonitor *volume_monitor; + guint failed_get_updates_count; + GPtrArray *update_packages; +- GFile *offline_update_file; +- GFileMonitor *offline_update_monitor; +- gboolean offline_update_notified; + }; + + static void gsd_updates_manager_class_init (GsdUpdatesManagerClass *klass); + static void gsd_updates_manager_init (GsdUpdatesManager *updates_manager); ++static void restart_and_install_updates (void); + + G_DEFINE_TYPE (GsdUpdatesManager, gsd_updates_manager, G_TYPE_OBJECT) + +@@ -245,6 +243,8 @@ libnotify_action_cb (NotifyNotification *notification, + GsdUpdatesManager *manager = GSD_UPDATES_MANAGER (user_data); + + notify_notification_close (notification, NULL); ++ if (g_strcmp0 (action, "ignore") == 0) ++ goto out; + if (g_strcmp0 (action, "distro-upgrade-info") == 0) { + ret = g_spawn_command_line_async (DATADIR "/PackageKit/pk-upgrade-distro.sh", + &error); +@@ -281,6 +281,10 @@ libnotify_action_cb (NotifyNotification *notification, + show_offline_updates_error (manager); + goto out; + } ++ if (g_strcmp0 (action, "install") == 0) { ++ restart_and_install_updates (); ++ goto out; ++ } + if (g_strcmp0 (action, "cancel") == 0) { + /* try to cancel */ + g_cancellable_cancel (manager->priv->cancellable); +@@ -383,6 +387,11 @@ get_distro_upgrades_finished_cb (GObject *object, + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); ++ notify_notification_add_action (notification, "ignore", ++ /* TRANSLATORS: don't install updates now */ ++ _("Not Now"), ++ libnotify_action_cb, ++ manager, NULL); + notify_notification_add_action (notification, "distro-upgrade-info", + /* TRANSLATORS: provides more information about the upgrade */ + _("More information"), +@@ -514,9 +523,26 @@ notify_critical_updates (GsdUpdatesManager *manager, GPtrArray *array) + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, 15000); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_CRITICAL); +- notify_notification_add_action (notification, "show-update-viewer", +- /* TRANSLATORS: button: open the update viewer to install updates*/ +- _("Install updates"), libnotify_action_cb, manager, NULL); ++ notify_notification_add_action (notification, "ignore", ++ /* TRANSLATORS: don't install updates now */ ++ _("Not Now"), ++ libnotify_action_cb, ++ manager, NULL); ++ if (g_find_program_in_path ("gnome-software")) { ++ notify_notification_add_action (notification, "show-update-viewer", ++ /* TRANSLATORS: view available updates */ ++ _("View"), ++ libnotify_action_cb, manager, NULL); ++ notify_notification_add_action (notification, "install", ++ /* TRANSLATORS: install available updates */ ++ _("Restart & Install"), ++ libnotify_action_cb, ++ manager, NULL); ++ } else { ++ notify_notification_add_action (notification, "show-update-viewer", ++ /* TRANSLATORS: button: open the update viewer to install updates*/ ++ _("Install updates"), libnotify_action_cb, manager, NULL); ++ } + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); +@@ -578,9 +604,26 @@ notify_normal_updates_maybe (GsdUpdatesManager *manager, GPtrArray *array) + notify_notification_set_app_name (notification, _("Software Updates")); + notify_notification_set_timeout (notification, 15000); + notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); +- notify_notification_add_action (notification, "show-update-viewer", +- /* TRANSLATORS: button: open the update viewer to install updates*/ +- _("Install updates"), libnotify_action_cb, manager, NULL); ++ notify_notification_add_action (notification, "ignore", ++ /* TRANSLATORS: don't install updates now */ ++ _("Not Now"), ++ libnotify_action_cb, ++ manager, NULL); ++ if (g_find_program_in_path ("gnome-software")) { ++ notify_notification_add_action (notification, "show-update-viewer", ++ /* TRANSLATORS: view available updates */ ++ _("View"), ++ libnotify_action_cb, manager, NULL); ++ notify_notification_add_action (notification, "install", ++ /* TRANSLATORS: install available updates */ ++ _("Restart & Install"), ++ libnotify_action_cb, ++ manager, NULL); ++ } else { ++ notify_notification_add_action (notification, "show-update-viewer", ++ /* TRANSLATORS: button: open the update viewer to install updates*/ ++ _("Install updates"), libnotify_action_cb, manager, NULL); ++ } + g_signal_connect (notification, "closed", + G_CALLBACK (on_notification_closed), NULL); + ret = notify_notification_show (notification, &error); +@@ -742,7 +785,6 @@ auto_download_updates (GsdUpdatesManager *manager) + package_ids[i] = g_strdup (pk_package_get_id (pkg)); + } + +-#if PK_CHECK_VERSION(0,8,1) + /* we've set only-download in PkTask */ + pk_task_update_packages_async (manager->priv->task, + package_ids, +@@ -750,16 +792,6 @@ auto_download_updates (GsdUpdatesManager *manager) + NULL, NULL, + (GAsyncReadyCallback) package_download_finished_cb, + manager); +-#else +- /* download them all */ +- pk_client_download_packages_async (PK_CLIENT(manager->priv->task), +- package_ids, +- NULL, /* this means system cache */ +- manager->priv->cancellable, +- NULL, NULL, +- (GAsyncReadyCallback) package_download_finished_cb, +- manager); +-#endif + g_strfreev (package_ids); + } + +@@ -1375,120 +1407,6 @@ restart_and_install_updates (void) + g_object_unref (bus); + } + +-static void +-view_updates (void) +-{ +- gboolean ret; +- GError *error = NULL; +- +- ret = g_spawn_command_line_async (BINDIR "/gnome-software --mode updates", &error); +- if (!ret) { +- g_warning ("Failure launching gnome-software: %s", +- error->message); +- g_error_free (error); +- } +-} +- +-static void +-offline_update_action_cb (NotifyNotification *notification, +- gchar *action, +- gpointer user_data) +-{ +- +- notify_notification_close (notification, NULL); +- +- if (g_strcmp0 (action, "view") == 0) { +- view_updates (); +- } +- else if (g_strcmp0 (action, "install") == 0) { +- restart_and_install_updates (); +- } +-} +- +-static gboolean +-reenable_offline_update (gpointer data) +-{ +- GsdUpdatesManager *manager = data; +- +- manager->priv->offline_update_notified = FALSE; +- +- return G_SOURCE_REMOVE; +-} +- +-static void +-notify_offline_update_available (GsdUpdatesManager *manager) +-{ +- NotifyNotification *notification; +- const gchar *title; +- const gchar *body; +- gboolean ret; +- GError *error = NULL; +- +- if (!g_file_query_exists (manager->priv->offline_update_file, NULL)) +- return; +- +- if (manager->priv->offline_update_notified) +- return; +- +- manager->priv->offline_update_notified = TRUE; +- +- /* don't notify more often than every 5 minutes */ +- g_timeout_add_seconds (300, reenable_offline_update, manager); +- +- title = _("Software Updates available"); +- body = _("Important OS and application updates are ready to be installed"); +- notification = notify_notification_new (title, body, +- GSD_UPDATES_ICON_NORMAL); +- notify_notification_set_hint_string (notification, "desktop-entry", "gnome-software"); +- notify_notification_set_app_name (notification, _("GNOME Software")); +- notify_notification_set_timeout (notification, NOTIFY_EXPIRES_NEVER); +- notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); +- notify_notification_add_action (notification, "ignore", +- /* TRANSLATORS: don't install updates now */ +- _("Not Now"), +- offline_update_action_cb, +- manager, NULL); +- if (g_find_program_in_path ("gnome-software")) +- notify_notification_add_action (notification, "view", +- /* TRANSLATORS: view available updates */ +- _("View"), +- offline_update_action_cb, +- manager, NULL); +- else +- notify_notification_add_action (notification, "install", +- /* TRANSLATORS: install available updates */ +- _("Restart & Install"), +- offline_update_action_cb, +- manager, NULL); +- g_signal_connect (notification, "closed", +- G_CALLBACK (on_notification_closed), NULL); +- ret = notify_notification_show (notification, &error); +- if (!ret) { +- g_warning ("error: %s", error->message); +- g_error_free (error); +- } +-} +- +-static void +-offline_update_cb (GFileMonitor *monitor, +- GFile *file, +- GFile *other_file, +- GFileMonitorEvent event_type, +- GsdUpdatesManager *manager) +-{ +- notify_offline_update_available (manager); +-} +- +-static gboolean +-initial_offline_update_check (gpointer data) +-{ +- GsdUpdatesManager *manager = data; +- +- notify_offline_update_available (manager); +- +- return G_SOURCE_REMOVE; +-} +- + gboolean + gsd_updates_manager_start (GsdUpdatesManager *manager, + GError **error) +@@ -1506,9 +1424,7 @@ gsd_updates_manager_start (GsdUpdatesManager *manager, + g_object_set (manager->priv->task, + "background", TRUE, + "interactive", FALSE, +-#if PK_CHECK_VERSION(0,8,1) + "only-download", TRUE, +-#endif + NULL); + + /* watch UDev for missing firmware */ +@@ -1574,15 +1490,6 @@ gsd_updates_manager_start (GsdUpdatesManager *manager, + check_offline_update_cb, + manager); + +- manager->priv->offline_update_file = g_file_new_for_path ("/var/lib/PackageKit/prepared-update"); +- manager->priv->offline_update_monitor = g_file_monitor_file (manager->priv->offline_update_file, 0, NULL, NULL); +- g_signal_connect (manager->priv->offline_update_monitor, "changed", +- G_CALLBACK (offline_update_cb), manager); +- +- g_timeout_add_seconds (300, +- initial_offline_update_check, +- manager); +- + /* success */ + ret = TRUE; + g_debug ("Started updates manager"); +@@ -1605,8 +1512,6 @@ gsd_updates_manager_stop (GsdUpdatesManager *manager) + g_clear_object (&manager->priv->firmware); + g_clear_object (&manager->priv->proxy_session); + g_clear_object (&manager->priv->volume_monitor); +- g_clear_object (&manager->priv->offline_update_file); +- g_clear_object (&manager->priv->offline_update_monitor); + if (manager->priv->cancellable) { + g_cancellable_cancel (manager->priv->cancellable); + g_clear_object (&manager->priv->cancellable);