static void
on_realm_discover_input (GObject *source,
                         GAsyncResult *result,
                         gpointer user_data)
{
  GisAccountPageEnterprise *page = user_data;
  GisAccountPageEnterprisePrivate *priv = gis_account_page_enterprise_get_instance_private (page);
  GError *error = NULL;
  GList *realms;

  realms = um_realm_manager_discover_finish (priv->realm_manager,
                                             result, &error);

  /* Found a realm, log user into domain */
  if (error == NULL) {
    g_assert (realms != NULL);
    priv->realm = g_object_ref (realms->data);
    enterprise_check_login (page);
    g_list_free_full (realms, g_object_unref);

  } else {
    /* The domain is likely invalid */
    g_dbus_error_strip_remote_error (error);
    g_message ("Couldn't discover domain: %s", error->message);
    gtk_widget_grab_focus (priv->domain_entry);
    set_entry_validation_error (GTK_ENTRY (priv->domain_entry), error->message);
    apply_complete (page, FALSE);
    g_error_free (error);
  }
}
static void
on_realm_discover_input (GObject *source,
                         GAsyncResult *result,
                         gpointer user_data)
{
        UmAccountDialog *self = UM_ACCOUNT_DIALOG (user_data);
        GError *error = NULL;
        GList *realms;

        realms = um_realm_manager_discover_finish (self->realm_manager,
                                                   result, &error);

        /* Found a realm, log user into domain */
        if (error == NULL) {
                g_assert (realms != NULL);
                self->selected_realm = g_object_ref (realms->data);
                enterprise_check_login (self);
                g_list_free_full (realms, g_object_unref);

        /* The domain is likely invalid*/
        } else {
                finish_action (self);
                g_message ("Couldn't discover domain: %s", error->message);
                gtk_widget_grab_focus (GTK_WIDGET (self->enterprise_domain_entry));
                g_dbus_error_strip_remote_error (error);
                set_entry_validation_error (self->enterprise_domain_entry,
                                            error->message);
                g_error_free (error);
        }

        g_object_unref (self);
}