Andrea Azzarone has proposed merging ~azzar1/ubuntu/+source/gnome-initial-setup:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/gnome-initial-setup:ubuntu/bionic.
Commit message: livepatch: show an error in case of failure Show an error message in case livepatch setup fails. This also will make sure that gnome-intial-setup does not quit before livepatch responds back. Requested reviews: Ubuntu Desktop (ubuntu-desktop) For more details, see: https://code.launchpad.net/~azzar1/ubuntu/+source/gnome-initial-setup/+git/gnome-initial-setup/+merge/354195 -- Your team Ubuntu Desktop is requested to review the proposed merge of ~azzar1/ubuntu/+source/gnome-initial-setup:ubuntu/bionic into ~ubuntu-desktop/ubuntu/+source/gnome-initial-setup:ubuntu/bionic.
diff --git a/debian/changelog b/debian/changelog index 4ce35cf..035bb0a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +gnome-initial-setup (3.28.0-2ubuntu7) UNRELEASED; urgency=medium + + * debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch: + - Show an error message in case livepatch setup fails. This also will + make sure that gnome-intial-setup does not quit before livepatch + responds back (LP: #1764723). + + -- Andrea Azzarone <[email protected]> Mon, 03 Sep 2018 15:28:27 +0000 + gnome-initial-setup (3.28.0-2ubuntu6.16.04.1) bionic; urgency=medium * debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch: diff --git a/debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch b/debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch index 1ba127d..229e026 100644 --- a/debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch +++ b/debian/patches/0001-Add-Ubuntu-mode-with-special-pages.patch @@ -8,21 +8,24 @@ This commit is a combined work of a number of authors. data/Makefile.am | 6 + data/com.ubuntu.welcome.policy.in | 21 + gnome-initial-setup/Makefile.am | 4 + + gnome-initial-setup/gis-driver.c | 35 ++ + gnome-initial-setup/gis-driver.h | 6 + gnome-initial-setup/gnome-initial-setup.c | 40 +- gnome-initial-setup/pages/Makefile.am | 6 +- gnome-initial-setup/pages/apps/Makefile.am | 21 + gnome-initial-setup/pages/apps/apps.gresource.xml | 8 + .../pages/apps/default-snap-icon.svg | 1 + - gnome-initial-setup/pages/apps/gis-apps-page.c | 531 +++++++++++++++++++++ + gnome-initial-setup/pages/apps/gis-apps-page.c | 531 ++++++++++++++++++++ gnome-initial-setup/pages/apps/gis-apps-page.h | 52 ++ gnome-initial-setup/pages/apps/gis-apps-page.ui | 96 ++++ gnome-initial-setup/pages/livepatch/Makefile.am | 21 + - .../pages/livepatch/gis-livepatch-page.c | 483 +++++++++++++++++++ + .../pages/livepatch/gis-livepatch-page.c | 534 +++++++++++++++++++++ .../pages/livepatch/gis-livepatch-page.h | 52 ++ .../pages/livepatch/gis-livepatch-page.ui | 156 ++++++ .../pages/livepatch/livepatch.gresource.xml | 8 + gnome-initial-setup/pages/livepatch/livepatch.svg | 1 + .../pages/privacy/gis-privacy-page.c | 2 +- + .../pages/summary/gis-summary-page.c | 2 +- .../pages/ubuntu-changes/Makefile.am | 21 + .../pages/ubuntu-changes/gis-ubuntu-changes-page.c | 177 +++++++ .../pages/ubuntu-changes/gis-ubuntu-changes-page.h | 52 ++ @@ -36,7 +39,7 @@ This commit is a combined work of a number of authors. .../ubuntu-report/ubuntu-report.gresource.xml | 8 + .../pages/ubuntu-report/ubuntu-report.svg | 1 + po/POTFILES.in | 9 + - 32 files changed, 2404 insertions(+), 5 deletions(-) + 35 files changed, 2497 insertions(+), 6 deletions(-) create mode 100644 data/com.ubuntu.welcome.policy.in create mode 100644 gnome-initial-setup/pages/apps/Makefile.am create mode 100644 gnome-initial-setup/pages/apps/apps.gresource.xml @@ -164,8 +167,78 @@ index c04f1e4..6c36682 100644 $(INITIAL_SETUP_LIBS) \ -lm +diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c +index eeaf1b7..6267b32 100644 +--- a/gnome-initial-setup/gis-driver.c ++++ b/gnome-initial-setup/gis-driver.c +@@ -78,6 +78,9 @@ struct _GisDriverPrivate { + GisDriverMode mode; + UmAccountMode account_mode; + gboolean small_screen; ++ ++ guint inhibit_count; ++ gboolean quit_requested; + }; + typedef struct _GisDriverPrivate GisDriverPrivate; + +@@ -535,6 +538,38 @@ gis_driver_save_data (GisDriver *driver) + gis_assistant_save_data (priv->assistant); + } + ++void ++gis_driver_inhibit_quit (GisDriver *driver) ++{ ++ GisDriverPrivate *priv = gis_driver_get_instance_private (driver); ++ priv->inhibit_count++; ++} ++ ++void ++gis_driver_uninhibit_quit (GisDriver *driver) ++{ ++ GisDriverPrivate *priv = gis_driver_get_instance_private (driver); ++ ++ priv->inhibit_count--; ++ if (!priv->inhibit_count && priv->quit_requested) ++ gis_driver_quit (driver); ++} ++ ++void gis_driver_quit (GisDriver *driver) ++{ ++ GisDriverPrivate *priv = gis_driver_get_instance_private (driver); ++ ++ if (priv->inhibit_count == 0) ++ { ++ g_application_quit (G_APPLICATION (driver)); ++ } ++ else ++ { ++ priv->quit_requested = TRUE; ++ gtk_widget_hide (GTK_WIDGET (priv->main_window)); ++ } ++ } ++ + GisDriver * + gis_driver_new (GisDriverMode mode) + { +diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h +index 9eb408e..c5261fa 100644 +--- a/gnome-initial-setup/gis-driver.h ++++ b/gnome-initial-setup/gis-driver.h +@@ -100,6 +100,12 @@ void gis_driver_hide_window (GisDriver *driver); + + void gis_driver_save_data (GisDriver *driver); + ++void gis_driver_inhibit_quit (GisDriver *driver); ++ ++void gis_driver_uninhibit_quit (GisDriver *driver); ++ ++void gis_driver_quit (GisDriver *driver); ++ + GisDriver *gis_driver_new (GisDriverMode mode); + + G_END_DECLS diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 6cca10b..fa104af 100644 +index 6bc5018..8dbc1ee 100644 --- a/gnome-initial-setup/gnome-initial-setup.c +++ b/gnome-initial-setup/gnome-initial-setup.c @@ -48,6 +48,10 @@ @@ -305,7 +378,7 @@ index 0000000..0d8dd94 \ No newline at end of file diff --git a/gnome-initial-setup/pages/apps/gis-apps-page.c b/gnome-initial-setup/pages/apps/gis-apps-page.c new file mode 100644 -index 0000000..7ef391a +index 0000000..1c47141 --- /dev/null +++ b/gnome-initial-setup/pages/apps/gis-apps-page.c @@ -0,0 +1,531 @@ @@ -430,7 +503,7 @@ index 0000000..7ef391a +gis_apps_page_apply (GisPage *page, GCancellable *cancellable) +{ + gis_ensure_stamp_files (); -+ g_application_quit (G_APPLICATION (GIS_PAGE (page)->driver)); ++ gis_driver_quit (GIS_PAGE (page)->driver); + return FALSE; +} + @@ -1029,10 +1102,10 @@ index 0000000..e40c6dc +EXTRA_DIST = livepatch.gresource.xml $(resource_files) diff --git a/gnome-initial-setup/pages/livepatch/gis-livepatch-page.c b/gnome-initial-setup/pages/livepatch/gis-livepatch-page.c new file mode 100644 -index 0000000..78c7a95 +index 0000000..a14df60 --- /dev/null +++ b/gnome-initial-setup/pages/livepatch/gis-livepatch-page.c -@@ -0,0 +1,483 @@ +@@ -0,0 +1,534 @@ +/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ +/* + * Copyright (C) 2018 Canonical Ltd. @@ -1089,6 +1162,7 @@ index 0000000..78c7a95 + +G_DEFINE_TYPE_WITH_PRIVATE (GisLivepatchPage, gis_livepatch_page, GIS_TYPE_PAGE); + ++#define LIVEPATCH_ENABLING_MESSAGE _("You're all set: Livepatch is now being enabled.") +#define LIVEPATCH_ENABLE_SUCCESS_MESSAGE _("You're all set: Livepatch is now on.") +#define LIVEPATCH_ENABLE_FAILURE_MESSAGE _("Failed to setup Livepatch: please retry.") +#define LIVEPATCH_DISABLE_FAILURE_MESSAGE _("Failed to disable Livepatch: please retry.") @@ -1105,6 +1179,25 @@ index 0000000..78c7a95 +} + +static void ++open_software_properties () ++{ ++ g_autofree gchar *command = NULL; ++ g_autoptr(GAppInfo) info = NULL; ++ g_autoptr(GError) error = NULL; ++ ++ info = g_app_info_create_from_commandline ("software-properties-gtk --open-tab=2", NULL, G_APP_INFO_CREATE_NONE, &error); ++ if (info == NULL) { ++ g_warning ("Failed to get launch information from software-properties-gtk: %s", error->message); ++ return; ++ } ++ ++ if (!g_app_info_launch (info, NULL, NULL, &error)) { ++ g_warning ("Failed to launch software-properties-gtk: %s", error->message); ++ return; ++ } ++} ++ ++static void +on_livepatch_enabled (GObject *source_object, + GAsyncResult *res, + gpointer data) @@ -1114,6 +1207,7 @@ index 0000000..78c7a95 + g_autoptr(GVariant) result = NULL; + gboolean success = TRUE; + gboolean current_state = is_livepatch_enabled (); ++ g_autofree gchar *out_message = NULL; + g_autoptr(GError) error = NULL; + + priv->waiting_for_livepatch_response = FALSE; @@ -1121,10 +1215,10 @@ index 0000000..78c7a95 + result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); + if (result == NULL) { + g_warning ("Failed to enable/disable Livepatch through DBus: %s\n", error->message); ++ out_message = g_strdup (error->message); + success = FALSE; + } else { + gboolean out_error; -+ g_autofree gchar *out_message = NULL; + + g_variant_get (result, "(bs)", &out_error, &out_message); + if (out_error) { @@ -1134,7 +1228,7 @@ index 0000000..78c7a95 + } + + if (success) { -+ /* We failed to enable or disable livepatch. ++ /* We succeded to enable or disable livepatch. + Check if this corresponds to the current user choice. */ + if (current_state != priv->user_current_choice) { + set_livepatch_enabled (page, priv->user_current_choice); @@ -1142,6 +1236,8 @@ index 0000000..78c7a95 + gtk_label_set_text (GTK_LABEL (priv->message_label), LIVEPATCH_ENABLE_SUCCESS_MESSAGE); + } + } else if (current_state != priv->user_current_choice) { ++ GisAssistant *assistant = gis_driver_get_assistant (GIS_PAGE (page)->driver); ++ + /* We failed to enable or disable livepatch. Show an error message if + the current state does not correpond the current user choice. + Ignore the message if the call failed but the current status correponds @@ -1152,7 +1248,34 @@ index 0000000..78c7a95 + } else { + gtk_label_set_text (GTK_LABEL (priv->message_label), LIVEPATCH_DISABLE_FAILURE_MESSAGE); + } ++ ++ if (gis_assistant_get_current_page (assistant) != GIS_PAGE (page)) { ++ GtkWidget *dialog; ++ ++ dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (page))), ++ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, ++ GTK_MESSAGE_ERROR, ++ GTK_BUTTONS_NONE, ++ "<span font_size='x-large' font_weight='bold'>%s</span>", ++ _("Sorry there's been a problem with setting up Canonical Livepatch")); ++ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), ++ _("The error was: %s"), ++ out_message); ++ gtk_dialog_add_buttons (GTK_DIALOG (dialog), ++ _("Settingsā¦"), ++ GTK_RESPONSE_OK, ++ _("Ignore"), ++ GTK_RESPONSE_CANCEL, ++ NULL); ++ ++ if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) ++ open_software_properties (); ++ ++ gtk_widget_destroy (dialog); ++ } + } ++ ++ gis_driver_uninhibit_quit (GIS_PAGE (page)->driver); +} + +static GoaAccount* @@ -1232,6 +1355,7 @@ index 0000000..78c7a95 + args = g_variant_new ("(bs)", FALSE, ""); + } + ++ gis_driver_inhibit_quit (GIS_PAGE (page)->driver); + priv->waiting_for_livepatch_response = TRUE; + g_dbus_proxy_call (proxy, + "SetLivepatchEnabled", @@ -1265,7 +1389,7 @@ index 0000000..78c7a95 + priv->user_current_choice = TRUE; + gtk_widget_set_visible (priv->message_box, TRUE); + if (set_livepatch_enabled (page, TRUE)) { -+ gtk_label_set_text (GTK_LABEL (priv->message_label), LIVEPATCH_ENABLE_SUCCESS_MESSAGE); ++ gtk_label_set_text (GTK_LABEL (priv->message_label), LIVEPATCH_ENABLING_MESSAGE); + } else { + gtk_label_set_text (GTK_LABEL (priv->message_label), LIVEPATCH_ENABLE_FAILURE_MESSAGE); + gtk_widget_set_sensitive (priv->setup_button, TRUE); @@ -1770,6 +1894,19 @@ index f2af372..30e76e3 100644 } static void +diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c +index 44bf3e6..7298699 100644 +--- a/gnome-initial-setup/pages/summary/gis-summary-page.c ++++ b/gnome-initial-setup/pages/summary/gis-summary-page.c +@@ -225,7 +225,7 @@ done_cb (GtkButton *button, GisSummaryPage *page) + log_user_in (page); + break; + case GIS_DRIVER_MODE_EXISTING_USER: +- g_application_quit (G_APPLICATION (GIS_PAGE (page)->driver)); ++ gis_driver_quit (GIS_PAGE (page)->driver); + default: + break; + } diff --git a/gnome-initial-setup/pages/ubuntu-changes/Makefile.am b/gnome-initial-setup/pages/ubuntu-changes/Makefile.am new file mode 100644 index 0000000..f7da724
-- ubuntu-desktop mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop
