static gboolean
_selection_done (gpointer driver)
{
  gis_assistant_next_page (gis_driver_get_assistant (GIS_DRIVER (driver)));

  return FALSE;
}
static void
sync_visibility (GisGoaPage *page)
{
  GisGoaPagePrivate *priv = gis_goa_page_get_instance_private (page);
  GisAssistant *assistant = gis_driver_get_assistant (GIS_PAGE (page)->driver);
  GNetworkMonitor *network_monitor = g_network_monitor_get_default ();
  gboolean visible;

  if (gis_assistant_get_current_page (assistant) == GIS_PAGE (page))
    return;

  visible = (priv->accounts_exist || g_network_monitor_get_network_available (network_monitor));
  gtk_widget_set_visible (GTK_WIDGET (page), visible);
}
static void
rebuild_pages_cb (GisDriver *driver)
{
  PageData *page_data;
  GisAssistant *assistant;
  GisPage *current_page;
  gchar **skip_pages;
  gboolean is_new_user;

  assistant = gis_driver_get_assistant (driver);
  current_page = gis_assistant_get_current_page (assistant);

  skip_pages = pages_to_skip_from_file ();

  page_data = page_table;

  if (current_page != NULL) {
    destroy_pages_after (assistant, current_page);

    for (page_data = page_table; page_data->page_id != NULL; ++page_data)
      if (g_str_equal (page_data->page_id, GIS_PAGE_GET_CLASS (current_page)->page_id))
        break;

    ++page_data;
  }

  is_new_user = (gis_driver_get_mode (driver) == GIS_DRIVER_MODE_NEW_USER);
  for (; page_data->page_id != NULL; ++page_data) {
    if (page_data->new_user_only && !is_new_user)
      continue;

    if (should_skip_page (driver, page_data->page_id, skip_pages))
      continue;

    page_data->prepare_page_func (driver);
  }

  g_strfreev (skip_pages);
}
Beispiel #4
0
static void
on_local_page_confirmed (GisAccountPageLocal *local,
                         GisAccountPage      *page)
{
  gis_assistant_next_page (gis_driver_get_assistant (GIS_PAGE (page)->driver));
}
Beispiel #5
0
static void
confirm (GisPasswordPage *page)
{
  if (page_validate (page))
    gis_assistant_next_page (gis_driver_get_assistant (GIS_PAGE (page)->driver));
}
static void
gis_finished_page_shown (GisPage *page)
{
  GisFinishedPage *self = GIS_FINISHED_PAGE (page);
  GisFinishedPagePrivate *priv = gis_finished_page_get_instance_private (self);
  GError *error = gis_store_get_error();

  gis_driver_save_data (GIS_PAGE (page)->driver);

  if (error != NULL)
    {
      GisAssistant *assistant = gis_driver_get_assistant (page->driver);
      const gchar *heading = NULL;
      const gchar *detail = error->message;

      g_warning ("%s: %s %d %s", G_STRFUNC,
                 g_quark_to_string (error->domain), error->code, error->message);

      if (error->domain == GIS_UNATTENDED_ERROR)
        {
          heading = _("Oops, something is wrong with your unattended installation configuration.");
        }
      else if (error->domain == GIS_IMAGE_ERROR)
        {
          heading = _("Oops, something is wrong with your Endless OS file.");
        }
      else if (error->domain == GIS_DISK_ERROR)
        {
          heading = _("Oops, something went wrong while finding suitable disks to reformat.");
        }
      else if (error->domain == GIS_INSTALL_ERROR)
        {
          heading = _("Oops, something went wrong while reformatting.");
        }
      else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        {
          heading = error->message;
          detail = NULL;
          gtk_widget_hide (GTK_WIDGET (priv->error_label));
          gtk_widget_hide (GTK_WIDGET (priv->diagnostics_label));
          gtk_widget_hide (GTK_WIDGET (priv->support_label));
        }
      else
        {
          heading = _("Oops, something went wrong.");
        }

      if (heading != NULL)
        gtk_label_set_text (priv->error_heading_label, heading);

      if (detail != NULL)
        gtk_label_set_text (priv->error_label, detail);

      gtk_widget_show (priv->error_box);
      gtk_widget_hide (priv->success_box);
      gis_assistant_locale_changed (assistant);

      if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
        {
          /* Running eos-diagnostics can be slow enough that we can't do it
           * synchronously on the UI thread.
           */
          GFile *image_dir = G_FILE (gis_store_get_object (GIS_STORE_IMAGE_DIR));
          /* See implementation of gis_write_diagnostics_async for rationale. */
          const gchar *home_dir = priv->gedit != NULL ? g_get_home_dir () : NULL;

          g_application_hold (G_APPLICATION (page->driver));
          gis_write_diagnostics_async (NULL, image_dir, home_dir,
                                       NULL, write_diagnostics_cb,
                                       g_object_ref (self));
        }

      if (gis_store_is_unattended())
        {
          g_timeout_add_seconds (1, (GSourceFunc)toggle_leds, page);
        }

      /* If running within a live session, hide the "Turn off" button on error,
       * since we have a perfectly good [X] button on the titlebar and we want
       * to encourage the user to notice the link to the diagnostics file.
       */
      GisDriverMode mode = gis_driver_get_mode (GIS_PAGE (self)->driver);
      gtk_widget_set_visible (GTK_WIDGET (priv->restart_button),
                              mode == GIS_DRIVER_MODE_NEW_USER);
    }
  else
    {
      gboolean optical = is_eosdvd ();

      gtk_widget_set_visible (priv->removelabel_usb, !optical);
      gtk_widget_set_visible (priv->removelabel_dvd,  optical);
    }
}